AbstractVolumeService

AbstractVolumeService ⇐ Abstract

Kind: global abstract class
Extends: Abstract
Service:
Properties

NameTypeDescription
defaultVolumenumber

Default value of the volume at startup (Integer defaulted to 50)

volumeStepPercentnumber

Steps when doing a volume up or down (Integer defaulted to 10)

maxVolumenumber

Maximum value for the output volume (Integer defaulted to 100)

defaultVolumenumber
volumeStepPercentnumber
dimDefaultValuenumber
dimVoiceValuenumber
maxVolumenumber

AbstractVolumeService()

The AbstractVolumeService handles the volume management.

init() ⇒ Promise.<*, Error>

Init the service.

Kind: instance method of AbstractVolumeService
Returns: Promise.<*, Error> - Promise resolved when init is done

dimVolume(dimming) ⇒ Promise.<number>

Allows to dim volume by a percentage dimming value

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the dimming is actually changed, with the new dimming percentage between 0 and this.maxVolume inclusive.

ParamTypeDescription
dimmingNumber

Percentage dimming value for volume reduction (default: 0, no dimming).

setVolume(volume, [options]) ⇒ Promise.<number>

Set the main volume.

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the main volume is actually changed, with the new volume percentage between 0 and this.maxVolume inclusive.
Emits: volumeChange

ParamTypeDescription
volumenumber

Volume percent between 0 and 100 inclusive.

[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise.

getVolume([options]) ⇒ Promise.<number>

Get the current main volume.

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved with the main volume percentage between 0 and 100 inclusive.

ParamTypeDescription
[options]object

Additional options

[options.force]boolean

If true, renew the cache

volumeUp([options]) ⇒ Promise.<number>

Increase the volume by volumeStepPercent.

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved with the new main volume percentage between 0 and 100 inclusive.
Emits: volumeChange

ParamTypeDescription
[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise

[options.force]boolean

If true, force to renew the cache when getting the current volume.

volumeDown([options]) ⇒ Promise.<number>

Decrease the volume by volumeStepPercent.

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved with the new main volume percentage between 0 and 100 inclusive.
Emits: volumeChange

ParamTypeDescription
[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise

[options.force]boolean

If true, force to renew the cache when getting the current volume.

mute([options]) ⇒ Promise

Mute the main volume. Note: not equivalent to setVolume(0) ! Mute preserves the current volume.

Kind: instance method of AbstractVolumeService
Returns: Promise - A Promise resolved when the main volume is actually muted.
Emits: muteStateChange

ParamTypeDescription
[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise

unMute([options]) ⇒ Promise

UnMute the main volume.

Kind: instance method of AbstractVolumeService
Returns: Promise - A Promise resolved when the main volume is actually unMuted.
Emits: muteStateChange

ParamTypeDescription
[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise.

toggleMute([options]) ⇒ Promise.<boolean>

Toggle the main volume mute status.

Kind: instance method of AbstractVolumeService
Returns: Promise.<boolean> - A Promise resolved with the main volume mute status.
Emits: muteStateChange

ParamTypeDescription
[options]object
[options.skipNotify]boolean

True if the method shouldn't dispatch an event, false otherwise

[options.force]boolean

If true, refresh the cache

isMuted([options]) ⇒ Promise.<boolean>

Check if the main volume is muted.

Kind: instance method of AbstractVolumeService
Returns: Promise.<boolean> - A Promise resolved with the main volume mute status.

ParamTypeDescription
[options]object

Additional options

[options.force]boolean

If true, refresh the cache

restoreLastVolume([options]) ⇒ Promise.<number>

Restore the last volume, ie set the volume to the last value it was set Note: it does not trigger the #volumeChange event

Kind: instance method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the last volume

ParamTypeDescription
[options]object

Options

_init() ⇒ Promise

Kind: instance method of AbstractVolumeService
Returns: Promise - A Promise resolved when the service is initialized

_setVolume(volume) ⇒ Promise.<number>

Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the main volume is actually changed, with the volume percentage between 0 and this.maxVolume inclusive.

ParamType
volumenumber

_getVolume() ⇒ Promise.<number>

Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved with the main volume percentage between 0 and this.maxVolume inclusive.

_mute() ⇒ Promise

Kind: instance abstract method of AbstractVolumeService
Returns: Promise - A Promise resolved when the main volume is actually muted.

_unMute() ⇒ Promise

Kind: instance abstract method of AbstractVolumeService
Returns: Promise - A Promise resolved when the main volume is actually unmuted.
Access: protected

_isMuted() ⇒ Promise.<boolean>

Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<boolean> - A Promise resolved with the main volume mute status.

_storeLastVolume(volume) ⇒ Promise.<number>

Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the last volume

ParamType
volumenumber

_restoreLastVolume() ⇒ Promise.<number>

Kind: instance abstract method of AbstractVolumeService
Returns: Promise.<number> - A Promise resolved when the last volume

_onVolumeChange(volume) ⇒ Promise

Kind: instance method of AbstractVolumeService
Access: protected

ParamType
volumenumber

_onMuteStateChange(muted) ⇒ Promise

Kind: instance method of AbstractVolumeService
Access: protected

ParamType
mutedboolean

“volumeChange” (volume)

Fired when the main volume has been changed

Kind: event emitted by AbstractVolumeService

ParamTypeDescription
volumenumber

The new volume

“muteStateChange” (muted)

Fired when the main volume mute state has been changed

Kind: event emitted by AbstractVolumeService

ParamTypeDescription
mutedboolean

True if muted