|
YAACC - UPNP Client and Server
|
Links devices into a group ("link": one server plays, its clients play in sync) and takes them out again. More...

Classes | |
| interface | Action |
| interface | Call |
| interface | Check |
| interface | Operation |
Public Member Functions | |
| YxcGroupService (YxcSleeper sleeper, Random random) | |
| synchronized YxcGroupResult | link (YxcGroupMember server, List< YxcGroupMember > clients) |
| Puts the clients into a group of the server. | |
| synchronized YxcGroupResult | extend (YxcGroupMember server, List< YxcGroupMember > clients) |
| Adds clients to the group the server already serves; fails if it serves none. | |
| synchronized YxcGroupResult | reduce (YxcGroupMember server, List< YxcGroupMember > clients) |
| Takes clients out of the group of the server. | |
| synchronized YxcGroupResult | unlink (YxcGroupMember device, Collection< YxcGroupMember > knownMembers) |
| Takes a device out of its group. | |
| synchronized YxcGroupResult | rename (YxcGroupMember server, String name) |
| Sets the name of the group the server serves; empty selects the default name. | |
Links devices into a group ("link": one server plays, its clients play in sync) and takes them out again.
The call sequences and the expected-state checks follow the behavior of the open-source libraries (see docs/tech.md): clients first, then the server call that lists them, then the start; after each change the state is read again (a device needs a moment) for up to one second, and a step that did not reach its state is repeated once. The first slice has no event listener, so waiting means polling getDistributionInfo.
Expected failures (a device is unreachable, refuses a call, does not reach the state) are returned as YxcGroupResult, not thrown. An operation that fails part-way takes back what it did to the clients; it cannot restore a group that a client was taken out of. Operations of one service run one after another.
| de.yaacc.yxc.YxcGroupService.YxcGroupService | ( | YxcSleeper | sleeper, |
| Random | random ) |
| random | where new group ids come from (a SecureRandom in the app) |
| synchronized YxcGroupResult de.yaacc.yxc.YxcGroupService.link | ( | YxcGroupMember | server, |
| List< YxcGroupMember > | clients ) |
Puts the clients into a group of the server.
A server that already serves a group gets them added to it, otherwise a new group id is chosen. A client that is in another group leaves it first; a client that serves a group of its own ends that group first (the device refuses the client call while it serves).
Referenced by de.yaacc.yxc.YxcGroupOperations.applySelection().

| synchronized YxcGroupResult de.yaacc.yxc.YxcGroupService.reduce | ( | YxcGroupMember | server, |
| List< YxcGroupMember > | clients ) |
Takes clients out of the group of the server.
Clients that are not in it are ignored; when nobody would be left the group is ended. A client that cannot be reached is still removed on the server side.
Referenced by de.yaacc.yxc.YxcGroupOperations.applySelection().

| synchronized YxcGroupResult de.yaacc.yxc.YxcGroupService.unlink | ( | YxcGroupMember | device, |
| Collection< YxcGroupMember > | knownMembers ) |
Takes a device out of its group.
A server ends the group (the known members that are its clients leave first); a client leaves, and is removed from its server if that is among the known members. A device in no group is left alone and the result is success.
| knownMembers | other devices the caller knows; the clients of a group are only addressed when listed here |
Referenced by de.yaacc.yxc.YxcGroupOperations.leave(), and de.yaacc.yxc.YxcGroupOperations.unlinkGroup().

