31
4 APT Masterswitch implementation
4.1 Introduction
Currently the Masterswitch is controlled via an “Expect” script which runs a telnet session to
interface to the device. Expect is a scripting language designed to respond to text on the
screen.
The JAS interfaces to the Masterswitch using the APTSystem framework. Each time a
Masterswitch outlet property is set, the APTSystem calls the aptSetProperties script which in-
turn invokes the expect script. Eventually resulting in the outlet changing state. I.e. Switch on or
off.
There are several issues with the current implementation:
• There is no state change notification
The Masterswitch device must be queried at regular intervals in order to discover when
an outlets state has changed, possibly due to another user controlling the device.
• Unreliable, occasionally the TELNET session created within the expect script fails for
unknown reasons.
• Poor Error handling. If the script fails, very little error information can be obtained.
The SNMP (Simple Network Management Protocol) interface provides a much more powerful
way to control the hardware. When the SNMP interface is enabled, the Masterswitch generates
SNMP Traps which can be used to notify the system of any state changes within the system.
Capturing this information at runtime allows notification of state changes within the system rather
than using a polling technique.
It is desirable for the APT System to be able to access the Masterswitch as a Java Object. This will
allow more powerful JASCommands to be written, which will, in turn provide a framework for a
more reliable and flexible software module.
4.2 Controlling the masterswitch
Due to the simple functionality of the Masterswitch, the requirements for controlling it are fairly
straightforward. These are:
• get and set outlet state
• Real-time notification of outlet state changes
It is vital that the system always reflects the current state of the Masterswitch. Although
the outlets are unlikely to be switched often, correctly knowing the state of each outlet at
all times would be valuable information, particularly if a fault had occurred elsewhere in
the system.
• Error Notification
Internal errors and warning conditions within the Masterswitch should be able to be
monitored
• Support for adding multiple Masterswitch devices in the future.
Kommentare zu diesen Handbüchern