Exemple #1
0
        protected override void ProcessReceiveData(IMonitorSystemContext context, IProcessor processor, string data)
        {
            if (data.StartsWith("<MonitorAlarm>"))
            {
                IVisionAlarm alarm = new CVisionAlarm(this, data);

                this.PostAlarmEvent(alarm);
            }
            else
            {
                base.ProcessReceiveData(context, processor, data);
            }
        }
Exemple #2
0
        protected override void OnMessageCallback(string id, string sender, IntPtr message)
        {
            DateTime CurAlarmTime = DateTime.Now;

            if (message != IntPtr.Zero)
            {
                try
                {
                    if (this.CheckAlarmInterval(CurAlarmTime))
                    {
                        CVisionEvent msg = (CVisionEvent)Marshal.PtrToStructure(message, typeof(CVisionEvent));

                        //if (msg.eventType == 0)
                        //{
                        //    System.Console.Out.WriteLine("EventType=" + msg.eventType + ", AlertOpt=" + msg.alertOpt);
                        //    return;
                        //}

                        CVisionAlarm alarm = new CVisionAlarm(this);

                        alarm.ID         = id;
                        alarm.Sender     = sender;
                        alarm.Desc       = Config.Desc;
                        alarm.EventType  = (TVisionEventType)msg.eventType;
                        alarm.GuardLevel = (TGuardLevel)msg.guardLevel;
                        alarm.AreaIndex  = msg.areaIndex;
                        alarm.AreaType   = (TAreaType)msg.areaType;
                        alarm.AlertOpt   = (TAlertOpt)msg.alertOpt;
                        alarm.AlarmTime  = CurAlarmTime;
                        alarm.AlarmImage = ImageUtil.IplImageToBitmap(msg.image);

                        CLocalSystem.WriteInfoLog(string.Format("CBlobTracker.OnMessageCallback AlertOpt:{0}", (TAlertOpt)msg.alertOpt));

                        this.PostAlarmEvent(alarm);
                    }
                }
                catch (Exception e)
                {
                    CLocalSystem.WriteErrorLog(string.Format("CBlobTracker.OnMessageCallback Exception:{0}", e));
                }
            }
        }