use of com.beanit.iec61850bean.ClientAssociation in project OpenMUC by isc-konstanz.
the class Iec61850Driver method connect.
@Override
public Connection connect(String deviceAddress, String settings) throws ArgumentSyntaxException, ConnectionException {
DeviceAddress deviceAdress = new DeviceAddress(deviceAddress);
DeviceSettings deviceSettings = new DeviceSettings(settings);
ClientSap clientSap = new ClientSap();
clientSap.setTSelLocal(deviceSettings.getTSelLocal());
clientSap.setTSelLocal(deviceSettings.getTSelRemote());
ClientAssociation clientAssociation;
try {
clientAssociation = clientSap.associate(deviceAdress.getAdress(), deviceAdress.getRemotePort(), deviceSettings.getAuthentication(), null);
} catch (IOException e) {
throw new ConnectionException(e);
}
ServerModel serverModel;
try {
serverModel = clientAssociation.retrieveModel();
} catch (ServiceError e) {
clientAssociation.close();
throw new ConnectionException("Service error retrieving server model" + e.getMessage(), e);
} catch (IOException e) {
clientAssociation.close();
throw new ConnectionException("IOException retrieving server model: " + e.getMessage(), e);
}
return new Iec61850Connection(clientAssociation, serverModel);
}
Aggregations