com.flightpanels.scs
Class CanAeroMetadata

java.lang.Object
  extended by com.flightpanels.scs.CanAeroMetadata
All Implemented Interfaces:
java.lang.Comparable<CanAeroMetadata>

public class CanAeroMetadata
extends java.lang.Object
implements java.lang.Comparable<CanAeroMetadata>

Java port of the CanAeroMetadata class of libcanaero, v1.0. Processing of information contained in the CAN Aerospace header. Primary key is the CAN Id with either 11 or 29 bits. The node id identifies the sender of normal operation data. The message code for normal operation data is incremented with every transmission. It counts from 0 to 255 and then wraps around to 0 again. When incoming data is found to have inconsistent counting, a packet loss information is reported to the Logger, the packet is processed nontheless.

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

Constructor Summary
CanAeroMetadata(long can_id, boolean id29, short node_id)
           
 
Method Summary
 boolean checkMessageCode(short new_code)
          Check if message code of incoming message is consistent, i.e.
 int compareTo(CanAeroMetadata o)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 long id()
           
 short increaseMessageCode()
           
 boolean isId29()
           
 short nodeId()
          node id of the transmitting node
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CanAeroMetadata

public CanAeroMetadata(long can_id,
                       boolean id29,
                       short node_id)
Parameters:
can_id - CAN identifier
id29 - true for 29 bit, false for 11 bit CAN id
node_id - sending node for normal operation data
Method Detail

id

public long id()
Returns:
CAN with either 11 or 29 bit. The highest bit is set when id is 29 bit, not set when 11 bit.

isId29

public boolean isId29()
Returns:
true for 29 bit, false for 11 bit.

nodeId

public short nodeId()
node id of the transmitting node


increaseMessageCode

public short increaseMessageCode()
Returns:
new message code for the next outgoing message

checkMessageCode

public boolean checkMessageCode(short new_code)
Check if message code of incoming message is consistent, i.e. it is incremented by one from the previously stored code.

Parameters:
new_code - message code received
Returns:
true for expected code, false for packet loss which has triggered a log message

compareTo

public int compareTo(CanAeroMetadata o)
Specified by:
compareTo in interface java.lang.Comparable<CanAeroMetadata>

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object