PHP Class duncan3dc\Sonos\Network

Inheritance: implements Psr\Log\LoggerAwareInterface
Afficher le fichier Open project: duncan3dc/sonos Class Usage Examples

Protected Properties

Свойство Type Description
$alarms duncan3dc\Sonos\Alarm[] | null Alarms that are available on the current network.
$cache Doctrine\Common\Cache\Cache The cache object to use for the expensive multicast discover to find Sonos devices on the network.
$logger Psr\Log\LoggerInterface The logging object.
$multicastAddress string The multicast address to use for SSDP discovery.
$networkInterface string The network interface to use for SSDP discovery.
$playlists Playlists[] | null Playlists that are available on the current network.
$speakers duncan3dc\Sonos\Speaker[] | null Speakers that are available on the current network.

Méthodes publiques

Méthode Description
__construct ( Doctrine\Common\Cache\Cache $cache = null, Psr\Log\LoggerInterface $logger = null ) Create a new instance.
clearTopology ( ) : static Reset any previously gathered speaker information.
createPlaylist ( $name ) : duncan3dc\Sonos\Playlist Create a new playlist.
getAlarmById ( $id ) : duncan3dc\Sonos\Alarm | null Get alarms for the specified id.
getAlarms ( ) : duncan3dc\Sonos\Alarm[] Get all the alarms available on the network.
getController ( ) : Controller | null Get a Controller instance from the network.
getControllerByIp ( string $ip ) : Controller | null Get the coordinator for the specified ip address.
getControllerByRoom ( string $room ) : Controller | null Get the coordinator for the specified room name.
getControllers ( ) : Controller[] Get all the coordinators on the network.
getLogger ( ) : Psr\Log\LoggerInterface Get the logger object to use.
getNetworkInterface ( ) : string | integer | null Get the network interface currently in use
getPlaylistById ( $id ) : duncan3dc\Sonos\Playlist Get the playlist with the specified id.
getPlaylistByName ( $name ) : duncan3dc\Sonos\Playlist | null Get the playlist with the specified name.
getPlaylists ( ) : duncan3dc\Sonos\Playlist[] Get all the playlists available on the network.
getRadio ( ) : duncan3dc\Sonos\Services\Radio Get a Radio instance for the network.
getRadioShows ( ) : Stream[] Get the favourite radio shows.
getRadioStations ( ) : Stream[] Get the favourite radio stations.
getSpeakerByRoom ( string $room ) : duncan3dc\Sonos\Speaker | null Get a speaker with the specified room name.
getSpeakers ( ) : duncan3dc\Sonos\Speaker[] Get all the speakers on the network.
getSpeakersByRoom ( string $room ) : duncan3dc\Sonos\Speaker[] Get all the speakers with the specified room name.
hasPlaylist ( $name ) : boolean Check if a playlist with the specified name exists on this network.
setLogger ( Psr\Log\LoggerInterface $logger ) : static Set the logger object to use.
setMulticastAddress ( $multicastAddress ) : static Set the multicast address to use for SSDP discovery.
setNetworkInterface ( $networkInterface ) : static Set the network interface to use for SSDP discovery.

Méthodes protégées

Méthode Description
getCacheKey ( )
getDevices ( ) : string[] Get all the devices on the current network.

Method Details

__construct() public méthode

Create a new instance.
public __construct ( Doctrine\Common\Cache\Cache $cache = null, Psr\Log\LoggerInterface $logger = null )
$cache Doctrine\Common\Cache\Cache The cache object to use for the expensive multicast discover to find Sonos devices on the network
$logger Psr\Log\LoggerInterface The logging object

clearTopology() public méthode

Reset any previously gathered speaker information.
public clearTopology ( ) : static
Résultat static

createPlaylist() public méthode

Create a new playlist.
public createPlaylist ( $name ) : duncan3dc\Sonos\Playlist
Résultat duncan3dc\Sonos\Playlist

getAlarmById() public méthode

Get alarms for the specified id.
public getAlarmById ( $id ) : duncan3dc\Sonos\Alarm | null
Résultat duncan3dc\Sonos\Alarm | null

getAlarms() public méthode

Get all the alarms available on the network.
public getAlarms ( ) : duncan3dc\Sonos\Alarm[]
Résultat duncan3dc\Sonos\Alarm[]

getCacheKey() protected méthode

protected getCacheKey ( )

getController() public méthode

Useful for managing playlists/alarms, as these need a controller but it doesn't matter which one.
public getController ( ) : Controller | null
Résultat Controller | null

getControllerByIp() public méthode

