use of org.openmuc.j60870.ie.IeTime56 in project open-smart-grid-platform by OSGP.
the class IeTime56ConverterTest method shouldConvertIeTime56ToTimestamp.
@Test
public void shouldConvertIeTime56ToTimestamp() {
// Arrange
final long timestamp = ZonedDateTime.now(ZoneOffset.UTC).toInstant().toEpochMilli();
final TimestampMeasurementElementDto expected = new TimestampMeasurementElementDto(timestamp);
final IeTime56 source = new IeTime56(timestamp, this.timeZone, false);
// Act
final TimestampMeasurementElementDto actual = this.converter.convert(source, null, null);
// Assert
assertThat(actual).isEqualTo(expected);
}
use of org.openmuc.j60870.ie.IeTime56 in project open-smart-grid-platform by OSGP.
the class LightMeasurementDeviceAsduFactory method createInformationElementWithTimetag.
private InformationElement[][] createInformationElementWithTimetag(final boolean value, final long timestamp) {
final TimeZone timeZone = TimeZone.getTimeZone(this.timeZoneString);
final boolean invalid = false;
return new InformationElement[][] { { new IeSinglePointWithQuality(value, false, false, false, false), new IeTime56(timestamp, timeZone, invalid) } };
}
use of org.openmuc.j60870.ie.IeTime56 in project open-smart-grid-platform by OSGP.
the class AsduSteps method aLightMeasurementOccursForAddress.
@When("a light measurement event occurs for address {int} with value {string}")
public void aLightMeasurementOccursForAddress(final int informationObjectAddress, final String informationElementValue) {
final boolean on = "ON".equalsIgnoreCase(informationElementValue);
final InformationObject[] informationObjects = { new InformationObject(informationObjectAddress, new IeSinglePointWithQuality(on, false, false, false, false), new IeTime56(System.currentTimeMillis(), TimeZone.getDefault(), false)) };
final ASdu asdu = new ASdu(ASduType.M_SP_TB_1, false, CauseOfTransmission.SPONTANEOUS, false, false, 0, 1, informationObjects);
this.connectionSteps.getConnectionEventListener().newASdu(asdu);
}
use of org.openmuc.j60870.ie.IeTime56 in project open-smart-grid-platform by OSGP.
the class Iec60870Server method addTimestamp.
private static InformationElement[][] addTimestamp(final InformationElement[][] informationElements) {
final InformationElement[][] result = Arrays.copyOf(informationElements, 2);
result[1] = new InformationElement[] { new IeTime56(System.currentTimeMillis()) };
return result;
}
Aggregations