|
YAACC - UPNP Client and Server
|
The Sendspin players of the app (issue #325): the players the user added by address, the ones the network announced (mDNS _sendspin._tcp, while a receivers page is open and the search is on) and the ones that were selected in the last run (kept until they are seen again), one HubConnection for each while the switch is on, the operator's approvals and the identity of this server.
More...


Classes | |
| enum | LinkOutcome |
| What linking two players did. More... | |
| class | OutputTarget |
| A Sendspin player or group leader that the renderer can be set to play into. | |
Public Member Functions | |
| void | registerStreamReport (String leaderId, java.util.function.Supplier< String > report) |
| The stream of this player's group is running: its report is read live. | |
| void | finishStreamReport (String leaderId, java.util.function.Supplier< String > live) |
| The stream is over: the last report stays until the next stream. | |
| String | streamReport (String leaderId) |
| The report of the stream to this player's group: the running one, else the last one, else null. | |
| HubColorFeed | colors () |
The colours of the music of the groups (see HubColorFeed). | |
| boolean | isEnabled () |
| boolean | isControllerEnabled () |
| SendspinControllers | controllers () |
| The servers the phone controls (the controller role); the settings dialog edits their addresses. | |
| SendspinPlayers | players () |
| The players the user added; the settings dialog edits them. | |
| SendspinPolicy | approvals () |
| void | pageStarted () |
| A receivers page became visible: the search starts if Sendspin and the search are switched on. | |
| void | pageStopped () |
| A receivers page was hidden: the search stops when no page needs it. | |
| void | addChangeListener (SendspinDirectory.Listener listener) |
| Told when the players the app lists changed (one was announced or went, a name arrived). | |
| void | removeChangeListener (SendspinDirectory.Listener listener) |
| void | notifyListChanged () |
| The lists changed from outside (a server was removed in the settings): the pages redraw. | |
| synchronized Endpoint | endpointOfId (String receiverId) |
| The endpoint a receiver id stands for, as the connections have it: a found player brings its own path, the id has the default one, and the lookups of the groups have to meet the connection that is there (not open a second one under another path). | |
| synchronized Endpoint | selfEndpoint () |
| Where this phone's own player listens, as the hub dials it (over the loopback address, so that the phone can be a member of a group that plays on it too); null while the player does not run. | |
| synchronized HubConnection | connectionById (String receiverId, boolean create) |
The connection of a receiver id; made (as a list refresh does, with its pause and the end reasons) if create, else only found. | |
| synchronized HubConnection | connection (Endpoint endpoint) |
| The current connection to a player, or null if there is none (yet). | |
| synchronized HubConnection | acquire (Endpoint endpoint, boolean force) |
| The connection to a player, made if there is none that is alive. | |
| String | nameOfPlayer (String clientId) |
| The last name the player with this id announced, or null (for the lists of paired and approved players). | |
| synchronized int | sampleRateOf (Endpoint endpoint) |
| The sample rate of the stream to a player: from its connection if the hello is known, else the one remembered from an earlier connection, else 0. | |
| synchronized void | disconnect (Endpoint endpoint) |
| Ends the connection to a player and forgets it (the player stays in the list unless it is removed). | |
| String | discoveryReport () |
| The report of the discovery for the user to copy: what was browsed, what the system said, the players and servers known. | |
| SendspinPolicy.PairOutcome | addDeviceToken (String tokenText) |
| Enters the pairing token of a device that has not connected yet (K15: one pairing for every role of a device). | |
| synchronized String | connectedClientId (Endpoint endpoint) |
| The id the player at this endpoint presented, null while there is no connection (for the message of the pairing dialog). | |
| synchronized SendspinPolicy.PairOutcome | pair (Endpoint endpoint, String tokenText) |
| The operator pasted a pairing token for the player at this endpoint (the dialog of its row). | |
| SendspinGroups | groups () |
| The groups of the players (not persisted). | |
| synchronized LinkOutcome | link (String leaderId, String memberId) |
| Links a player into the group of a leader (the owner's decision: every player that is found can be linked, and linking is the operator action that approves an unpaired player, as playing to it does). | |
| synchronized void | unlink (String memberId) |
| synchronized void | dissolve (String leaderId) |
| synchronized int | groupRateOf (String leaderId) |
| The sample rate of the group of a leader (or of a lone player): the common rate of its members, 0 if there is none or it is not known yet. | |
| synchronized Integer | groupVolumeOf (String leaderId) |
| The average volume of the group of a leader, or null if none of its players reports one. | |
| synchronized void | setGroupVolume (String leaderId, int percent) |
Sets the volume of the group as the protocol's controller role does (see GroupVolume): every player is moved by the same number of points the average moves, what a player at a boundary could not take is shared out, limited to 0 to 100. | |
| synchronized void | setGroupMuted (String leaderId, boolean muted) |
| Mutes or unmutes every player of the group of a leader. | |
| synchronized boolean | groupMutedOf (String leaderId) |
| True if every player of the group of a leader that reports it is muted. | |
| String | clientPairingToken () |
| The pairing token of this app for the user to give to a server (Music Assistant or another): made at the first call and the same until a pairing used it up or the user withdraws it. | |
| synchronized de.yaacc.sendspin.player.ClientCodePairing | clientCodePairing () |
| The key pair of this app as a Sendspin client (the controller and the player use the same). | |
| void | openPairingWindow () |
| The operator's gesture on this phone: opens the pairing window (5 minutes) for every connection, as a client and as a player. | |
| Identity | clientKeys () |
| SendspinClientPairings | clientPairings () |
| The pairing records of this app as a client. | |
| boolean | holdsClientToken () |
| void | withdrawClientToken () |
| boolean | isPairedWithServer (String serverId) |
| synchronized void | unpairServer (String serverId) |
| Forgets the pairing with a server and ends the session with it (the server's list entry is untouched). | |
| List< String > | pairedIds () |
| The ids of the paired players, sorted. | |
| List< String > | approvedIds () |
| The ids of the players the operator approved while they are not paired, sorted. | |
| synchronized void | unpair (String clientId) |
| Forgets the pairing (and a pending token) of a player and ends the connections to it; they are made again by the list. | |
| synchronized void | revokeApproval (String clientId) |
| Withdraws the approval of a player and ends the connections to it. | |
| synchronized void | remove (Endpoint endpoint) |
| Removes an added player from the list and ends its connection (a player that is announced stays while it is announced). | |
| synchronized List< SendspinReceiverDevice > | receivers () |
| The players as of now (none while the switch is off), sorted by name. | |
| synchronized Endpoint | remoteControlOf (Endpoint player) |
| The server of the same YAACC phone as this player, if both announced it and this phone controls servers: the card of the player then has a remote control for what that phone plays (K14). | |
| synchronized Endpoint | controlServerOfOwnPlayer () |
| The server that streams to the player of this phone (another YAACC phone that plays to this one): the buttons of this phone's card control it. | |
| de.yaacc.sendspin.client.ServerControl | serverControl (Endpoint server) |
| What the card of a Sendspin server shows and controls: the controller session of this phone, or, when that session stayed away because the server is connected to this phone's player (a server that keeps one connection per client), the controller role of the player's connection. | |
| boolean | offersSource (Endpoint server) |
| True if the server at this address takes audio from this phone as a source: over the controller session, or, for a server that keeps one connection per client (Music Assistant), over the connection of this phone's player. | |
| synchronized List< HubConnection > | sourceConnections () |
| The connections of clients that feed audio into this phone's server (the source role). | |
| synchronized List< OutputTarget > | outputTargets () |
| The players and group leaders the renderer's output can be set to (members of a group are played to through their leader and are not listed): the players the app lists and this phone's own player while it is on. | |
| synchronized SendspinReceiverDevice | findReceiver (String receiverId) |
| void | selectionChanged (Collection< String > receiverIds) |
| The selection changed: the selected Sendspin players are remembered (and the others forgotten), so that a selected player that was only found by the search is still listed after a restart, until it is seen again. | |
Public Member Functions inherited from de.yaacc.sendspin.SendspinReceiverSource | |
Static Public Member Functions | |
| static synchronized SendspinHub | getShared (Context context) |
Additional Inherited Members | |
Public Attributes inherited from de.yaacc.sendspin.SendspinReceiverSource | |
| SendspinReceiverSource | NONE |
| No players; the default of a client that has no hub. | |
The Sendspin players of the app (issue #325): the players the user added by address, the ones the network announced (mDNS _sendspin._tcp, while a receivers page is open and the search is on) and the ones that were selected in the last run (kept until they are seen again), one HubConnection for each while the switch is on, the operator's approvals and the identity of this server.
The app part of the hub is this class; everything it decides is in the pure classes of this package and of de.yaacc.sendspin.hub and .discovery.
A connection is made when the receivers are listed (it gives the row its state and the player its stream format, which the audio tap needs before ExoPlayer is built) and again when the user plays to a player. It does not give up the player's other servers: with no activities a connection ranks lowest and is displaced by any server that plays. After the guidance of client/goodbye a connection that ended because the player went to another server or demands pairing is not made again by a list refresh, only by the user; the others are retried after a pause. At most {@value SendspinSettings.MAX_LISTED} players are listed and connected to.
Not yet: the Keystore wrapping of the identity key (it lives in the app-private preferences; backup is off), pairing, groups, the client-initiated connection mode.
| synchronized HubConnection de.yaacc.sendspin.SendspinHub.acquire | ( | Endpoint | endpoint, |
| boolean | force ) |
The connection to a player, made if there is none that is alive.
| force | true for an action of the user: a connection that ended is made again whatever the reason |

| void de.yaacc.sendspin.SendspinHub.addChangeListener | ( | SendspinDirectory.Listener | listener | ) |
Told when the players the app lists changed (one was announced or went, a name arrived).
May be called on any thread.
| synchronized de.yaacc.sendspin.player.ClientCodePairing de.yaacc.sendspin.SendspinHub.clientCodePairing | ( | ) |
The key pair of this app as a Sendspin client (the controller and the player use the same).
The code-based pairing this phone offers as a client, to the servers it connects to and to the servers that connect to its player (task 11.1): one pairing window and one fixed code for both. The fixed code is drawn once per installation and kept.
| synchronized Endpoint de.yaacc.sendspin.SendspinHub.controlServerOfOwnPlayer | ( | ) |
The server that streams to the player of this phone (another YAACC phone that plays to this one): the buttons of this phone's card control it.
Found by the server id of the connection, which a YAACC server uses as the instance name of its announcement; null if nothing plays from a server of the network, the controller is off or that server is not announced.

| synchronized SendspinReceiverDevice de.yaacc.sendspin.SendspinHub.findReceiver | ( | String | receiverId | ) |
sendspin:...), or null if it is not known (any more) or the switch is off Implements de.yaacc.sendspin.SendspinReceiverSource.

| synchronized LinkOutcome de.yaacc.sendspin.SendspinHub.link | ( | String | leaderId, |
| String | memberId ) |
Links a player into the group of a leader (the owner's decision: every player that is found can be linked, and linking is the operator action that approves an unpaired player, as playing to it does).
Refused if the group would have no common PCM rate or if a player demands a pairing that is not done.

| synchronized List< OutputTarget > de.yaacc.sendspin.SendspinHub.outputTargets | ( | ) |
The players and group leaders the renderer's output can be set to (members of a group are played to through their leader and are not listed): the players the app lists and this phone's own player while it is on.
Nothing is connected for the list; empty while Sendspin is off.

| synchronized SendspinPolicy.PairOutcome de.yaacc.sendspin.SendspinHub.pair | ( | Endpoint | endpoint, |
| String | tokenText ) |
The operator pasted a pairing token for the player at this endpoint (the dialog of its row).
On STARTED the connection is made again so that the pairing runs now.

| synchronized List< SendspinReceiverDevice > de.yaacc.sendspin.SendspinHub.receivers | ( | ) |
The players as of now (none while the switch is off), sorted by name.
Cheap: no network wait.
Implements de.yaacc.sendspin.SendspinReceiverSource.

The server of the same YAACC phone as this player, if both announced it and this phone controls servers: the card of the player then has a remote control for what that phone plays (K14).
Null otherwise.

| synchronized int de.yaacc.sendspin.SendspinHub.sampleRateOf | ( | Endpoint | endpoint | ) |
The sample rate of the stream to a player: from its connection if the hello is known, else the one remembered from an earlier connection, else 0.
The audio tap needs it before the player of the app is built.

| void de.yaacc.sendspin.SendspinHub.selectionChanged | ( | Collection< String > | receiverIds | ) |
The selection changed: the selected Sendspin players are remembered (and the others forgotten), so that a selected player that was only found by the search is still listed after a restart, until it is seen again.
Implements de.yaacc.sendspin.SendspinReceiverSource.

| synchronized Endpoint de.yaacc.sendspin.SendspinHub.selfEndpoint | ( | ) |
Where this phone's own player listens, as the hub dials it (over the loopback address, so that the phone can be a member of a group that plays on it too); null while the player does not run.
Never listed as a card of its own: the card of this phone is it.

| de.yaacc.sendspin.client.ServerControl de.yaacc.sendspin.SendspinHub.serverControl | ( | Endpoint | server | ) |
What the card of a Sendspin server shows and controls: the controller session of this phone, or, when that session stayed away because the server is connected to this phone's player (a server that keeps one connection per client), the controller role of the player's connection.
Null if there is neither.

| synchronized void de.yaacc.sendspin.SendspinHub.setGroupVolume | ( | String | leaderId, |
| int | percent ) |
Sets the volume of the group as the protocol's controller role does (see GroupVolume): every player is moved by the same number of points the average moves, what a player at a boundary could not take is shared out, limited to 0 to 100.
A lone player gets the value itself.
