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

The messages of the client side of the protocol for a client with the roles controller@v1 and metadata@v1: what it sends (client/init, client/hello, client/state, client/time, client/command, client/goodbye, pair/abort) and what it reads of the server (server/hello, server/activate, group/update, server/state with the controller and metadata objects, server/time). More...

Collaboration diagram for de.yaacc.sendspin.session.ControllerMessages:
Collaboration graph

Classes

class  Activate
 server/activate.
 
enum  Admission
 What the client does with an activation (spec, server/activate: the first rule that applies). More...
 
class  ArtworkChannel
 The configuration of one artwork channel (spec, "Server to client: stream/start artwork object").
 
class  Color
 The color object of server/state (role color@v1): colours derived from the audio, each [R, G, B] with values 0 to 255 or null if the server sent none.
 
class  ControllerState
 The controller object of server/state: what the group can do and its volume, mute, repeat and shuffle.
 
class  Group
 group/update.
 
class  Metadata
 The metadata object of server/state.
 
class  Progress
 Playback progress of the metadata object.
 
class  ServerState
 server/state: each object is null if the message has none (an omitted object leaves its state unchanged).
 

Static Public Member Functions

static String clientInit (String clientId, String suiteName)
 
static String clientHello (String name, String productName, String softwareVersion, boolean unpairedAccess)
 
static String clientHello (String name, String productName, String softwareVersion, boolean unpairedAccess, de.yaacc.sendspin.pairing.CodePairingClient.Offer codes)
 As above; codes adds the code-based pairing methods the client offers (null: the Pairing PSK only).
 
static String clientHello (String name, String productName, String softwareVersion, boolean unpairedAccess, de.yaacc.sendspin.pairing.CodePairingClient.Offer codes, boolean source)
 As above; source adds the source role (the client can feed audio into the server).
 
static String clientState (boolean available)
 
static String clientStateWithArtwork (boolean available, String format, int width, int height)
 client/state with the artwork object: one album channel in the given format and size (the server scales the image to fit and pads it with black).
 
static String clientState (boolean available, String artworkFormat, int width, int height, String signal)
 client/state with the objects of the roles that are active: the artwork object (artworkFormat not null) and the source object (signal not null: present or absent).
 
static String clientTime (long clientTransmittedMicros)
 
static String commandPlain (String command)
 A command without a parameter: play, pause, stop, next, previous, repeat_*, shuffle, unshuffle, switch.
 
static String commandVolume (int volume)
 
static String commandMute (boolean mute)
 
static String commandSeek (long positionMs)
 
static String commandSeekRelative (long offsetMs)
 
static String clientGoodbye (String reason)
 
static String clientPairInit (int pairingIndex)
 client/pair-init: the number of pairing activations this client has seen since the last handshake (1 for the first).
 
static String clientPairFinalize (String longTermPsk)
 client/pair-finalize: the long-term PSK this client made, 43 characters of base64url.
 
static String pairAbort (String reason)
 
static String parseServerHello (JSONObject p) throws ProtocolException
 server/hello: the name of the server.
 
static Activate parseActivate (JSONObject p) throws ProtocolException
 
static Admission admit (SendspinPsk.Category psk, boolean unpairedAccess, Set< String > activities, List< String > roles, boolean methodOffered)
 
static Group parseGroupUpdate (JSONObject p) throws ProtocolException
 
static ServerState parseServerState (JSONObject p) throws ProtocolException
 
static List< ArtworkChannel > parseStreamStartArtwork (JSONObject p) throws ProtocolException
 The artwork object of stream/start.
 
static List< String > parseStreamEndRoles (JSONObject p) throws ProtocolException
 stream/end: the roles it ends, or null if it names none (all streams end).
 
static long[] parseServerTime (JSONObject p) throws ProtocolException
 server/time: client_transmitted, server_received, server_transmitted.
 

Static Public Attributes

static final List< String > ROLES = Collections.unmodifiableList(Arrays.asList("controller@v1", "metadata@v1", "artwork@v1"))
 The roles this client asks for.
 
static final List< String > COMMANDS
 The controller commands of the protocol; a command that is not in this list is not offered to the user.
 
static final int MAX_ARTWORK_SIDE = 4096
 The largest width or height of an artwork channel this client accepts.
 

Detailed Description

The messages of the client side of the protocol for a client with the roles controller@v1 and metadata@v1: what it sends (client/init, client/hello, client/state, client/time, client/command, client/goodbye, pair/abort) and what it reads of the server (server/hello, server/activate, group/update, server/state with the controller and metadata objects, server/time).

The server is untrusted: every number is range checked, every text has its byte limit, a violation is a ProtocolException. Pure.

Member Function Documentation

◆ admit()

static Admission de.yaacc.sendspin.session.ControllerMessages.admit ( SendspinPsk.Category psk,
boolean unpairedAccess,
Set< String > activities,
List< String > roles,
boolean methodOffered )
static
Parameters
pskthe category of the PSK of the session
unpairedAccesswhether this client admits unpaired access now
activitiesthe declared activities
rolesthe roles that are active after this message (the persisted ones if the message has none)
methodOfferedwhether the pairing method of the activation, if there is one, is one this client offers and that fits the PSK

◆ clientHello()

static String de.yaacc.sendspin.session.ControllerMessages.clientHello ( String name,
String productName,
String softwareVersion,
boolean unpairedAccess )
static
Parameters
productNamenull to leave it out; at most 64 bytes
softwareVersionnull to leave it out
unpairedAccesswhether this client admits a server it is not paired with (spec: unpaired access)

Referenced by de.yaacc.sendspin.session.ControllerMessages.clientHello(), and de.yaacc.sendspin.session.ControllerMessages.clientHello().

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

◆ clientStateWithArtwork()

static String de.yaacc.sendspin.session.ControllerMessages.clientStateWithArtwork ( boolean available,
String format,
int width,
int height )
static

client/state with the artwork object: one album channel in the given format and size (the server scales the image to fit and pads it with black).

Sent when the artwork role becomes active.

◆ parseStreamStartArtwork()

static List< ArtworkChannel > de.yaacc.sendspin.session.ControllerMessages.parseStreamStartArtwork ( JSONObject p) throws ProtocolException
static

The artwork object of stream/start.

Returns
the channels, or null if the message has no artwork object (the stream of another role)

Member Data Documentation

◆ COMMANDS

final List<String> de.yaacc.sendspin.session.ControllerMessages.COMMANDS
static
Initial value:
= Collections.unmodifiableList(Arrays.asList("play", "pause", "stop", "next", "previous",
"volume", "mute", "repeat_off", "repeat_one", "repeat_all", "shuffle", "unshuffle", "switch", "seek", "seek_relative"))

The controller commands of the protocol; a command that is not in this list is not offered to the user.

Referenced by de.yaacc.sendspin.session.ControllerServerMessages.parseCommand().


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