//5 public void FFTTransactionServiceCreateAlertZoneEx(long eventId, DateTime eventTimeUtc, bool acknowledged, bool active, bool dynamic, SdkCtrlData ctrl, SdkSensorData sensor, SdkZoneData zone, SdkLocationInfo location, string classification, int classConfidenceIndex, string strAlertType) { try { SdkCtrlDataDto _SdkCtrlData = null; if (ctrl != null) { _SdkCtrlData = new SdkCtrlDataDto { Connected = ctrl.Connected, Description = ctrl.Description, HostName = ctrl.HostName, Id = ctrl.Id, IpAddress = ctrl.IpAddress, Locator = ctrl.Locator, Name = ctrl.Name, Port = ctrl.Port }; } List <CoordinateDto> _DrawingPoints = new List <CoordinateDto>(); foreach (var _cor in sensor.DrawingPoints) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = _cor.Alt, IsEmpty = _cor.IsEmpty, Lat = _cor.Lat, Long = _cor.Long }; _DrawingPoints.Add(_CoordinateDto); } List <SensorPointDto> _SensorPoints = new List <SensorPointDto>(); foreach (var _cor in sensor.SensorPoints) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = _cor.coordinate.Alt, IsEmpty = _cor.coordinate.IsEmpty, Lat = _cor.coordinate.Lat, Long = _cor.coordinate.Long }; SensorPointDto _SensorPointDto = new SensorPointDto { cableDistance = _cor.cableDistance, calibrationPoint = _cor.calibrationPoint, calibrationPointName = _cor.calibrationPointName, coordinate = _CoordinateDto, id = _cor.id, perimeterDistance = _cor.perimeterDistance, seq = _cor.seq }; _SensorPoints.Add(_SensorPointDto); } SdkSensorDataDto _SdkSensorDataDto = new SdkSensorDataDto { ControllerId = sensor.ControllerId, DrawingPoints = _DrawingPoints, Id = sensor.Id, Name = sensor.Name, Number = sensor.Number, SensorPoints = _SensorPoints }; List <SensorSectionDto> _SensorSections = new List <SensorSectionDto>(); foreach (var __SensorSections in zone.SensorSections) { List <CoordinateDto> Points = new List <CoordinateDto>(); foreach (var _cord in __SensorSections.Points) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = _cord.Alt, IsEmpty = _cord.IsEmpty, Lat = _cord.Lat, Long = _cord.Long }; Points.Add(_CoordinateDto); } SensorSectionDto _SensorSectionDto = new SensorSectionDto { CableEnd = __SensorSections.CableEnd, CableStart = __SensorSections.CableStart, Opposite = __SensorSections.Opposite, PerimeterEnd = __SensorSections.PerimeterEnd, PerimeterStart = __SensorSections.PerimeterStart, Points = Points, Reversed = __SensorSections.Reversed, SectionId = __SensorSections.SectionId, SensorEndIdx = __SensorSections.SensorEndIdx, SensorId = __SensorSections.SensorId, SensorStartIdx = __SensorSections.SensorStartIdx, ServerId = __SensorSections.ServerId }; _SensorSections.Add(_SensorSectionDto); } SdkZoneDataDTO _SdkZoneDataDTO = new SdkZoneDataDTO { Isolated = zone.Isolated, Description = zone.Description, Id = zone.Id, Name = zone.Name, SensorSections = _SensorSections }; CoordinateDto _CoordinateDtoinfo = new CoordinateDto { Alt = location.Location.Alt, IsEmpty = location.Location.IsEmpty, Lat = location.Location.Lat, Long = location.Location.Long }; SdkLocationInfoDto _location = new SdkLocationInfoDto { CableDistance = location.CableDistance, Location = _CoordinateDtoinfo, LocationWeight = location.LocationWeight, LocationWeightThreshold = location.LocationWeightThreshold, PerimeterDistance = location.PerimeterDistance }; //SdkCtrlData _SdkCtrlData, SdkSensorData _SdkSensorDataDto, SdkZoneData _SdkZoneDataDTO, SdkLocationInfo _location // string classification, int classConfidenceIndex, string strAlertType FFTCreateAlarmParamDto _FFTCreateAlarmParamDto = new FFTCreateAlarmParamDto { acknowledged = acknowledged, alarmId = eventId, alarmTimeUtc = eventTimeUtc.ToString(), ctrl = _SdkCtrlData, location = _location, sensor = _SdkSensorDataDto, zone = _SdkZoneDataDTO, classification = classification, strAlertType = strAlertType, functiontype = "ZoneAlert" }; //call json PushDataToFFTTxnService(_FFTCreateAlarmParamDto); } catch (Exception ex) { } }
/// <summary> /// As more FOSS alarms are received for an event, the event details (such as location) are updated. /// </summary> /// <param name="eventId"></param> /// <param name="lastUpdateUtc"></param> /// <param name="ctrl"></param> /// <param name="sensor"></param> /// <param name="location"></param> public override void ZoneEventUpdate(long eventId, DateTime lastUpdateUtc, SdkCtrlData ctrl, SdkSensorData sensor, SdkLocationInfo location) { //form.AddText(eventId.ToString() + " - Zone Event Update, Time: " + lastUpdateUtc.ToLocalTime().ToString() + ", Location: " + location.Location.ToString(LatLongFormat.DecimalDegrees)); }
/// <summary> /// Called when the FFT CAMS 3 Server is in event mode. This aggregates multiple FOSS alarms into a single event if the alarms /// occur in close proximity on the sensor within a narrow timespan. /// </summary> /// <param name="eventId"></param> /// <param name="eventTimeUtc"></param> /// <param name="acknowledged"></param> /// <param name="active"></param> /// <param name="dynamic"></param> /// <param name="ctrl"></param> /// <param name="sensor"></param> /// <param name="zone"></param> /// <param name="location"></param> /// <param name="classification"></param> /// <param name="classConfidenceIndex"></param> public override void ZoneEventEx(long eventId, DateTime eventTimeUtc, bool acknowledged, bool active, bool dynamic, SdkCtrlData ctrl, SdkSensorData sensor, SdkZoneData zone, SdkLocationInfo location, string classification, int classConfidenceIndex) { System.Threading.Tasks.Task.Run(() => FFTTransactionServiceCreateAlertZoneEx(eventId, eventTimeUtc, acknowledged, active, dynamic, ctrl, sensor, zone, location, classification, classConfidenceIndex, "FFT Zone Alert")); //form.AddText(eventId.ToString() + " - <" + zone.Name + "> - Zone Event Ex at: " + location.Location.ToString(LatLongFormat.DecimalDegrees) + " Perimeter Distance: " + location.PerimeterDistance + "m. Cable Distance: " + location.CableDistance + "m." + " class: \"" + classification + "\", Background Noise Level: " + classConfidenceIndex); }
public void FFTTransactionServiceCreateAlert(long alarmId, DateTime alarmTimeUtc, SdkAlarmType alarmType, bool acknowledged, SdkCtrlData ctrlData, string strAlertType)//3 { try { SdkAlarmTypeDto _SdkAlarmTypeDto = null; if (alarmType != null) { _SdkAlarmTypeDto = new SdkAlarmTypeDto { Category = alarmType.Category, Id = alarmType.Id, Name = alarmType.Name, Severity = alarmType.Severity, Type = alarmType.Type }; } SdkCtrlDataDto _SdkCtrlData = null; if (ctrlData != null) { _SdkCtrlData = new SdkCtrlDataDto { Connected = ctrlData.Connected, Description = ctrlData.Description, HostName = ctrlData.HostName, Id = ctrlData.Id, IpAddress = ctrlData.IpAddress, Locator = ctrlData.Locator, Name = ctrlData.Name, Port = ctrlData.Port }; } //FFTTransactionServiceCreateAlert(alarmId, alarmTimeUtc, acknowledged, false, false, ctrlData, null, null, null, null, 0, "FFT SystemAlert", alarmType)); // SdkAlarmType alarmType, SdkCtrlData ctrlData,string strAlertType FFTCreateAlarmParamDto _FFTCreateAlarmParamDto = new FFTCreateAlarmParamDto { acknowledged = acknowledged, alarmId = alarmId, alarmTimeUtc = alarmTimeUtc.ToString(), alarmType = _SdkAlarmTypeDto, ctrl = _SdkCtrlData, strAlertType = strAlertType, functiontype = "SystemAlert" }; //call json function PushDataToFFTTxnService(_FFTCreateAlarmParamDto); } catch (Exception ex) { } }
/// <summary> /// Called when one of the following system alarm occurs: /// 1) FOSS Shutdown /// 2) SOP Degraded /// 3) FOSS Degraded /// 4) Locator Fault /// </summary> /// <param name="alarmId"></param> /// <param name="alarmTimeUtc"></param> /// <param name="alarmType"></param> /// <param name="acknowledged"></param> /// <param name="ctrlData"></param> public override void SystemAlarmEx(long alarmId, DateTime alarmTimeUtc, SdkAlarmType alarmType, bool acknowledged, SdkCtrlData ctrlData) { //form.AddText(alarmId.ToString() + " - [" + alarmType.Name + "] - System Alarm"); System.Threading.Tasks.Task.Run(() => FFTTransactionServiceCreateAlert(alarmId, alarmTimeUtc, alarmType, acknowledged, ctrlData, "FFT SystemAlert")); }
//2 public void FFTTransactionServiceCreateSensorAlert(long alarmId, DateTime alarmTimeUtc, SdkAlarmType alarmType, bool acknowledged, SdkCtrlData ctrl, List <SdkSensorData> sensors, bool isValidLocation, SdkLocationInfo location, bool isOTDR, string strAlert) { try { SdkAlarmTypeDto _SdkAlarmTypeDto = new SdkAlarmTypeDto { Category = alarmType.Category, Id = alarmType.Id, Name = alarmType.Name, Severity = alarmType.Severity, Type = alarmType.Type }; SdkCtrlDataDto _SdkCtrlData = new SdkCtrlDataDto { Connected = ctrl.Connected, Description = ctrl.Description, HostName = ctrl.HostName, Id = ctrl.Id, IpAddress = ctrl.IpAddress, Locator = ctrl.Locator, Name = ctrl.Name, Port = ctrl.Port }; List <SdkSensorDataDto> _sensors = new List <SdkSensorDataDto>(); if (sensors != null) { try { foreach (var _sen in sensors) { List <CoordinateDto> _DrawingPoints = new List <CoordinateDto>(); foreach (var _cor in _sen.DrawingPoints) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = _cor.Alt, IsEmpty = _cor.IsEmpty, Lat = _cor.Lat, Long = _cor.Long }; _DrawingPoints.Add(_CoordinateDto); } List <SensorPointDto> _SensorPoints = new List <SensorPointDto>(); foreach (var _cor in _sen.SensorPoints) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = _cor.coordinate.Alt, IsEmpty = _cor.coordinate.IsEmpty, Lat = _cor.coordinate.Lat, Long = _cor.coordinate.Long }; SensorPointDto _SensorPointDto = new SensorPointDto { cableDistance = _cor.cableDistance, calibrationPoint = _cor.calibrationPoint, calibrationPointName = _cor.calibrationPointName, coordinate = _CoordinateDto, id = _cor.id, perimeterDistance = _cor.perimeterDistance, seq = _cor.seq }; _SensorPoints.Add(_SensorPointDto); } SdkSensorDataDto _SdkSensorDataDto = new SdkSensorDataDto { ControllerId = _sen.ControllerId, DrawingPoints = _DrawingPoints, Id = _sen.Id, Name = _sen.Name, Number = _sen.Number, SensorPoints = _SensorPoints }; _sensors.Add(_SdkSensorDataDto); } } catch (Exception ex) { } } SdkLocationInfoDto _location = null; if (location != null) { CoordinateDto _CoordinateDto = new CoordinateDto { Alt = location.Location.Alt, IsEmpty = location.Location.IsEmpty, Lat = location.Location.Lat, Long = location.Location.Long }; _location = new SdkLocationInfoDto { CableDistance = location.CableDistance, Location = _CoordinateDto, LocationWeight = location.LocationWeight, LocationWeightThreshold = location.LocationWeightThreshold, PerimeterDistance = location.PerimeterDistance }; } //_SdkAlarmTypeDto, _SdkCtrlData ,_sensors , SdkLocationInfo location FFTCreateAlarmParamDto _FFTCreateAlarmParamDto = new FFTCreateAlarmParamDto { acknowledged = acknowledged, alarmId = alarmId, alarmTimeUtc = alarmTimeUtc.ToString(), alarmType = _SdkAlarmTypeDto, ctrl = _SdkCtrlData, isOTDR = isOTDR, isValidLocation = isValidLocation, location = _location, sensors = _sensors, strAlertType = strAlert, functiontype = "SensorAlert" }; //call json method here PushDataToFFTTxnService(_FFTCreateAlarmParamDto); } catch (Exception ex) { } }
/// <summary> /// Called when one of the following sensor alarm occurs: /// 1) Fibre Break /// 2) Optical Power Degraded /// 3) Laser Temperature Warning /// 4) Laser Shutdown /// 5) Laser Off /// /// </summary> /// <param name="alarmId"></param> /// <param name="alarmTimeUtc"></param> /// <param name="alarmType"></param> /// <param name="acknowledged"></param> /// <param name="ctrl"></param> /// <param name="sensors"></param> /// <param name="isValidLocation"></param> /// <param name="location"></param> /// <param name="isOTDR"></param> public override void SensorAlarmEx2(long alarmId, DateTime alarmTimeUtc, SdkAlarmType alarmType, bool acknowledged, SdkCtrlData ctrl, List <SdkSensorData> sensors, bool isValidLocation, SdkLocationInfo location, bool isOTDR) { string locationStr = String.Empty; if (location != null) { locationStr = location.Location.ToString(); } System.Threading.Tasks.Task.Run(() => FFTTransactionServiceCreateSensorAlert(alarmId, alarmTimeUtc, alarmType, acknowledged, ctrl, sensors, isValidLocation, location, isOTDR, "FFT Sensor Alert")); //form.AddText(alarmId.ToString() + " - [" + alarmType.Name + "] - Sensor Alarm Ex2 " + locationStr); }