|
YAACC - UPNP Client and Server
|
The Snapcast groups as receivers: joins the SnapcastDirectory (which servers exist) with one SnapcastServerLink per server (what each server says) and hands out SnapcastGroupDevices.
More...


Classes | |
| interface | ChangeListener |
| Told when the groups (or the offline state of one) may have changed; any thread, no lock held. More... | |
| class | GroupState |
| What one group looks like right now, for the rows and the group sheet: the group and the status of its server as of the last status that was read, whether the control connection is up, and the endpoint of the server. | |
| interface | LinkFactory |
Opens the link to a server (not started yet); SnapcastSession in the app. More... | |
| interface | OwnIdsSource |
| The phone's own client ids (task 12.19): the current id and the legacy per-server ids of this install, for the servers that are known now. More... | |
Public Member Functions | |
| SnapcastReceivers (SnapcastDirectory directory, LinkFactory factory, RetryScheduler scheduler, Supplier< SnapcastGroupDevice.Labels > labels, long closeGraceMillis) | |
| SnapcastReceivers (SnapcastDirectory directory, LinkFactory factory, RetryScheduler scheduler, Supplier< SnapcastGroupDevice.Labels > labels, long closeGraceMillis, MonotonicClock clock) | |
| void | setOwnIdsSource (OwnIdsSource source) |
| Where the phone's own client ids come from; without one nothing of the phone is merged (null clears it). | |
| SnapcastOwnIds | ownIds () |
| The phone's own client ids for the servers that are listed now: the current id and this install's legacy ids. | |
| void | addChangeListener (ChangeListener listener) |
| void | removeChangeListener (ChangeListener listener) |
| void | pageStarted () |
| A page that shows receivers became visible: connect to the listed servers (and retry the ones that are down). | |
| void | pageStopped () |
| A page was hidden; with the last one gone the links close after the grace. | |
| void | retain (ServerKey key) |
Keeps the link to a listed server open without a page (a player that feeds it); see release. | |
| void | release (ServerKey key) |
| void | wake (Collection< String > receiverIds) |
Selected receivers are missing: connect to the listed servers that hold the Snapcast ones among receiverIds (and to no other), so that their groups are known soon. | |
| void | wakeServer (ServerKey key) |
Connects to one listed server without a page and without a player (the renderer's group chooser reads its groups with it, see groupsOf); the link closes by itself after the grace period. | |
| List< SnapcastGroupDevice > | groupsOf (ServerKey key) |
| The groups of one server as of its last status, sorted by name. | |
| void | shutdown () |
| Closes every link and forgets everything. | |
| SnapcastServerLink | getLink (ServerKey key) |
| The link of a server while it is open; null otherwise. | |
| List< SnapcastGroupDevice > | groups () |
| The groups of the servers that are listed, as of the last status of each server. | |
| List< String > | describe (ServerKey key) |
| What this server said and why each of its groups is listed or not, for the discovery report: one line for the link and the last status, one line for each group with its clients. | |
| SnapcastGroupDevice | findGroup (String receiverId) |
| GroupState | stateOf (String receiverId) |
| The state of a group by its receiver id. | |
| boolean | isPending (String receiverId) |
| True for the id of a group whose server is listed but has not delivered its status yet (a cold start, or a connection that is still coming up): the group is not known, but it is not gone either. | |
| void | selectionChanged (Collection< String > receiverIds) |
The selection is kept by SnapcastSelectedServers (the hub); the receivers have nothing to remember. | |
Public Member Functions inherited from de.yaacc.snapcast.SnapcastGroupSource | |
Static Public Member Functions | |
| static SnapcastRendererOutput.GroupFacts | factsOf (GroupState state) |
What a state says about the group, for the renderer's output (SnapcastRendererOutput): null (no such server in the list, or a malformed id) is NOT_LISTED. | |
Additional Inherited Members | |
Public Attributes inherited from de.yaacc.snapcast.SnapcastGroupSource | |
| SnapcastGroupSource | NONE |
| No groups; the default of a client that has no hub. | |
The Snapcast groups as receivers: joins the SnapcastDirectory (which servers exist) with one SnapcastServerLink per server (what each server says) and hands out SnapcastGroupDevices.
Pure Java; the link factory, the scheduler and the labels (asked for each time they are needed, so a change of the language shows) are injected.
pageStarted), the server is retained (a player uses it), or a selected receiver of it is woken. Nothing connects to a server that is not listed, and the directory holds only addresses that passed the range filter or that the user typed in. closeGraceMillis (so that switching between the tab and the sheet does not reconnect), except retained ones. A server that leaves the directory (removed in the settings, discovery switched off, its grace over) has its link closed even when it is retained: the close tells the link's listeners, so a feed that runs to it ends (SnapcastSession#close). Thread safe; no lock is held while a link or a listener is called. The list of servers is read under the lock (a quiet snapshot; the sweep of the expired ones happens before, outside the lock), so a server that left is never reconciled from an out-of-date list.
Identity. groups() and findGroup return the same SnapcastGroupDevice instance for a group for as long as its name, offline flag, stream and number of members stay the same (the lists compare devices by identity); a changed group gets a new instance, a vanished one is forgotten. A stored selection of a group whose server is listed but has not answered yet is pending.
| List< String > de.yaacc.snapcast.SnapcastReceivers.describe | ( | ServerKey | key | ) |
What this server said and why each of its groups is listed or not, for the discovery report: one line for the link and the last status, one line for each group with its clients.
Nothing is read from the network.

