House_Management

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.

Contents

All classes

Class diagram for House_Management

Private Classes

Inheritance relationships

Types


Private Classes

A1

Context class diagram for A1

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.

Roles

Button (1..n) Controls (1..n) Lamp

Lamp (1..n) Is_Controlled_By (1..n) Button

Button

Context class diagram for 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.

Identifying attributes

Name : Button_Name

Each Button is uniquely identified by its name. The name corresponds to the geographical location of the button.

Private class operations

Changed

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:

S : in Input_Signal_State

Public instance operations

Get_State, abstract returns Boolean

Protected instance operations

Notify_Connected_Lamps

Called to indicate to connected Lamps that the Button's state has changed.

Private instance operations

Changed, abstract

Called to indicate that the Button has been pushed or released.

Parameters:

Pushed : in Boolean

Associations

Lamp

Context class diagram for Lamp

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.

Identifying attributes

Name : Lamp_Name

Each Lamp is uniquely identified by its name. The name corresponds to the geographical location of the lamp.

Private class operations

Initialize, class initialization

This operation initializes the Lamps and Buttons.

Public instance operations

Changed

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).

Private instance operations

Output_For_Lamp returns Output_Signal

Maps the Lamp to the corresponding Digital_IO output pin.

Associations

Timed_Button

Context class diagram for Timed_Button

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.

Subtype of Button in Button.

Normal attributes

Timeout : Timer

This ColdFrame Timer is used to reset the Button at the end of its activation period.

States

Initial
Reset

In this state, the Button is off.

Set

In this state, the Button is set and the Timer is set.

Events

Button_Push
Timeout

State-Event Matrix

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

State Diagram

State diagram for House_Management.Timed_Button

Public instance operations

Get_State returns Boolean

This overriding implementation returns the current state of the Timed Button (True => on)

Protected instance operations

Changed

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:

Pushed : in Boolean

Private instance operations

Clear_Timeout

This state entry action unsets the instance Timeout.

Set_Timeout

This state entry action sets the instance Timeout to the required activation period.

Toggle_Button

Context class diagram for Toggle_Button

A Toggle Button is a push-on, push-off toggle.

Subtype of Button in Button.

Normal attributes

On : Boolean, initial value False

Public instance operations

Get_State returns Boolean

This overriding implementation returns the current state of the Toggle Button (from On)

Protected instance operations

Changed

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:

Pushed : in Boolean

Inheritance relationships

Button

Superclass

Button

Children

Types

Button_Name

There are pushbuttons on each landing. This type names the pushbuttons.

An enumeration, with literals:

Input_Signal_State

This type is used by the supporting Digital IO domain to report input (switch) state changes.

Imported from Digital_IO.

Lamp_Name

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:

Output_Signal

This type is used by the supporting Digital IO domain to name outputs (lamps).

Imported from Digital_IO.

Timed_Button_Name

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.

Toggle_Button_Name

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.