use of org.openmuc.jdlms.DlmsServer.TcpServerBuilder in project open-smart-grid-platform by OSGP.
the class DlmsServerConfig method dlmsServer.
@Bean
public DlmsServer dlmsServer(final OsgpServerConnectionListener osgpServerConnectionListener) throws IOException {
final DlmsServer serverConnection;
TcpServerBuilder serverBuilder = DlmsServer.tcpServerBuilder(this.port);
if (this.useHdlc) {
serverBuilder = serverBuilder.setSessionLayerFactory(ServerSessionLayerFactories.newHdlcSessionLayerFactory());
}
serverBuilder = serverBuilder.setConnectionListener(osgpServerConnectionListener);
for (final Integer logicalDeviceId : LogicalDeviceIdsConverter.convert(this.logicalDeviceIds)) {
LOGGER.info("preparing logical device {} on port {}", logicalDeviceId, this.port);
final LogicalDevice logdev = this.buildDevice(logicalDeviceId).build();
serverBuilder = serverBuilder.registerLogicalDevice(logdev).setReferencingMethod(ReferencingMethod.valueOf(this.referencingMethod.toUpperCase()));
}
serverConnection = serverBuilder.build();
return serverConnection;
}
Aggregations