Documentation
¶
Overview ¶
Package facade implements the Facade design pattern. HomeTheater provides a simplified interface for controlling a group of devices: Projector, MediaServer, Lights, and SoundSystem. It encapsulates the logic required to coordinate these components in the correct sequence, allowing viewers to prepare for, play, and shut down a movie session through a single high-level interface.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HomeCinema ¶
type HomeCinema struct {
// contains filtered or unexported fields
}
HomeCinema is the facade for controlling all of the devices of home theater in the correct order
func NewHomeTheater ¶
func NewHomeTheater(input uint8, projectorName, serverName, lightsName, soundSystemName string) *HomeCinema
NewHomeTheater is the factory function to create the new home theater facade
func (*HomeCinema) Close ¶
func (c *HomeCinema) Close()
Close allows to turn off the devices and close the home theater until the next projection
func (*HomeCinema) EndMovie ¶
func (c *HomeCinema) EndMovie()
EndMovie allows to stop the projection of the movie
func (*HomeCinema) PlayMovie ¶
func (c *HomeCinema) PlayMovie(name string)
PlayMovie allows the devices to play the actual movie
func (*HomeCinema) Prepare ¶
func (c *HomeCinema) Prepare()
Prepare allows to prepare home theater for the projection
type Lights ¶
type Lights struct {
// contains filtered or unexported fields
}
Lights describes the lighting equipment of the cinema
func (*Lights) SetBrightness ¶
SetBrightness allows to dim or brighten up the lights to the specific absolute percentage
type MediaServer ¶
type MediaServer struct {
OutputInterface uint8
// contains filtered or unexported fields
}
MediaServer represents the devices that is able to broadcast the movie to the output interface
func (*MediaServer) Play ¶
func (s *MediaServer) Play(movieTitle string)
Play allows to start playing the movie
type Player ¶
type Player interface {
Play(string)
Stop()
}
Player is the general interface for all the devices able to play the movies
type Projector ¶
type Projector struct {
// contains filtered or unexported fields
}
Projector represents the projection device of the home theater
type SoundSystem ¶
type SoundSystem struct {
// contains filtered or unexported fields
}
SoundSystem represents the sound system of the home theater
func (*SoundSystem) SetVolume ¶
func (s *SoundSystem) SetVolume(volume uint8)
SetVolume allows to set the specific volume on the speakers