Properties

$days

$days : array

Type

array — An mapping of php day values to our day constants.

$id

$id : string

Type

string — The unique id of the alarm

$attributes

$attributes : array

Type

array — The attributes of the alarm

Methods

__construct()

__construct(\duncan3dc\DomParser\XmlElement  $xml, \duncan3dc\Sonos\Interfaces\NetworkInterface  $network) 

Create an instance of the Alarm class.

Parameters

\duncan3dc\DomParser\XmlElement $xml

The xml element with the relevant attributes

\duncan3dc\Sonos\Interfaces\NetworkInterface $network

A Network instance this alarm is from

getId()

getId() : integer

Get the id of the alarm.

Returns

integer

getRoom()

getRoom() : string

Get the room of the alarm.

Returns

string

setRoom()

setRoom(string  $uuid) : $this

Set the room of the alarm.

Parameters

string $uuid

The unique id of the room (eg, RINCON_B8E93758723601400)

Returns

$this

setSpeaker()

setSpeaker(\duncan3dc\Sonos\Interfaces\SpeakerInterface  $speaker) : $this

Set the speaker of the alarm.

Parameters

\duncan3dc\Sonos\Interfaces\SpeakerInterface $speaker

The speaker to attach this alarm to

Returns

$this

getFrequency()

getFrequency() : integer

Get the frequency of the alarm.

The result is an integer which can be compared using the bitwise operators and the class constants for each day. If the alarm is a one time only alarm then it will not match any of the day constants, but will be equal to the class constant ONCE.

Returns

integer

setFrequency()

setFrequency(integer  $frequency) : $this

Set the frequency of the alarm.

Parameters

integer $frequency

The integer representing the frequency (using the bitwise class constants)

Returns

$this

onMonday()

onMonday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on mondays.

Parameters

boolean $set

Set this alarm to be active or not on mondays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onTuesday()

onTuesday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on tuesdays.

Parameters

boolean $set

Set this alarm to be active or not on tuesdays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onWednesday()

onWednesday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on wednesdays.

Parameters

boolean $set

Set this alarm to be active or not on wednesdays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onThursday()

onThursday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on thursdays.

Parameters

boolean $set

Set this alarm to be active or not on thursdays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onFriday()

onFriday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on fridays.

Parameters

boolean $set

Set this alarm to be active or not on fridays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onSaturday()

onSaturday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on saturdays.

Parameters

boolean $set

Set this alarm to be active or not on saturdays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

onSunday()

onSunday(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on sundays.

Parameters

boolean $set

Set this alarm to be active or not on sundays

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

once()

once(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is a one time only alarm.

Parameters

boolean $set

Set this alarm to be a one time only alarm

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

daily()

daily(boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm runs every day or not.

Parameters

boolean $set

Set this alarm to be active every day

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

getFrequencyDescription()

getFrequencyDescription() : string

Get the frequency of the alarm as a human readable description.

Returns

string

getVolume()

getVolume() : integer

Get the volume of the alarm.

Returns

integer

setVolume()

setVolume(integer  $volume) : $this

Set the volume of the alarm.

Parameters

integer $volume

The volume of the alarm

Returns

$this

getRepeat()

getRepeat() : boolean

Check if repeat is active.

Returns

boolean

setRepeat()

setRepeat(boolean  $repeat) : $this

Turn repeat mode on or off.

Parameters

boolean $repeat

Whether repeat should be on or not

Returns

$this

getShuffle()

getShuffle() : boolean

Check if shuffle is active.

Returns

boolean

setShuffle()

setShuffle(boolean  $shuffle) : $this

Turn shuffle mode on or off.

Parameters

boolean $shuffle

Whether shuffle should be on or not

Returns

$this

isActive()

isActive() : boolean

Check if the alarm is active.

Returns

boolean

activate()

activate() : $this

Make the alarm active.

Returns

$this

deactivate()

deactivate() : $this

Make the alarm inactive.

Returns

$this

delete()

delete() : void

Delete this alarm.

soap()

soap(string  $service, string  $action, array  $params = array()) : mixed

Send a soap request to the speaker for this alarm.

Parameters

string $service

The service to send the request to

string $action

The action to call

array $params

The parameters to pass

Returns

mixed

onHandler()

onHandler(integer  $day, boolean  $set = null) : boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Check or set whether this alarm is active on a particular day.

Parameters

integer $day

Which day to check/set

boolean $set

Set this alarm to be active or not on the specified day

Returns

boolean|\duncan3dc\Sonos\Interfaces\AlarmInterface

Returns true/false when checking, or AlarmInterface when setting

getPlayMode()

getPlayMode(string  $type) : boolean

Get a particular PlayMode.

Parameters

string $type

The play mode attribute to get

Returns

boolean

setPlayMode()

setPlayMode(string  $type, boolean  $value) : $this

Set a particular PlayMode.

Parameters

string $type

The play mode attribute to update

boolean $value

The value to set the attribute to

Returns

$this

save()

save() : $this

Update the alarm with the current instance settings.

Returns

$this