Copyright (C) Simon Wright <simon@pushface.org>
This package is free software; you can redistribute it and/or modify it under terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License distributed with this package; see file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
This domain represents an electronic household control system.
The first release only manages the stairwell lighting system.
Eacb Button controls one or more Lamps; each Lamp is controlled by one or more Buttons.
There's no association-specific data, but this has to be an association class because it's a many-to-many relationship.
This is an Association Class.
Button (1..n) Controls (1..n) Lamp
Lamp (1..n) Is_Controlled_By (1..n) Button
There are one or more pushbuttons on each landing. Each pushbutton controls a number of Lamps; if any of the controlling Buttons is set, the controlled Lamp is lit.
Supertype in Button.
Each Button is uniquely identified by its name. The name corresponds to the geographical location of the button.
Acts as receiver of state changes from Digital IO, via Signal State Callback. Calls the instance Changed so the Button can take the appropriate action.
Parameters:
Called to indicate to connected Lamps that the Button's state has changed.
Called to indicate that the Button has been pushed or released.
Parameters:
There is a lamp between each pair of landings.
A Lamp is connected to one or more Buttons; it is lit if any of the connected Buttons is set.
Each Lamp is uniquely identified by its name. The name corresponds to the geographical location of the lamp.
This operation initializes the Lamps and Buttons.
This operation is used by a linked Button to tell the Lamp to evaluate all its linked Buttons to see if any are Set (in which case the Lamp should be lit) or all are Reset (in which case the Lamp should be off).
Maps the Lamp to the corresponding Digital_IO output pin.
When a Timed Button is pushed, it remains set for a preset period.
If it is pushed again while it is still set, the set period is extended by the preset period.
This ColdFrame Timer is used to reset the Button at the end of its activation period.
In this state, the Button is off.
In this state, the Button is set and the Timer is set.
State | Entry Action(s) | Event | Drop-through | |
---|---|---|---|---|
Button_Push | Timeout | |||
Initial | none | can't happen | can't happen | Reset |
Reset | none | Set/ Notify_Connected_Lamps |
can't happen | none |
Set | Set_Timeout | Set/ Clear_Timeout |
Reset/ Notify_Connected_Lamps |
none |
This overriding implementation returns the current state of the Timed Button (True => on)
This overriding implementation is called to indicate that the Button has been pushed or released.
For this kind of Button, actions a Button_Pushed event in case of a push; a release is ignored.
Parameters:
This state entry action unsets the instance Timeout.
This state entry action sets the instance Timeout to the required activation period.
A Toggle Button is a push-on, push-off toggle.
This overriding implementation returns the current state of the Toggle Button (from On)
This overriding implementation is called to indicate that the Button has been pushed or released.
For this kind of Button, toggles On in case of a push; a release is ignored.
Notifies connected lamps of the change.
Parameters:
There are pushbuttons on each landing. This type names the pushbuttons.
An enumeration, with literals:
This type is used by the supporting Digital IO domain to report input (switch) state changes.
Imported from Digital_IO.
There is a lamp beween each pair of landings. This type names the lamps; the name is that of the landing on whose ceiling the lamp is fixed.
An enumeration, with literals:
This type is used by the supporting Digital IO domain to name outputs (lamps).
Imported from Digital_IO.
Some of the pushbuttons are 'timed', that is, the electrical connection is made for a period after the button is pushed. If the button is pushed again before the period expires, the made period is extended.
A constrained version of Button_Name from Basement_Timed to Second_Floor_Timed.
Some of the pushbuttons are 'toggled', that is, the electrical connection is made when the button is pushed, and remains made until the Button is pushed again.
A constrained version of Button_Name from Basement_Toggle to Second_Floor_Toggle.