Package org.ka2ddo.opentrac
Class OpenTracMessage
java.lang.Object
org.ka2ddo.ax25.AX25Message
org.ka2ddo.opentrac.OpenTracMessage
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<AX25Message>
,Iterable<OpenTracEntity>
,AX25FrameSource
,SendableMessage
public class OpenTracMessage
extends AX25Message
implements AX25FrameSource, SendableMessage, Iterable<OpenTracEntity>
Outer layer of a generic OpenTRAC protocol message, containing entities and attributes of each entity.
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.ka2ddo.ax25.AX25Message
AX25Message.Precedence
-
Field Summary
Modifier and TypeFieldDescriptionList of OpenTracEntity objects wrapped in this OpenTracMessage.Fields inherited from class org.ka2ddo.ax25.AX25Message
APRS_AND_OPENTRAC, ax25Frame, extensions, invalid, originatingCallsign, originatingDest, PERMANENT, rcptTime, thirdParty, timestamp, UTC
Fields inherited from interface org.ka2ddo.ax25.AX25FrameSource
NO_FRAMES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
appendEntity
(OpenTracEntity entity) Add another entity of data to this message.protected boolean
bodyEquals
(AX25Message other) Compare the contents of the body of the message, reporting if they match.int
computeBody
(byte[] buf, int offset) Convert an OpenTRAC message into a properly encoded byte array..void
Specify that message should no longer be transmitted.byte[]
getBody
(boolean countTransmission, ProtocolFamily protocolId, AX25Frame frame) Get an instance of this message, suitable for transmitting.Specify the Connector this message should be transmitted through.Find the OpenTracEntity within this OpenTracMessage matching the specified identification.getFrames
(boolean incrementXmtCount, ProtocolFamily protocolId, String senderCallsign) Get an AX25Frame of the data to transmit.getMatchingElement
(int type) Get the first element of the specified OpenTrac element ID on any entity in this message.int
Get the number of cycles for a complete iteration over the proportional pathing digipeat path set.Report the traffic-handling precedence for this message instance.Get the protocol family or families that this message corresponds to, so ports that don't support all protocols will not forward inappropriate packets.boolean
Report if this AX25Message contains position data.boolean
Report if this OpenTracMessage contains weather information.boolean
Test if message should still be transmitted.boolean
Test if every entity in this message has been properly addressed.iterator()
Returns an iterator over a set of elements of type OpenTracEntity.Descriptive text about this message, to be included in the toString() method's response.toString()
Returns a string representation of the object.Methods inherited from class org.ka2ddo.ax25.AX25Message
compareTo, dup, equals, extractSource, getAx25Frame, getExtension, getFirstDigipeat, getLastDigipeat, getNthDigipeat, getOriginalDestination, getOriginalSource, getOriginatingCallsign, getOriginatingDest, getRcptTime, getReadOnlyExtensionMap, getTimestamp, hashCode, hasThisFirstDigi, indexOf, indexOf, isDirect, isInvalid, isRf, onlyDigits, onlyDigits, onlyDigitsOrMinus, onlyDigitsOrPeriod, onlyDigitsOrSpace, onlyDigitsPlus, onlyPeriods, setAx25Frame, setInvalid, setOriginatingCallsign, setRcptTime, setTimestamp, split, storeExtension
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
Methods inherited from interface org.ka2ddo.ax25.SendableMessage
dup
-
Field Details
-
entities
List of OpenTracEntity objects wrapped in this OpenTracMessage.
-
-
Constructor Details
-
OpenTracMessage
public OpenTracMessage()
-
-
Method Details
-
computeBody
public int computeBody(byte[] buf, int offset) Convert an OpenTRAC message into a properly encoded byte array..- Parameters:
buf
- byte array containing a transmission-format OpenTRAC messageoffset
- starting position in array that the message begins at- Returns:
- position in array after the decoded message
-
paramString
Descriptive text about this message, to be included in the toString() method's response.- Overrides:
paramString
in classAX25Message
- Returns:
- String describing the contents of this message
- See Also:
-
toString
Returns a string representation of the object.- Overrides:
toString
in classAX25Message
- Returns:
- a string representation of the object.
-
getMatchingElement
Get the first element of the specified OpenTrac element ID on any entity in this message.- Parameters:
type
- OpenTRAC element ID- Returns:
- OpenTracElement of the specified type ID, or null if no matching element on any entity in this message
-
appendEntity
Add another entity of data to this message.- Parameters:
entity
- OpenTracEntity to append to this message
-
getFrames
public AX25Frame[] getFrames(boolean incrementXmtCount, ProtocolFamily protocolId, String senderCallsign) Get an AX25Frame of the data to transmit.- Specified by:
getFrames
in interfaceAX25FrameSource
- Parameters:
incrementXmtCount
- indicate whether the transmit counter (used to cycle through proportional pathing) should be incrementedprotocolId
- AX.25 protocol to format message insenderCallsign
- String of local callsign sending this message (may be ignored if digipeating a message from another station)- Returns:
- AX25Frame to transmit, or null indicating nothing to transmit
-
getBody
Get an instance of this message, suitable for transmitting.- Specified by:
getBody
in interfaceSendableMessage
- Parameters:
countTransmission
- number of times the message has been transmittedprotocolId
- ProtocolFamily to generate the message inframe
- AX25Frame into which the message will be placed, so any alternate AX25Message can be linked to it- Returns:
- byte array of message
- See Also:
-
isEnabled
public boolean isEnabled()Test if message should still be transmitted.- Specified by:
isEnabled
in interfaceSendableMessage
- Returns:
- boolean true if message should still be transmitted
-
disableForTransmit
public void disableForTransmit()Specify that message should no longer be transmitted.- Specified by:
disableForTransmit
in interfaceSendableMessage
-
hasWeather
public boolean hasWeather()Report if this OpenTracMessage contains weather information.- Specified by:
hasWeather
in classAX25Message
- Returns:
- boolean true if weather information in this Message
-
isEveryEntityAddressed
public boolean isEveryEntityAddressed()Test if every entity in this message has been properly addressed. Locally-generated entities can be left unaddressed until transmit time, so the correct originating callsign for the transmitting port can be filled in.- Returns:
- boolean true if entity has an originator's address (callsign-SSID)
-
hasPosition
public boolean hasPosition()Report if this AX25Message contains position data.- Overrides:
hasPosition
in classAX25Message
- Returns:
- boolean true if message contains position information
-
getPrecedence
Report the traffic-handling precedence for this message instance.- Overrides:
getPrecedence
in classAX25Message
- Returns:
- Precedence level for this AX25Message
-
getNumTransmitsBeforeDecay
public int getNumTransmitsBeforeDecay()Get the number of cycles for a complete iteration over the proportional pathing digipeat path set.- Specified by:
getNumTransmitsBeforeDecay
in interfaceAX25FrameSource
- Returns:
- number of transmissions to do one cycle of proportional pathing (value is 2^(N-1) where N is number of path choices)
-
getConnector
Specify the Connector this message should be transmitted through.- Specified by:
getConnector
in interfaceAX25FrameSource
- Returns:
- a specific Connector instance to transmit through, or null for all applicable ports (Connector.CAP_XMT_PACKET_DATA and not rejecting this specific packet [such as IGateConnectors shouldn't re-transmit something received from the IGate])
- See Also:
-
iterator
Returns an iterator over a set of elements of type OpenTracEntity.- Specified by:
iterator
in interfaceIterable<OpenTracEntity>
- Returns:
- an Iterator.
-
getEntity
Find the OpenTracEntity within this OpenTracMessage matching the specified identification.- Parameters:
callsign
- String callsign of entityssid
- int SSID of entityextensionId
- short extension ID of entity- Returns:
- matching OpenTracEntity or null if no match
-
bodyEquals
Compare the contents of the body of the message, reporting if they match.- Specified by:
bodyEquals
in classAX25Message
- Parameters:
other
- another AX25Message to compare against- Returns:
- boolean true if the body values are equivalent
-
getProtocols
Get the protocol family or families that this message corresponds to, so ports that don't support all protocols will not forward inappropriate packets.- Overrides:
getProtocols
in classAX25Message
- Returns:
- array of supported ProtocolFamily enums
-