use of org.openmuc.j60870.ie.IeSinglePointWithQuality 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.IeSinglePointWithQuality 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.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.
the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityInvalid.
@Test
public void testConvertIeSinglePointWithQualityInvalid() {
// Arrange
final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_INVALID);
final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, false, true);
// Act
final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
// Assert
assertThat(actual).isEqualTo(expected);
}
use of org.openmuc.j60870.ie.IeSinglePointWithQuality in project open-smart-grid-platform by OSGP.
the class IeSinglePointWithQualityConverterTest method testConvertIeSinglePointWithQualityNotTopical.
@Test
public void testConvertIeSinglePointWithQualityNotTopical() {
// Arrange
final BitmaskMeasurementElementDto expected = new BitmaskMeasurementElementDto((byte) IE_QUALITY_NOT_TOPICAL);
final IeSinglePointWithQuality source = new IeSinglePointWithQuality(false, false, false, true, false);
// Act
final BitmaskMeasurementElementDto actual = this.converter.convert(source, null, null);
// Assert
assertThat(actual).isEqualTo(expected);
}
Aggregations