Skip to content
Snippets Groups Projects
Commit 9139dfa3 authored by terry-norbraten's avatar terry-norbraten
Browse files

[Terry N.] If we use the factory to create PDUs, and we most always

should, then use it's inner timestamp in the style set at factory
instantiation time
parent d8c8f788
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,6 @@ public class PduFactory
private byte defaultExerciseId = 1;
private short defaultSiteId = 2;
private short defaultAppId = 3;
private boolean useAbsoluteTimestamp = true;
private final DisTime disTime;
private Method getTime;
......@@ -128,9 +127,12 @@ public class PduFactory
useFastPdu = tf;
}
/* ***************************************************/
/* utility methods*/
private int doTime()
/** Retrieve the current timestamp in the time stamp style set at factory
* instantiation.
* @return the current timestamp in the time stamp style set at factory
* instantiation
*/
public int getTimestamp()
{
try {
return (int) getTime.invoke(disTime, (Object[]) null);
......@@ -140,11 +142,13 @@ public class PduFactory
}
}
/* ***************************************************/
/* utility methods*/
private PduBase addBoilerPlate(PduBase pdu)
{
pdu.getPduStatus().setValue((byte) (PduStatus.AII_ACTIVE | PduStatus.CEI_COUPLED));
pdu.setExerciseID(defaultExerciseId)
.setTimestamp(doTime())
.setTimestamp(getTimestamp())
.setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class
return pdu;
......@@ -153,7 +157,7 @@ public class PduFactory
private LiveEntityFamilyPdu addBoilerPlate(LiveEntityFamilyPdu pdu)
{
pdu.setExerciseID(defaultExerciseId)
.setTimestamp(doTime())
.setTimestamp(getTimestamp())
.setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class
return pdu;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment