예제 #1
0
        //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)
            {
            }
        }
예제 #2
0
 /// <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));
 }
예제 #3
0
        /// <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);
        }