Get the coordinator for the specified ip address.
public getControllerByIp ( string $ip ) : Controller | null
$ip string The ip address of the speaker
Résultat Controller | null

getControllerByRoom() public méthode

Get the coordinator for the specified room name.
public getControllerByRoom ( string $room ) : Controller | null
$room string The name of the room to look for
Résultat Controller | null

getControllers() public méthode

Get all the coordinators on the network.
public getControllers ( ) : Controller[]
Résultat Controller[]

getDevices() protected méthode

Get all the devices on the current network.
protected getDevices ( ) : string[]
Résultat string[] An array of ip addresses

getLogger() public méthode

Get the logger object to use.
public getLogger ( ) : Psr\Log\LoggerInterface
Résultat Psr\Log\LoggerInterface $logger The logging object

getNetworkInterface() public méthode

Get the network interface currently in use
public getNetworkInterface ( ) : string | integer | null
Résultat string | integer | null The network interface name

getPlaylistById() public méthode

Get the playlist with the specified id.
public getPlaylistById ( $id ) : duncan3dc\Sonos\Playlist
Résultat duncan3dc\Sonos\Playlist

getPlaylistByName() public méthode

If no case-sensitive match is found it will return a case-insensitive match.
public getPlaylistByName ( $name ) : duncan3dc\Sonos\Playlist | null
Résultat duncan3dc\Sonos\Playlist | null

getPlaylists() public méthode

Get all the playlists available on the network.
public getPlaylists ( ) : duncan3dc\Sonos\Playlist[]
Résultat duncan3dc\Sonos\Playlist[]

getRadio() public méthode

Get a Radio instance for the network.
public getRadio ( ) : duncan3dc\Sonos\Services\Radio
Résultat duncan3dc\Sonos\Services\Radio

getRadioShows() public méthode

Get the favourite radio shows.
public getRadioShows ( ) : Stream[]
Résultat duncan3dc\Sonos\Tracks\Stream[]

getRadioStations() public méthode

Get the favourite radio stations.
public getRadioStations ( ) : Stream[]
Résultat duncan3dc\Sonos\Tracks\Stream[]

getSpeakerByRoom() public méthode

Get a speaker with the specified room name.
public getSpeakerByRoom ( string $room ) : duncan3dc\Sonos\Speaker | null
$room string The name of the room to look for
Résultat duncan3dc\Sonos\Speaker | null

getSpeakers() public méthode

Get all the speakers on the network.
public getSpeakers ( ) : duncan3dc\Sonos\Speaker[]
Résultat duncan3dc\Sonos\Speaker[]

getSpeakersByRoom() public méthode

Get all the speakers with the specified room name.
public getSpeakersByRoom ( string $room ) : duncan3dc\Sonos\Speaker[]
$room string The name of the room to look for
Résultat duncan3dc\Sonos\Speaker[]

hasPlaylist() public méthode

If no case-sensitive match is found it will return a case-insensitive match.
public hasPlaylist ( $name ) : boolean
Résultat boolean

setLogger() public méthode

Set the logger object to use.
public setLogger ( Psr\Log\LoggerInterface $logger ) : static
$logger Psr\Log\LoggerInterface
Résultat static

setMulticastAddress() public méthode

Set the multicast address to use for SSDP discovery.
public setMulticastAddress ( $multicastAddress ) : static
Résultat static

setNetworkInterface() public méthode

See the documentation on IP_MULTICAST_IF at http://php.net/manual/en/function.socket-get-option.php
public setNetworkInterface ( $networkInterface ) : static
Résultat static

Property Details

$alarms protected_oe property

Alarms that are available on the current network.
protected Alarm[],duncan3dc\Sonos|null $alarms
Résultat duncan3dc\Sonos\Alarm[] | null

$cache protected_oe property

The cache object to use for the expensive multicast discover to find Sonos devices on the network.
protected Cache,Doctrine\Common\Cache $cache
Résultat Doctrine\Common\Cache\Cache

$logger protected_oe property

The logging object.
protected LoggerInterface,Psr\Log $logger
Résultat Psr\Log\LoggerInterface

$multicastAddress protected_oe property

The multicast address to use for SSDP discovery.
protected string $multicastAddress
Résultat string

$networkInterface protected_oe property

The network interface to use for SSDP discovery.
protected string $networkInterface
Résultat string

$playlists protected_oe property

Playlists that are available on the current network.
protected Playlists[]|null $playlists
Résultat Playlists[] | null

$speakers protected_oe property

Speakers that are available on the current network.
protected Speaker[],duncan3dc\Sonos|null $speakers
Résultat duncan3dc\Sonos\Speaker[] | null