Yamaha MusicCast™ v0.2.2 MusicCast.Network.Entity
A module for managing MusicCast™ enabled devices.
A network entity is automatically started when a MusicCast enabled device is
discovered. See the MusicCast.UPnP.SSDPClient
for implementation details. Once started,
the entity process is available to the network registry via it MusicCast device ID:
iex> pid = MusicCast.whereis("00A0DEDCF73E")
#PID<0.200.0>
Synchronization
Each entity process keeps it state synchronized with the device it is paired with.
This task is acomplished by the MusicCast.Network.EventDispatcher
process which forwards
incoming YXC unicast messages to the affected entity processes.
In order to receive UPnP A/V notification from MusicCast™ devices via UPnP A/V,
you must forward the MusicCast.UPnP.Plug.EventDispatcher
plug in your HTTP stack and configure your application accordingly.
YXC & UPnP
Extended Control or “YXC” is Yamaha’s communication protocol sent over Ethernet and Wi-Fi to control MusicCast™ devices. Each entity provides a set of functions for interacting with a device.
See MusicCast.ExtendedControl
for more details.
On top of the commands provided by YXC, entities support the UPnP A/V Transport protocol. Functions such as playback_load/3
and
playback_load_queue/2
provide a way to load streamable content via an URL.
Gapless playback can be achieved with a combination of playback_load/3
and playback_load_next/3
.
The latter basically tells the rendering devices which source to play next.
To play multiple items, consider using playback_load_queue/2
, it handles “previous” and “next” commands automatically,
ensures gapless playback and supports “repeat” and “shuffle” modes.
See MusicCast.UPnP.AVTransport
for more details.
Summary
Functions
Returns the state value(s) for the given lookup key(s)
Decreases the volume by step
Increases the volume by step
Mutes the volume
Loads the given URL and immediately begins playback
Sets the next URL to load for gapless playback
Loads the given list of items
and immediately begins playback
Plays the next track in the playback queue
Pauses playback of the current track
Begins playback of the current track
Plays the previous track in the playback queue
Stops playback
Selects the given input
Sets the power status to “on” or “standby”
Sets the volume to the given volume
Starts an entity as part of a supervision tree
Stops the entity process
Toggles playback state from “play” to “pause” and vice versa
Toggles repeat settings
Toggles repeat settings
Unmutes the volume
Types
lookup_key :: :available_inputs | :device_id | :host | :network_name | :playback | :playback_queue | :status | :upnp | :upnp_service | :upnp_session_id
status() :: %{balance: Integer.t, bass_extension: boolean, direct: boolean, disable_flags: Integer.t, distribution_enable: boolean, enhancer: boolean, equalizer: %{high: Integer.t, low: Integer.t, mid: Integer.t, mode: String.t}, input: String.t, link_audio_delay: String.t, link_control: String.t, max_volume: Integer.t, mute: boolean, power: String.t, sleep: Integer.t, subwoofer_volume: Integer.t, volume: Integer.t}
t() :: %MusicCast.Network.Entity{available_inputs: [String.t], device_id: String.t, host: String.t, network_name: String.t, playback: playback, playback_queue: %{media_url: String.t, items: [MusicCast.UPnP.AVMusicTrack.didl_item]}, status: status, upnp: MusicCast.UPnP.AVTransport.t, upnp_service: MusicCast.UPnP.Service.t, upnp_session_id: String.t}
Functions
Returns the state value(s) for the given lookup key(s).
If you pass :all
, this function will return the full state of the entity.
iex> MusicCast.Network.Entity.__lookup__(pid, :all)
%MusicCast.Network.Entity{...}
If you prefer to query a subset of the entity’s state, you can pass any number of lookup_key/0
:
iex> MusicCast.Network.Entity.__lookup__(pid, [:host, :network_name])
["192.168.0.63", "Schlafzimmer"]
Decreases the volume by step
.
Increases the volume by step
.
Loads the given URL and immediately begins playback.
If given, meta
must conform to MusicCast.UPnP.AVMusicTrack.t/0
.
Sets the next URL to load for gapless playback.
If given, meta
must conform to MusicCast.UPnP.AVMusicTrack.t/0
.
Loads the given list of items
and immediately begins playback.
All given items
must conform to MusicCast.UPnP.AVMusicTrack.didl_item/0
.
Plays the next track in the playback queue.
Pauses playback of the current track.
Plays the previous track in the playback queue.
Selects the given input
.
To get a list of available inputs from a specific device, see __lookup__/2
.
Sets the power status to “on” or “standby”.
Sets the volume to the given volume
.
start_link(ip_address, MusicCast.UPnP.Service.t, Keyword.t) :: GenServer.on_start
Starts an entity as part of a supervision tree.
Stops the entity process.
Toggles playback state from “play” to “pause” and vice versa.