org.mbari.siam.distributed
Class DevicePacket

java.lang.Object
  extended by org.mbari.siam.distributed.DevicePacket
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DeviceMessagePacket, MetadataPacket, NewMetadataPacket, SensorDataPacket, SensorStatusPacket, SummaryPacket

public class DevicePacket
extends java.lang.Object
implements java.io.Serializable

DevicePacket is a container for data or metadata which originates at a particular device, and forms the base of a packet class hierarchy, which includes SensorDataPacket, DeviceMessagePacket, and MetadataPacket. DevicePackets are generated by DeviceServices, written to DeviceLogs, and telemetered to shore. DevicePacket attributes include the following:

Author:
Tom O'Reilly
See Also:
SensorDataPacket, MetadataPacket, Serialized Form

Field Summary
static int ALL_TYPES
          Convenience - all packet type flags.
static int DEVICEMESSAGE_FLAG
          DeviceMessagePacket flag
static int HEADER_BYTES
          Header size - used by PacketStats and aggregator.
static int METADATA_FLAG
          MetaDataPacket flag
static int SENSORDATA_FLAG
          SensorDataPacket flag
static int SUMMARY_FLAG
          SummaryPacket flag
 
Constructor Summary
DevicePacket()
           
DevicePacket(long sourceID)
           
 
Method Summary
protected static void convertToAscii(byte[] buffer)
          Utility method used in subclass' toString() methods.
 long getParentId()
          Get parentID field
 long getRecordType()
          Get recordType field
protected static boolean isPrintable(byte c)
          Utility method; return true if byte is printable.
 long metadataRef()
          Return "metadataRef sequence number" of the packet.
 long sequenceNo()
          Return "sequence number" of the packet.
 void setMetadataRef(long sequenceNo)
          Each packet should refer to the sequence number of the last metadata packet.
 void setParentId(long id)
          Set parentID field
 void setRecordType(long type)
          Set recordType field
 void setSequenceNo(long sequenceNo)
          Set the packet sequence number.
 void setSystemTime(long systemTime)
          Set the packet "creation time"
 long sourceID()
          Return ISI ID of packet source.
 long systemTime()
          Get packet "creation time".
 java.lang.String toString()
          Return String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SENSORDATA_FLAG

public static final int SENSORDATA_FLAG
SensorDataPacket flag

See Also:
Constant Field Values

METADATA_FLAG

public static final int METADATA_FLAG
MetaDataPacket flag

See Also:
Constant Field Values

DEVICEMESSAGE_FLAG

public static final int DEVICEMESSAGE_FLAG
DeviceMessagePacket flag

See Also:
Constant Field Values

SUMMARY_FLAG

public static final int SUMMARY_FLAG
SummaryPacket flag

See Also:
Constant Field Values

ALL_TYPES

public static final int ALL_TYPES
Convenience - all packet type flags.

See Also:
Constant Field Values

HEADER_BYTES

public static final int HEADER_BYTES
Header size - used by PacketStats and aggregator. Anything application-critical code that uses this definition should verify that it matches the actual class definition and platforms. This currently represents the size (in bytes) of 6 longs.

See Also:
Constant Field Values
Constructor Detail

DevicePacket

public DevicePacket()

DevicePacket

public DevicePacket(long sourceID)
Parameters:
sourceID - unique identifier of source device
Method Detail

setSystemTime

public void setSystemTime(long systemTime)
Set the packet "creation time"


systemTime

public long systemTime()
Get packet "creation time".


sourceID

public long sourceID()
Return ISI ID of packet source.


sequenceNo

public long sequenceNo()
Return "sequence number" of the packet. Sequence number increments by 1 for each packet by the packet source ID.


metadataRef

public long metadataRef()
Return "metadataRef sequence number" of the packet. The metadataRef is the sequence number of the metadata packet which applies to this packet.


setSequenceNo

public void setSequenceNo(long sequenceNo)
Set the packet sequence number. Should be called whenever a "new" packet is generated.


setMetadataRef

public void setMetadataRef(long sequenceNo)
Each packet should refer to the sequence number of the last metadata packet. Should be called whenever a "new" packet is generated.


getParentId

public long getParentId()
Get parentID field


setParentId

public void setParentId(long id)
Set parentID field


getRecordType

public long getRecordType()
Get recordType field


setRecordType

public void setRecordType(long type)
Set recordType field


toString

public java.lang.String toString()
Return String representation.

Overrides:
toString in class java.lang.Object

isPrintable

protected static boolean isPrintable(byte c)
Utility method; return true if byte is printable.


convertToAscii

protected static void convertToAscii(byte[] buffer)
Utility method used in subclass' toString() methods.



Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.