|
YAACC - UPNP Client and Server
|
The phone as a Sendspin client with the roles controller@v1 and metadata@v1 (issue #325, use cases C1 to C3): one connection to one server (the phone opens it, client-initiated mode) that shows what the server plays in the group this client is in and sends commands for it.
More...


Classes | |
| enum | EndReason |
| interface | Listener |
| enum | Phase |
Public Member Functions | |
| ControllerSession (Endpoint endpoint, Identity identity, boolean unpairedAccess, Connector connector, HubClock clock, SecureRandom random, String clientName, Listener listener) | |
| ControllerSession (Endpoint endpoint, Identity identity, boolean unpairedAccess, Connector connector, HubClock clock, SecureRandom random, String clientName, Listener listener, ClientCredentials credentials) | |
| void | setSource (SourceUplink source) |
Lets this client feed audio into the server (call before start()): the hello lists the source role when the server takes it. | |
| void | setYieldCheck (java.util.function.Predicate< String > check) |
Lets the session stay away from a server (call before start()): the check gets the id of the server as soon as the handshake shows it, and a session for which it says true ends with EndReason#YIELDED without a hello. | |
| SourceUplink | enableSource (int sampleRate) |
As setSource(SourceUplink) with an uplink of this session (16 bit stereo at this rate, the clock of the server). | |
| SourceUplink | sourceUplink () |
| The uplink of the source role, or null if this session was not given one. | |
| boolean | serverOffersSource () |
| True if the server said in its hello that it takes audio from a source (known after the hello). | |
| boolean | isSourceActive () |
| True while the source role is active on this connection: the server can ask for audio. | |
| Endpoint | endpoint () |
| Phase | phase () |
ControllerSession.Phase#ACTIVE while the controller role is active, the other values as far as they apply. | |
| EndReason | endReason () |
| String | serverName () |
| String | serverId () |
| ControllerMessages.Group | group () |
The group this client is in, or null before the first group/update. | |
| ControllerMessages.ControllerState | controller () |
| What the group can do and its volume, or null before the first state of the controller role. | |
| void | setCodePairing (de.yaacc.sendspin.pairing.CodePairingClient.Offer offer, de.yaacc.sendspin.pairing.PairingWindow window, de.yaacc.sendspin.pairing.CodePairingClient.Emitter emitter) |
Offers the code-based pairing methods (call before start()): the hello lists them, and a server that activates one pairs with the code. | |
| void | onWindowOpened () |
| The operator's gesture opened the pairing window: an attempt that waited for it starts now. | |
| ControllerMessages.Metadata | metadata () |
| The metadata to show now (a scheduled update whose time has come is applied), or null. | |
| ControllerMessages.Metadata | pendingMetadata () |
| The scheduled update that follows (a coming-up display), or null. | |
| long | positionMs () |
| The position in the current track in milliseconds, or -1 if the server reports none. | |
| byte[] | artwork () |
| The album image the server shows this client now (JPEG or PNG bytes), or null if there is none. | |
| long | artworkVersion () |
| Increases whenever the image changes, so that a display decodes it again only then. | |
| boolean | hasClockEstimate () |
| void | start () |
| void | close () |
| Ends the session: tells the server the user asked for it and closes. | |
| boolean | play () |
| boolean | pause () |
| boolean | stop () |
| boolean | next () |
| boolean | previous () |
| boolean | setVolume (int volume) |
| boolean | setMuted (boolean muted) |
| boolean | setRepeat (String repeat) |
| boolean | setShuffle (boolean shuffle) |
| boolean | switchGroup () |
| Moves this client to the next group of the server's cycle. | |
| boolean | seek (long positionMs) |
| boolean | seekRelative (long offsetMs) |
Public Member Functions inherited from de.yaacc.sendspin.client.ServerControl | |
The phone as a Sendspin client with the roles controller@v1 and metadata@v1 (issue #325, use cases C1 to C3): one connection to one server (the phone opens it, client-initiated mode) that shows what the server plays in the group this client is in and sends commands for it.
It plays no audio. One thread runs the connection (start()); the app reads the state and sends commands from its own threads. The session does not reconnect: it ends and says why (endReason()).
This first slice has no pairing as a client: it uses the Sentinel PSK (an unpaired session, which the server's operator has to allow, and which the protocol warns is not authenticated), answers a pairing activation with method_not_supported and ends on a re-handshake request.
| de.yaacc.sendspin.client.ControllerSession.ControllerSession | ( | Endpoint | endpoint, |
| Identity | identity, | ||
| boolean | unpairedAccess, | ||
| Connector | connector, | ||
| HubClock | clock, | ||
| SecureRandom | random, | ||
| String | clientName, | ||
| Listener | listener, | ||
| ClientCredentials | credentials ) |
| credentials | the pairing records of this client; null: no pairing (the Sentinel only, a pairing activation is declined) |

| byte[] de.yaacc.sendspin.client.ControllerSession.artwork | ( | ) |
The album image the server shows this client now (JPEG or PNG bytes), or null if there is none.
Implements de.yaacc.sendspin.client.ServerControl.
| long de.yaacc.sendspin.client.ControllerSession.artworkVersion | ( | ) |
Increases whenever the image changes, so that a display decodes it again only then.
Implements de.yaacc.sendspin.client.ServerControl.
| void de.yaacc.sendspin.client.ControllerSession.close | ( | ) |
Ends the session: tells the server the user asked for it and closes.
Safe to call more than once.
Referenced by de.yaacc.sendspin.SendspinControllers.disconnect(), de.yaacc.sendspin.SendspinControllers.endSessionsOf(), and de.yaacc.sendspin.SendspinControllers.remove().


| ControllerMessages.ControllerState de.yaacc.sendspin.client.ControllerSession.controller | ( | ) |
What the group can do and its volume, or null before the first state of the controller role.
Implements de.yaacc.sendspin.client.ServerControl.
| EndReason de.yaacc.sendspin.client.ControllerSession.endReason | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| ControllerMessages.Group de.yaacc.sendspin.client.ControllerSession.group | ( | ) |
The group this client is in, or null before the first group/update.
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.isSourceActive | ( | ) |
True while the source role is active on this connection: the server can ask for audio.
Implements de.yaacc.sendspin.client.ServerControl.
| ControllerMessages.Metadata de.yaacc.sendspin.client.ControllerSession.metadata | ( | ) |
The metadata to show now (a scheduled update whose time has come is applied), or null.
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.next | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.pause | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| Phase de.yaacc.sendspin.client.ControllerSession.phase | ( | ) |
ControllerSession.Phase#ACTIVE while the controller role is active, the other values as far as they apply.
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.play | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| long de.yaacc.sendspin.client.ControllerSession.positionMs | ( | ) |
The position in the current track in milliseconds, or -1 if the server reports none.
Implements de.yaacc.sendspin.client.ServerControl.

| boolean de.yaacc.sendspin.client.ControllerSession.previous | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.seek | ( | long | positionMs | ) |
| positionMs | clamped to the seek range the server reports |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.seekRelative | ( | long | offsetMs | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| String de.yaacc.sendspin.client.ControllerSession.serverId | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| String de.yaacc.sendspin.client.ControllerSession.serverName | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.serverOffersSource | ( | ) |
True if the server said in its hello that it takes audio from a source (known after the hello).
Implements de.yaacc.sendspin.client.ServerControl.
| void de.yaacc.sendspin.client.ControllerSession.setCodePairing | ( | de.yaacc.sendspin.pairing.CodePairingClient.Offer | offer, |
| de.yaacc.sendspin.pairing.PairingWindow | window, | ||
| de.yaacc.sendspin.pairing.CodePairingClient.Emitter | emitter ) |
Offers the code-based pairing methods (call before start()): the hello lists them, and a server that activates one pairs with the code.
The window is the gesture gate; the emitter shows the code of a dynamic attempt.
Referenced by de.yaacc.sendspin.SendspinControllers.acquire().


| boolean de.yaacc.sendspin.client.ControllerSession.setMuted | ( | boolean | muted | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.setRepeat | ( | String | repeat | ) |
| repeat | "off", "one" or "all" |
Implements de.yaacc.sendspin.client.ServerControl.

| boolean de.yaacc.sendspin.client.ControllerSession.setShuffle | ( | boolean | shuffle | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| void de.yaacc.sendspin.client.ControllerSession.setSource | ( | SourceUplink | source | ) |
Lets this client feed audio into the server (call before start()): the hello lists the source role when the server takes it.
The phone's player writes to the uplink; the server asks for the audio when the uplink has a signal.
| boolean de.yaacc.sendspin.client.ControllerSession.setVolume | ( | int | volume | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| SourceUplink de.yaacc.sendspin.client.ControllerSession.sourceUplink | ( | ) |
The uplink of the source role, or null if this session was not given one.
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.stop | ( | ) |
Implements de.yaacc.sendspin.client.ServerControl.
| boolean de.yaacc.sendspin.client.ControllerSession.switchGroup | ( | ) |
Moves this client to the next group of the server's cycle.
Implements de.yaacc.sendspin.client.ServerControl.
