//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) { } }
public List <SdkSensorDataDto> GetFFTSensor() { try { //List<Fft.Cams.Sdk.SdkSensorData> sensors = cams3SdkUser.GetSensors(); List <SdkSensorDataDto> camsGetFFTSensorlist = new List <SdkSensorDataDto>(); if (cams3SdkUser != null) { var camsGetFFTSensor = cams3SdkUser.GetSensors(); if (camsGetFFTSensor != null) { foreach (var _sensor in camsGetFFTSensor) { 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 }; camsGetFFTSensorlist.Add(_SdkSensorDataDto); } return(camsGetFFTSensorlist); } } } catch (Exception ex) { } return(null); }
//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) { } }