examples.carcontrol
Class DoorServiceImpl

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

public class DoorServiceImpl
extends AbstractService
implements DoorService

Author:
Daniel Bachmann This simple service is expected by @link DoorAgent and observes the status of doors in the car

Field Summary
static String DESCR
          The descriptor of the general options.
private  byte state
           
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Fields inherited from interface examples.carcontrol.DoorService
LEFT_BACK, LEFT_FRONT, PUBLISH_KEY, REAR, RIGHT_BACK, RIGHT_FRONT
 
Constructor Summary
DoorServiceImpl()
           
 
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.
 byte getStatus()
          Returns current state, means the current position of all doors
 String info()
          Returns the informative string which should describe the service's essence in a sentence.
 boolean isOpen(int which)
          Returns true if door is open
static void main(String[] argv)
          Main method to control the door status via service access.
 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 doors.
 String toString()
          Returns the current status of the doors as string.
 
Methods inherited from class de.fhg.igd.semoa.service.AbstractService
checkDependencies, dependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DESCR

public static final String DESCR
The descriptor of the general options. Further option descriptors will be created dynamically based on the class that shall be configured.

See Also:
Constant Field Values

state

private byte state
Constructor Detail

DoorServiceImpl

public DoorServiceImpl()
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.

getStatus

public byte getStatus()
Returns current state, means the current position of all doors

Specified by:
getStatus in interface DoorService
Returns:
current state representing door position

setStatus

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

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

isOpen

public boolean isOpen(int which)
Returns true if door is open

Specified by:
isOpen in interface DoorService
Parameters:
which - number of the door to be checked. Use the constants defined in DoorService.
Returns:
true is door is open

set

private void set(int which)
Sets a bit of the status byte. If bit is set, door is closed

Parameters:
which - number of the door to be checked. Use the constants defined in DoorService.

clear

private void clear(int which)
Clears a bit of the status byte. If bit is cleared, door is open

Parameters:
which - number of the door to be checked. Use the constants defined in DoorService.

toString

public String toString()
Returns the current status of the doors as string.

Overrides:
toString in class AbstractService
Returns:
the current status of the doors as string.

main

public static void main(String[] argv)
                 throws Exception
Main method to control the door status via service access.

Parameters:
argv -
Throws:
Exception


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.