use of com.alliander.osgp.adapter.protocol.iec61850.infra.networking.services.commands.Iec61850SetGpsCoordinatesCommand in project Protocol-Adapter-IEC61850 by OSGP.
the class DeviceRegistrationService method setLocationInformation.
/**
* Set the location information for this device. If the osgp_core database
* contains longitude and latitude information for the given device, those
* values must be saved to the corresponding data-attributes.
*/
protected void setLocationInformation(final DeviceConnection deviceConnection) {
final Ssld ssld = DeviceRegistrationService.this.ssldDataRepository.findByDeviceIdentification(deviceConnection.getDeviceIdentification());
if (ssld != null) {
final Float longitude = ssld.getGpsLongitude();
final Float latitude = ssld.getGpsLatitude();
LOGGER.info("Ssld found for device: {} longitude: {}, latitude: {}", deviceConnection.getDeviceIdentification(), longitude, latitude);
if (longitude != null && latitude != null) {
try {
new Iec61850SetGpsCoordinatesCommand().setGpsCoordinates(deviceConnection, longitude, latitude);
} catch (final NodeWriteException e) {
LOGGER.error("Unable to set location information for device: " + deviceConnection.getDeviceIdentification(), e);
}
}
}
}
Aggregations