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 ...@@ -39,7 +39,6 @@ public class PduFactory
private byte defaultExerciseId = 1; private byte defaultExerciseId = 1;
private short defaultSiteId = 2; private short defaultSiteId = 2;
private short defaultAppId = 3; private short defaultAppId = 3;
private boolean useAbsoluteTimestamp = true;
private final DisTime disTime; private final DisTime disTime;
private Method getTime; private Method getTime;
...@@ -128,9 +127,12 @@ public class PduFactory ...@@ -128,9 +127,12 @@ public class PduFactory
useFastPdu = tf; useFastPdu = tf;
} }
/* ***************************************************/ /** Retrieve the current timestamp in the time stamp style set at factory
/* utility methods*/ * instantiation.
private int doTime() * @return the current timestamp in the time stamp style set at factory
* instantiation
*/
public int getTimestamp()
{ {
try { try {
return (int) getTime.invoke(disTime, (Object[]) null); return (int) getTime.invoke(disTime, (Object[]) null);
...@@ -140,11 +142,13 @@ public class PduFactory ...@@ -140,11 +142,13 @@ public class PduFactory
} }
} }
/* ***************************************************/
/* utility methods*/
private PduBase addBoilerPlate(PduBase pdu) private PduBase addBoilerPlate(PduBase pdu)
{ {
pdu.getPduStatus().setValue((byte) (PduStatus.AII_ACTIVE | PduStatus.CEI_COUPLED)); pdu.getPduStatus().setValue((byte) (PduStatus.AII_ACTIVE | PduStatus.CEI_COUPLED));
pdu.setExerciseID(defaultExerciseId) pdu.setExerciseID(defaultExerciseId)
.setTimestamp(doTime()) .setTimestamp(getTimestamp())
.setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class .setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class
return pdu; return pdu;
...@@ -153,7 +157,7 @@ public class PduFactory ...@@ -153,7 +157,7 @@ public class PduFactory
private LiveEntityFamilyPdu addBoilerPlate(LiveEntityFamilyPdu pdu) private LiveEntityFamilyPdu addBoilerPlate(LiveEntityFamilyPdu pdu)
{ {
pdu.setExerciseID(defaultExerciseId) pdu.setExerciseID(defaultExerciseId)
.setTimestamp(doTime()) .setTimestamp(getTimestamp())
.setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class .setLength((short) pdu.getMarshalledSize()); //todo check if should be done in Pdu class
return pdu; 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