YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.sendspin.client.ControllerSession Class Reference

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...

Inheritance diagram for de.yaacc.sendspin.client.ControllerSession:
Inheritance graph
Collaboration diagram for de.yaacc.sendspin.client.ControllerSession:
Collaboration graph

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

Detailed Description

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.

Constructor & Destructor Documentation

◆ ControllerSession()

de.yaacc.sendspin.client.ControllerSession.ControllerSession ( Endpoint endpoint,
Identity identity,
boolean unpairedAccess,
Connector connector,
HubClock clock,
SecureRandom random,
String clientName,
Listener listener,
ClientCredentials credentials )
Parameters
credentialsthe pairing records of this client; null: no pairing (the Sentinel only, a pairing activation is declined)
Here is the call graph for this function:

Member Function Documentation

◆ artwork()

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.

◆ artworkVersion()

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.

◆ close()

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().

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

◆ controller()

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()

EndReason de.yaacc.sendspin.client.ControllerSession.endReason ( )

◆ group()

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.

◆ isSourceActive()

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.

◆ metadata()

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.

◆ next()

boolean de.yaacc.sendspin.client.ControllerSession.next ( )

◆ pause()

boolean de.yaacc.sendspin.client.ControllerSession.pause ( )

◆ phase()

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.

◆ play()

boolean de.yaacc.sendspin.client.ControllerSession.play ( )

◆ positionMs()

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.

Here is the call graph for this function:

◆ previous()

boolean de.yaacc.sendspin.client.ControllerSession.previous ( )

◆ seek()

boolean de.yaacc.sendspin.client.ControllerSession.seek ( long positionMs)
Parameters
positionMsclamped to the seek range the server reports

Implements de.yaacc.sendspin.client.ServerControl.

◆ seekRelative()

boolean de.yaacc.sendspin.client.ControllerSession.seekRelative ( long offsetMs)

◆ serverId()

String de.yaacc.sendspin.client.ControllerSession.serverId ( )

◆ serverName()

String de.yaacc.sendspin.client.ControllerSession.serverName ( )

◆ serverOffersSource()

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.

◆ setCodePairing()

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().

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

◆ setMuted()

boolean de.yaacc.sendspin.client.ControllerSession.setMuted ( boolean muted)

◆ setRepeat()

boolean de.yaacc.sendspin.client.ControllerSession.setRepeat ( String repeat)
Parameters
repeat"off", "one" or "all"

Implements de.yaacc.sendspin.client.ServerControl.

Here is the call graph for this function:

◆ setShuffle()

boolean de.yaacc.sendspin.client.ControllerSession.setShuffle ( boolean shuffle)

◆ setSource()

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.

◆ setVolume()

boolean de.yaacc.sendspin.client.ControllerSession.setVolume ( int volume)

◆ sourceUplink()

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.

◆ stop()

boolean de.yaacc.sendspin.client.ControllerSession.stop ( )

◆ switchGroup()

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.

Here is the call graph for this function:

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