|
YAACC - UPNP Client and Server
|
The state of the built-in Snapcast server (issue #330): clients, groups and streams with the rules of snapserver (docs/tech.md, "JSON-RPC control"), the status as Server.GetStatus shows it, and the notifications that a change makes.
More...

Classes | |
| class | StateException |
| An error of a request. | |
Public Member Functions | |
| ServerState (String serverName, String version, int bufferMs, Supplier< String > groupIds, LongSupplier nowMillis) | |
| synchronized List< JSONObject > | addStream (String id, String rawUri) |
| Adds a stream (the caller has checked the kind of source: only tcp, see the design). | |
| synchronized List< JSONObject > | removeStream (String id) |
| synchronized List< JSONObject > | setStreamStatus (String id, String status) |
| synchronized boolean | hasStream (String id) |
| synchronized List< String > | streamIds () |
| String | clientIdOf (HelloMessage hello) |
The id the server uses for the client of this Hello: its ID, with #n appended for an instance above 1. | |
| synchronized List< JSONObject > | clientConnected (HelloMessage hello, String ip) |
| A client said Hello. | |
| synchronized List< JSONObject > | clientDisconnected (String id) |
| synchronized List< JSONObject > | setClientVolume (String id, int percent, boolean muted) |
| synchronized List< JSONObject > | clientInfo (String id, int percent, boolean muted) |
| The client itself reports its volume and mute (ClientInfo): out of range values are clamped, not refused. | |
| synchronized List< JSONObject > | setClientLatency (String id, int latencyMs) |
| synchronized List< JSONObject > | setClientName (String id, String name) |
| synchronized List< JSONObject > | deleteClient (String id) |
| Forgets a client that is not connected. | |
| synchronized ServerSettingsMessage | settingsOf (String id) |
| What the client is told when it joins and when its settings change. | |
| synchronized boolean | knowsClient (String id) |
| synchronized String | groupIdOf (String clientId) |
| synchronized String | streamIdOf (String clientId) |
| The stream of the group of a client, "" if none. | |
| synchronized List< String > | connectedClientsOfStream (String streamId) |
| The connected clients that are in groups that play this stream. | |
| synchronized int | connectedClientCount () |
| How many clients are connected now. | |
| synchronized boolean | hasPlayingStreamWithClients () |
| True while a stream that is playing has a connected client: the only time the server needs the CPU and the Wi-Fi awake. | |
| synchronized List< JSONObject > | setGroupMute (String groupId, boolean muted) |
| synchronized List< JSONObject > | setGroupName (String groupId, String name) |
| synchronized List< JSONObject > | setGroupStream (String groupId, String streamId) |
| synchronized List< JSONObject > | setGroupClients (String groupId, List< String > wanted) |
| Sets the exact membership of a group: the clients of the list move into it, the clients that were in it and are not in the list each get a group of their own on the same stream; a group that ends up without clients is gone. | |
| synchronized JSONObject | snapshot () |
| What survives a restart (requirement R8): the clients with their settings and the groups with their members; not the streams (the app's feed makes them again) and not who is connected. | |
| synchronized void | restore (JSONObject snapshot) |
| Takes back a snapshot into an empty state. | |
| synchronized JSONObject | clientStatus (String id) |
The result of Client.GetStatus: {"client": {...}}. | |
| synchronized JSONObject | groupStatus (String id) |
The result of Group.GetStatus: {"group": {...}}. | |
| synchronized JSONObject | status () |
The result of Server.GetStatus: {"server": {...}}. | |
The state of the built-in Snapcast server (issue #330): clients, groups and streams with the rules of snapserver (docs/tech.md, "JSON-RPC control"), the status as Server.GetStatus shows it, and the notifications that a change makes.
A mutating method returns the notifications (JSON-RPC notification objects) for the control connections, and never writes to a socket itself; the caller sends them after it has left the monitor. All methods are thread safe (one monitor). A change that changes nothing returns no notification. Errors carry the code of snapserver: -32602 for invalid params, -32603 for an internal error.
| de.yaacc.snapcast.server.ServerState.ServerState | ( | String | serverName, |
| String | version, | ||
| int | bufferMs, | ||
| Supplier< String > | groupIds, | ||
| LongSupplier | nowMillis ) |
| serverName | the name of the machine, shown as the host of the server |
| bufferMs | the buffer that clients are told (default 1000) |
| groupIds | makes the ids of new groups (a UUID in the app) |
| synchronized List< JSONObject > de.yaacc.snapcast.server.ServerState.clientConnected | ( | HelloMessage | hello, |
| String | ip ) |
A client said Hello.
A client that is known keeps its group and settings.
Referenced by de.yaacc.snapcast.server.SnapcastServer.joined().


| synchronized void de.yaacc.snapcast.server.ServerState.restore | ( | JSONObject | snapshot | ) |
Takes back a snapshot into an empty state.
What is wrong with it is left out (a damaged store never stops the server): at most {@value MAX_CLIENTS} clients and groups, names cut, volume and latency held to their range.
Referenced by de.yaacc.snapcast.server.ServerStore.restoreInto().


| synchronized List< JSONObject > de.yaacc.snapcast.server.ServerState.setStreamStatus | ( | String | id, |
| String | status ) |
| status | "idle" or "playing" |
Referenced by de.yaacc.snapcast.server.SnapcastServer.status().

