com.flightpanels.scs
Class DataReference<T>

java.lang.Object
  extended by com.flightpanels.scs.DataReference<T>
All Implemented Interfaces:
IDataReference
Direct Known Subclasses:
DataReferenceBool, DataReferenceDouble, DataReferenceFloat, DataReferenceFloatVector, DataReferenceInt, DataReferenceString

public abstract class DataReference<T>
extends java.lang.Object
implements IDataReference

Java port of the DataReference class template of libcanaero, v1.0.

Version:
1.0
Author:
(c) 2008-2010 by Philipp Münzel, Technische Universität Darmstadt, Department of Mathematics

Constructor Summary
DataReference(IUpdateable<T> updateable)
           
 
Method Summary
 boolean hasChanged()
           
 boolean needsRequest()
           
abstract  void readFromCan(CanAeroMetadata meta, can_t can)
          read incoming data from the bus into the cache
 void requested()
          data was requested, reset the internal timeout
 void signUp(IUpdateable ref)
          Geez, where is my little brown Java barf bag?
 void update()
          Update all the associated IUpdateables with the value that was last received
 can_t write(CanAeroMetadata meta, java.lang.Object value)
          Write data to can-object that can be send to the bus
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DataReference

public DataReference(IUpdateable<T> updateable)
Parameters:
updateable - the instance that should be notified if the value changed
Method Detail

signUp

public void signUp(IUpdateable ref)
Geez, where is my little brown Java barf bag?

Specified by:
signUp in interface IDataReference
Parameters:
ref - Another time to search for the little brown Java Barf Bag.
See Also:
IDataReference.signUp(com.flightpanels.scs.IUpdateable)

hasChanged

public boolean hasChanged()
Specified by:
hasChanged in interface IDataReference
Returns:
has the last reception changed the value in the cache?

needsRequest

public boolean needsRequest()
Specified by:
needsRequest in interface IDataReference
Returns:
is the time elapsed since the last recption so long we should issue another request?

readFromCan

public abstract void readFromCan(CanAeroMetadata meta,
                                 can_t can)
Description copied from interface: IDataReference
read incoming data from the bus into the cache

Specified by:
readFromCan in interface IDataReference
Parameters:
meta - accompanying meta-data (id, message code counter etc..)
can - the incoming data itself

requested

public void requested()
Description copied from interface: IDataReference
data was requested, reset the internal timeout

Specified by:
requested in interface IDataReference

update

public void update()
Description copied from interface: IDataReference
Update all the associated IUpdateables with the value that was last received

Specified by:
update in interface IDataReference

write

public can_t write(CanAeroMetadata meta,
                   java.lang.Object value)
Description copied from interface: IDataReference
Write data to can-object that can be send to the bus

Specified by:
write in interface IDataReference
Parameters:
meta - accompanying meta-data (id, message code counter etc..)
value - the value that should be written
Returns:
the can structure as expected by the participants on the bus