| SnapcastGroupDevice de.yaacc.snapcast.SnapcastReceivers.findGroup | ( | String | receiverId | ) |
snapcast:...), or null if it is not known (any more) Implements de.yaacc.snapcast.SnapcastGroupSource.
Referenced by de.yaacc.snapcast.SnapcastHub.findGroup().


| SnapcastServerLink de.yaacc.snapcast.SnapcastReceivers.getLink | ( | ServerKey | key | ) |
The link of a server while it is open; null otherwise.
For the code that controls the server (the player).
| List< SnapcastGroupDevice > de.yaacc.snapcast.SnapcastReceivers.groups | ( | ) |
The groups of the servers that are listed, as of the last status of each server.
Cheap: no network.
Implements de.yaacc.snapcast.SnapcastGroupSource.
Referenced by de.yaacc.snapcast.SnapcastHub.groups(), and de.yaacc.snapcast.SnapcastReceivers.groupsOf().


| List< SnapcastGroupDevice > de.yaacc.snapcast.SnapcastReceivers.groupsOf | ( | ServerKey | key | ) |
The groups of one server as of its last status, sorted by name.

| boolean de.yaacc.snapcast.SnapcastReceivers.isPending | ( | String | receiverId | ) |
True for the id of a group whose server is listed but has not delivered its status yet (a cold start, or a connection that is still coming up): the group is not known, but it is not gone either.
The caller keeps such an id in a stored selection instead of dropping it. False for a group that is known, for a server that is not listed (any more), for a server that answered without the group, and for anything that is not a group id.
Implements de.yaacc.snapcast.SnapcastGroupSource.
Referenced by de.yaacc.snapcast.SnapcastHub.isPending().


| SnapcastOwnIds de.yaacc.snapcast.SnapcastReceivers.ownIds | ( | ) |
The phone's own client ids for the servers that are listed now: the current id and this install's legacy ids.
For the code that labels the phone's row and decides the cleanup of old entries; none when the install has no secret.
| void de.yaacc.snapcast.SnapcastReceivers.selectionChanged | ( | Collection< String > | receiverIds | ) |
The selection is kept by SnapcastSelectedServers (the hub); the receivers have nothing to remember.
Implements de.yaacc.snapcast.SnapcastGroupSource.
| GroupState de.yaacc.snapcast.SnapcastReceivers.stateOf | ( | String | receiverId | ) |
The state of a group by its receiver id.

| void de.yaacc.snapcast.SnapcastReceivers.wake | ( | Collection< String > | receiverIds | ) |
Selected receivers are missing: connect to the listed servers that hold the Snapcast ones among receiverIds (and to no other), so that their groups are known soon.
Does not block.
Implements de.yaacc.snapcast.SnapcastGroupSource.
Referenced by de.yaacc.snapcast.SnapcastHub.wake().


| void de.yaacc.snapcast.SnapcastReceivers.wakeServer | ( | ServerKey | key | ) |
Connects to one listed server without a page and without a player (the renderer's group chooser reads its groups with it, see groupsOf); the link closes by itself after the grace period.
Nothing for a server that is not listed.