buildnet.applets.gui
Class DeviceApplet

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended bybuildnet.applets.gui.DeviceApplet
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public abstract class DeviceApplet
extends java.applet.Applet

Applet used to control Buildnet WCM device. Applets is configured through PARAMs to control one specific device. Depending on device type some kind of GUI is created, which shows device state (if appropriate) and allows to control the device (if appropriate).

The applet contains also a set of public methods for Javascript use. These methods allow to read device states and control it. The applet contains methods for all types of devices, but only those for configured device (through PARAMs) can be use.

Methods unavailable for this type of device throw java.lang.ClassCastException. See method descriptions for allowed device types.

If device method is called, but the applet could not connect to device, java.lang.NullPointerException is thrown, as the device does not exist.

Supported devices are:

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class java.applet.Applet
java.applet.Applet.AccessibleApplet
 
Nested classes inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DeviceApplet()
           
 
Method Summary
 boolean airconditionIsWorking()
          aircondition: get working status
 void brighter()
          light: start dimming light to get brighter.
protected abstract  DeviceProxy createDeviceProxy()
          Factory method to create BN Proxy
 void darker()
          light: start dimming light to get darker.
 boolean diginIsOn()
          digin: returns state of a digin device
 java.lang.String getAirconditionMode()
          aircondition: get operating mode
 int getBrightness()
          light: get light brightness
 int getCurrentTemperature()
          aircondition: get current temperature
 java.lang.String getDeviceName()
          Returns name of this device (same name as configured by applet params).
 int getWantedTemperature()
          aircondition: get wanted temperature
 void init()
          Initializes the applet BuildNetApplet
 boolean isAlarmOn()
          firealarm: get state of fire alarm
 void playFile(java.lang.String filename)
          infrared: play infrared signal
 void setAirconditionMode(java.lang.String mode)
          aircondition: set operating mode
 void setBrightness(int brightness)
          light: set light brightness
 void setWantedTemperature(int wantedTemperature)
          aircondition: set wanted temperature
 void showStatus(java.lang.String str)
           
 void start()
           
 void stop()
           
 void stopDimming()
          light: stop dimming light.
 boolean switchIsOn()
          switch: returns switch state (DIGOUT)
 void switchOff()
          switch: switch set to off (DIGOUT set to 0)
 void switchOn()
          switch: switch set to on(DIGOUT set to 1)
 
Methods inherited from class java.applet.Applet
destroy, getAccessibleContext, getAppletContext, getAppletInfo, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, getParameterInfo, isActive, newAudioClip, play, play, resize, resize, setStub
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DeviceApplet

public DeviceApplet()
Method Detail

init

public void init()
Initializes the applet BuildNetApplet


createDeviceProxy

protected abstract DeviceProxy createDeviceProxy()
Factory method to create BN Proxy


stop

public void stop()

start

public void start()

showStatus

public void showStatus(java.lang.String str)

getDeviceName

public java.lang.String getDeviceName()
Returns name of this device (same name as configured by applet params). The device name identifies exact device and consists of device type and device number, for example: switch1, light3, digin5

Returns:
name of this device
See Also:
param description for list of names and device numbers

switchIsOn

public boolean switchIsOn()
switch: returns switch state (DIGOUT)

Returns:
true if switch is on, false if switch is off

switchOff

public void switchOff()
switch: switch set to off (DIGOUT set to 0)


switchOn

public void switchOn()
switch: switch set to on(DIGOUT set to 1)


diginIsOn

public boolean diginIsOn()
digin: returns state of a digin device

Returns:
true if digin is 1, false if digin is 0

getBrightness

public int getBrightness()
light: get light brightness

Returns:
brightness as percentage (0-100)

setBrightness

public void setBrightness(int brightness)
light: set light brightness

Parameters:
brightness - as percentage (0-100)

brighter

public void brighter()
light: start dimming light to get brighter.


darker

public void darker()
light: start dimming light to get darker.


stopDimming

public void stopDimming()
light: stop dimming light.


isAlarmOn

public boolean isAlarmOn()
firealarm: get state of fire alarm

Returns:
true if alarm is on, false if no alarm

playFile

public void playFile(java.lang.String filename)
infrared: play infrared signal

Parameters:
filename - contains name of file with IR signal (from the IR directory on the WCM, 8 characters, without the required .IR extension)

getCurrentTemperature

public int getCurrentTemperature()
aircondition: get current temperature

Returns:
current temperature

getWantedTemperature

public int getWantedTemperature()
aircondition: get wanted temperature

Returns:
wanted temperature

setWantedTemperature

public void setWantedTemperature(int wantedTemperature)
aircondition: set wanted temperature


getAirconditionMode

public java.lang.String getAirconditionMode()
aircondition: get operating mode

Returns:
ac mode as string: on/off/auto

setAirconditionMode

public void setAirconditionMode(java.lang.String mode)
aircondition: set operating mode

Parameters:
mode - as string: on/off/auto

airconditionIsWorking

public boolean airconditionIsWorking()
aircondition: get working status

Returns:
true if working, else false