use of org.opensmartgridplatform.dto.valueobjects.RelayMatrixDto in project open-smart-grid-platform by OSGP.
the class RelayMatrixConverter method convertFrom.
@Override
public RelayMatrixDto convertFrom(final org.opensmartgridplatform.oslp.Oslp.RelayMatrix source, final Type<RelayMatrixDto> destinationType, final MappingContext context) {
final Integer masterRelayIndex = this.mapperFacade.map(source.getMasterRelayIndex(), Integer.class);
final boolean isMasterRelayOn = source.getMasterRelayOn();
final List<Integer> indicesOfControlledRelaysOn = this.convertByteStringToListOfIntegers(source.getIndicesOfControlledRelaysOn());
final List<Integer> indicesOfControlledRelaysOff = this.convertByteStringToListOfIntegers(source.getIndicesOfControlledRelaysOff());
final RelayMatrixDto relayMatrix = new RelayMatrixDto(masterRelayIndex, isMasterRelayOn);
relayMatrix.setIndicesOfControlledRelaysOn(indicesOfControlledRelaysOn);
relayMatrix.setIndicesOfControlledRelaysOff(indicesOfControlledRelaysOff);
return relayMatrix;
}
use of org.opensmartgridplatform.dto.valueobjects.RelayMatrixDto in project open-smart-grid-platform by OSGP.
the class DomainCoreMapperTest method aConfigurationDto.
private ConfigurationDto aConfigurationDto() {
final ConfigurationDto source = new ConfigurationDto.Builder().withLightType(this.aLightTypeDto()).withDaliConfiguration(this.aDaliConfigurationDto()).withRelayConfiguration(this.aRelayConfigurationDto()).withPreferredLinkType(LinkTypeDto.CDMA).build();
source.setTimeSyncFrequency(133);
source.setDeviceFixedIp(new DeviceFixedIpDto("ipAddress1", "netMask1", "gateWay1"));
source.setDhcpEnabled(true);
source.setTlsEnabled(true);
source.setTlsPortNumber(134);
source.setCommonNameString("commonNameString1");
source.setCommunicationTimeout(135);
source.setCommunicationNumberOfRetries(136);
source.setCommunicationPauseTimeBetweenConnectionTrials(137);
source.setOsgpIpAddress("osgpIpAddress1");
source.setOsgpPortNumber(138);
source.setNtpHost("ntpHost1");
source.setNtpEnabled(true);
source.setNtpSyncInterval(139);
source.setTestButtonEnabled(true);
source.setAutomaticSummerTimingEnabled(true);
source.setAstroGateSunRiseOffset(140);
source.setAstroGateSunSetOffset(141);
source.setSwitchingDelays(asList(142, 143));
source.setRelayLinking(asList(new RelayMatrixDto(144, true), new RelayMatrixDto(145, false)));
source.setRelayRefreshing(true);
source.setSummerTimeDetails(new DateTime(146L * 24 * 60 * 60 * 1000));
source.setWinterTimeDetails(new DateTime(147L * 24 * 60 * 60 * 1000));
return source;
}
Aggregations