YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.fcast.protocol.FCastMessages Class Reference

The messages of FCast protocol v3 that YAACC sends and reads (JSON bodies, see docs/tech.md, "FCast"): builders for the sender's messages and parsers for the receiver's. More...

Collaboration diagram for de.yaacc.fcast.protocol.FCastMessages:
Collaboration graph

Classes

class  Capabilities
 What a v4 receiver can play, from its ReceiverIntroduction.
 
class  Event
 Event of a subscribed event type (media item start, end or change).
 
interface  Incoming
 A message parsed from a receiver. More...
 
class  Initial
 Initial of a receiver (protocol 3).
 
class  Notice
 A message of a v4 receiver that is no failure of the item (a seek or volume that was clamped, a refused subtitle file): shown, nothing more.
 
class  PlaybackError
 PlaybackError: a text of the receiver (cleaned, at most FCastText#MAX_ERROR characters).
 
class  PlaybackUpdate
 PlaybackUpdate: the state and, if the receiver says so, the position.
 
class  PlayData
 What a receiver says is playing (from Initial or PlayUpdate); all fields may be null.
 
class  PlayRequest
 What to play.
 
class  PlayUpdate
 PlayUpdate: another sender (or the receiver itself) started something.
 
class  Tracks
 TracksAvailable of a v4 receiver: the tracks of the item it plays now (empty when there is none).
 
class  TrackSelected
 ChangeTrack relayed by a v4 receiver: the track of a type that is selected now (null: none).
 
class  Version
 Version: the protocol version the receiver speaks (1 or more).
 
class  VolumeUpdate
 VolumeUpdate: the volume 0 to 1.
 

Static Public Member Functions

static Incoming parse (FCastPacket packet) throws FCastProtocolException
 Parses the packet of a receiver.
 
static String version (int version)
 Version body.
 
static String initialSender (String displayName, String appName, String appVersion)
 Initial body of a sender; a null or empty part is left out.
 
static String seek (double seconds) throws FCastProtocolException
 Seek body: seconds, not negative.
 
static String setVolume (double volume) throws FCastProtocolException
 SetVolume body: 0 to 1 (a value outside is clamped, not finite is refused).
 
static String setSpeed (double speed) throws FCastProtocolException
 SetSpeed body: MIN_SPEED to MAX_SPEED.
 
static String subscribeEvent (int type)
 SubscribeEvent body for an event type, e.g.
 
static String unsubscribeEvent (int type)
 UnsubscribeEvent body.
 

Static Public Attributes

static final int STATE_IDLE = 0
 The playback states of a PlaybackUpdate.
 
static final int STATE_PLAYING = 1
 
static final int STATE_PAUSED = 2
 
static final int EVENT_MEDIA_ITEM_START = 0
 The event types of SubscribeEvent / Event.
 
static final int EVENT_MEDIA_ITEM_END = 1
 
static final int EVENT_MEDIA_ITEM_CHANGE = 2
 
static final double MIN_SPEED = 0.25
 The speeds YAACC asks for; a receiver clamps to 1/16 to 16 itself.
 
static final double MAX_SPEED = 4.0
 
static final double MIN_REPORTED_SPEED = 1.0 / 16.0
 The speeds accepted from a receiver.
 
static final double MAX_REPORTED_SPEED = 16.0
 
static final int MAX_TITLE = 200
 Text YAACC sends (a title).
 
static final int MAX_VERSION = 3
 The highest version of the plain JSON protocol this code speaks (v1 to v3); v4 is V4.
 
static final int V4 = 4
 Version 4 (TLS 1.3 and FlatBuffers); only a connection with a pinned key speaks it (D24).
 

Detailed Description

The messages of FCast protocol v3 that YAACC sends and reads (JSON bodies, see docs/tech.md, "FCast"): builders for the sender's messages and parsers for the receiver's.

Pure (the platform's org.json).

Parsing is lenient about what it does not use (unknown fields are ignored, receivers differ) and strict about what it uses: a field of the wrong type, a number that is not finite, a body that is not an object or is nested deeper than FCastText#MAX_DEPTH is a FCastProtocolException (kind BAD_BODY or BAD_MESSAGE) for that message only. Text from the receiver is cleaned and cut, numbers are clamped to what is meaningful, so a hostile receiver can not hand the app a negative time, an infinite speed or a name of a megabyte.

Outgoing URLs are sent exactly as given (owner's decision D9); the only refusal is a message that does not fit into a packet (FCastPacketCodec).

Member Function Documentation

◆ parse()

static Incoming de.yaacc.fcast.protocol.FCastMessages.parse ( FCastPacket packet) throws FCastProtocolException
static

Parses the packet of a receiver.

Returns
the message, or null for a packet that has no model here: Ping and Pong (the connection answers them), the opcodes only a sender sends, and numbers that are no opcode
Exceptions
FCastProtocolExceptionBAD_BODY or BAD_MESSAGE; the connection goes on after it

◆ subscribeEvent()

static String de.yaacc.fcast.protocol.FCastMessages.subscribeEvent ( int type)
static

SubscribeEvent body for an event type, e.g.

EVENT_MEDIA_ITEM_END.

Referenced by de.yaacc.fcast.protocol.FCastSession.subscribe(), and de.yaacc.fcast.protocol.FCastMessages.unsubscribeEvent().

Here is the caller graph for this function:

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