examples.carcontrol
Class WindowServiceImpl

java.lang.Object
  extended byde.fhg.igd.semoa.service.AbstractService
      extended byexamples.carcontrol.WindowServiceImpl
All Implemented Interfaces:
Service, WindowService

public class WindowServiceImpl
extends AbstractService
implements WindowService

This simple service is expected by @link WindowAgent and provides methods to grant control and status of the windows in the car.

Author:
Daniel Bachmann

Field Summary
private  byte state
          The first four bits of the byte represent the windows.
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Fields inherited from interface examples.carcontrol.WindowService
LEFT_BACK, LEFT_FRONT, PUBLISH_KEY, RIGHT_BACK, RIGHT_FRONT
 
Constructor Summary
WindowServiceImpl()
           
 
Method Summary
 String author()
          Returns the name of the author of the service.
private  void clear(int which)
          Clears a bit of the status byte.
 void down(int which)
          Lowers a window and changes current state.
 byte getStatus()
          Returns current state of all windows.
 String info()
          Returns the informative string which should describe the service's essence in a sentence.
 boolean isLowered(int which)
           
 String revision()
          Returns the revision number of this class as a string.
private  void set(int which)
          Sets a bit of the status byte.
 void setStatus(int newstate)
          Sets the states of all windows.
 void up(int which)
          Raises a window and changes current state.
 
Methods inherited from class de.fhg.igd.semoa.service.AbstractService
checkDependencies, dependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

state

private byte state
The first four bits of the byte represent the windows. When a window is closed, its according bit is set. If state = 0, all bits are zero, means all windows are lowered.

Constructor Detail

WindowServiceImpl

public WindowServiceImpl()
Method Detail

author

public String author()
Description copied from class: AbstractService
Returns the name of the author of the service. The format to be used should be John Doe <jdoe@zilch.net>.

Specified by:
author in interface Service
Specified by:
author in class AbstractService
Returns:
the String with the author's name.

revision

public String revision()
Description copied from class: AbstractService
Returns the revision number of this class as a string. This class provides default implementations of methods majorVersion(), minorVersion based on the assumption that this method returns a revision string as generated by rcs(1) for the template "$Revision: 1.7 $/$Date: 2007-08-08 04:41:53 +0200 (Wed, 08 Aug 2007) $".

Specified by:
revision in class AbstractService

info

public String info()
Description copied from class: AbstractService
Returns the informative string which should describe the service's essence in a sentence.

Specified by:
info in interface Service
Specified by:
info in class AbstractService
Returns:
the String with the service's short description.

up

public void up(int which)
Raises a window and changes current state.

Specified by:
up in interface WindowService
Parameters:
which - number of the window to be opened or closed Use the constants defined in WindowService.

down

public void down(int which)
Lowers a window and changes current state.

Specified by:
down in interface WindowService
Parameters:
which - number of the window to be opened or closed Use the constants defined in WindowService.

getStatus

public byte getStatus()
Returns current state of all windows.

Specified by:
getStatus in interface WindowService
Returns:
The first four bits of the byte represent the windows. When a window is closed, its according bit is set. If state = 0, all bits are zero, means all windows are lowered

setStatus

public void setStatus(int newstate)
Sets the states of all windows. JUST FOR TESTING PURPOSES

Specified by:
setStatus in interface WindowService
Parameters:
newstate - the new state status is set to.

isLowered

public boolean isLowered(int which)
Specified by:
isLowered in interface WindowService
Returns:
true if a specific window is lowered

set

private void set(int which)
Sets a bit of the status byte.

Parameters:
which - number of the window to be opened or closed Use the constants defined in WindowService.

clear

private void clear(int which)
Clears a bit of the status byte.

Parameters:
which - number of the window to be opened or closed Use the constants defined in WindowService.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.