Ejemplo n.º 1
0
        public MapSelectForm()
        {
            InitializeComponent();

            treeView1.Nodes.Clear();
            _selectedNode = treeView1.Nodes.Add("", "Top");

            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _client = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                //System.Threading.Thread.Sleep(500);
                bool x = _client.IsConnected;
                _msgObject = _client.RegisterCommunicationFilter(MapResponseHandler,
                                                                 new CommunicationIdFilter(MessageId.Server.GetMapResponse));

                MapRequestData data = new MapRequestData()
                {
                    MapGuid = "",
                };
                _client.TransmitMessage(new VideoOS.Platform.Messaging.Message(MessageId.Server.GetMapRequest, data),
                                        null, null, null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Map Select issue:" + ex.Message);
            }
        }
        public override void Init()
        {
            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);
                _obj1 = _messageCommunication.RegisterCommunicationFilter(WhoAreOnlineResponseHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.WhoAreOnlineResponse));
                _obj2 = _messageCommunication.RegisterCommunicationFilter(NewEndPointHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.NewEndPointIndication));
                _obj3 = _messageCommunication.RegisterCommunicationFilter(EndPointTableChangedHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.EndPointTableChangedIndication));
                _obj4 = _messageCommunication.RegisterCommunicationFilter(ChatLineHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageIdChatLine));

                LoginSettings ls = LoginSettingsCache.GetLoginSettings(EnvironmentManager.Instance.MasterSite);
                _myName = ls.UserName;
                if (_myName.Contains("\\"))
                {
                    _myName = _myName.Split('\\')[1];
                }
                if (_messageCommunication.IsConnected)
                {
                    _messageCommunication.TransmitMessage(
                        new VideoOS.Platform.Messaging.Message(MessageCommunication.WhoAreOnlineRequest), null, null,
                        null);
                }
            } catch (Exception ex)
            {
                EnvironmentManager.Instance.ExceptionDialog("Chat.Init", ex);
            }
        }
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            //Instance = this;
            ClientControl.Instance.NewImageViewerControlEvent += new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _messageRegistrationObjects.Add(_messageCommunication.RegisterCommunicationFilter(NewEventIndicationMessageHandler,
                                                                                              new CommunicationIdFilter(MessageId.Server.NewEventIndication)));

            _messageRegistrationObjects.Add(_messageCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler,
                                                                                              new CommunicationIdFilter(MessageId.Server.NewAlarmIndication)));

            _messageRegistrationObjects.Add(EnvironmentManager.Instance.RegisterReceiver(SelectedViewChangedReceiver, new MessageIdFilter(MessageId.SmartClient.SelectedViewChangedIndication)));
            _messageRegistrationObjects.Add(EnvironmentManager.Instance.RegisterReceiver(SelectedViewItemChangedReceiver, new MessageIdFilter(MessageId.SmartClient.SelectedViewItemChangedIndication)));

            _SelectViewItemTimer = new System.Timers.Timer()
            {
                AutoReset = true,
                Interval  = 2000,
                Enabled   = true
            };
            _SelectViewItemTimer.Elapsed += SelectViewItemTimer_Elapsed;
            _SelectViewItemTimer.Start();
        }
        /// <summary>
        /// Initialize the Comunication Manager.
        ///
        /// </summary>
        private void SetUpComunicationManager()
        {
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Create a fiter to get messages from Smart Client Plugin
            Object _heatmapSearchFilter = _messageCommunication.RegisterCommunicationFilter(HeatMapPicHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter("heatmapPic"));
        }
Ejemplo n.º 5
0
 private void EnsureMessageCommunicationInitialized()
 {
     if (_mc == null)
     {
         MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
         _mc = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
         _mc.RegisterCommunicationFilter(IPAddressResponseHandler, new CommunicationIdFilter(MessageId.Server.GetIPAddressResponse));
     }
 }
Ejemplo n.º 6
0
 private void OnLoad(object sender, EventArgs e)
 {
     _cameraSetLayoutAndCamerasFQIDCollection = new Collection <FQID>();
     _cameraRemoveCamerasFQIDCollection       = new Collection <FQID>();
     _cameraSetCamerasFQIDCollection          = new Collection <FQID>();
     _positionInViewSetLayoutAndCameras       = setPositionSetLayoutAndCamerasNumeric.Value;
     _positionInViewShowText   = setPositionShowTextNumeric.Value;
     _positionInViewSetCameras = setPositionSetCamerasNumeric.Value;
     MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
     _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
     _msgComRec            = _messageCommunication.RegisterCommunicationFilter(VideoWallMessageCommunicationHandler, new CommunicationIdFilter(MessageId.Control.VideoWallIndication));
 }
Ejemplo n.º 7
0
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_reloadTimer != null)
                {
                    _reloadTimer.Dispose();
                    _reloadTimer = null;

                    _messageCommunication.UnRegisterCommunicationFilter(_obj);
                    MessageCommunicationManager.Stop(_serverId);
                }
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            //initiates the message communication
            //    MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);
            _heatmapSearchFilter  = _messageCommunication.RegisterCommunicationFilter(HeatMapSearchHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter(AnalyticsDefinition.analyticsHeatMapSearchFilterID));



            _stop        = false;
            _thread      = new Thread(new ThreadStart(Run));
            _thread.Name = "Analytics Background Thread";
            _thread.Start();
        }
Ejemplo n.º 9
0
        private void OnLoad(object sender, EventArgs e)
        {
            treeViewItems.ImageList        = VideoOS.Platform.UI.Util.ImageListClone;
            treeViewItems.ShowNodeToolTips = true;

            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Register to retrieve all NewEventIndication's from the Event Server
            _obj = _messageCommunication.RegisterCommunicationFilter(MessageHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.Server.NewEventIndication));
            _obj = _messageCommunication.RegisterCommunicationFilter(MessageHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.System.SystemConfigurationChangedIndication));

            // Register to receive the response from the ProvideCurrentStateRequest - issued later in this method.
            _obj3 = _messageCommunication.RegisterCommunicationFilter(ProvideCurrentStateResponseHandler,
                                                                      new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageCommunication.ProvideCurrentStateResponse));

            _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);
            // Build Top TreeNode
            // GetItems will always return the Management Server as the single top-node - we are using System-defined hierarchy so that in XPCO you can see recording servers
            Item     server = Configuration.Instance.GetItems(ItemHierarchy.SystemDefined)[0];
            TreeNode tn     = new TreeNode(server.Name)
            {
                ImageIndex         = VideoOS.Platform.UI.Util.ServerIconIx,
                SelectedImageIndex = VideoOS.Platform.UI.Util.ServerIconIx,
                Tag = server.FQID.ServerId.Id
            };

            treeViewItems.Nodes.Add(tn);

            // Add all children
            tn.Nodes.AddRange(AddChildren(server));

            try
            {
                // Ask for current state of all Items
                _messageCommunication.TransmitMessage(
                    new VideoOS.Platform.Messaging.Message(MessageCommunication.ProvideCurrentStateRequest), null, null, null);
            } catch (MIPException)
            {
                MessageBox.Show(
                    "Unable to connect to EventServer's MessageCommunication service (default port 22333) - will retry every 5 seconds",
                    "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }

            treeViewItems.ExpandAll();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Called by the Environment when the user has logged in.
        /// </summary>
        public override void Init()
        {
            ClientControl.Instance.NewImageViewerControlEvent += new ClientControl.NewImageViewerControlHandler(NewImageViewerControlEvent);
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _obj1 = _messageCommunication.RegisterCommunicationFilter(NewEventIndicationMessageHandler,
                                                                      new CommunicationIdFilter(MessageId.Server.NewEventIndication));

            _obj2 = _messageCommunication.RegisterCommunicationFilter(NewAlarmMessageHandler,
                                                                      new CommunicationIdFilter(MessageId.Server.NewAlarmIndication));
            timerRemoveOverlays          = new System.Timers.Timer(_interval);
            timerRemoveOverlays.Elapsed += new ElapsedEventHandler(TimedRefresh);

            timerRemoveOverlays.Enabled = true;
        }
Ejemplo n.º 11
0
        public void Init()
        {
            _catchUpTimer = new Timer(CatchUpTimerHandler);

            try
            {
                MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
                _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

                _systemConfigurationChangedIndicationRefefence = _messageCommunication.RegisterCommunicationFilter(SystemConfigChangedHandler2,
                                                                                                                   new VideoOS.Platform.Messaging.CommunicationIdFilter(MessageId.System.SystemConfigurationChangedIndication));
            }
            catch (MIPException ex)
            {
                Trace.WriteLine("Message Communcation not supported:" + ex.Message);
            }
        }
Ejemplo n.º 12
0
        public MainForm()
        {
            InitializeComponent();
            _viewMode = ViewMode.Alarm;
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            _alarmClientManager = new AlarmClientManager();

            rbAlarms.Tag    = ViewMode.Alarm;
            rbAnalytics.Tag = ViewMode.Analytics;
            rbEvents.Tag    = ViewMode.Event;
            rbLPR.Tag       = ViewMode.LPR;
            rbAccess.Tag    = ViewMode.Access;

            setGrid();
        }
Ejemplo n.º 13
0
        public ConfigurationMonitor(ServerId serverId)
        {
            _reloadTimer = new System.Threading.Timer(ReloadConfigTimerHandler);
            _serverId    = serverId;

            //Find out if site has an event server

            // We use the Event Server for getting the change indication
            MessageCommunicationManager.Start(_serverId);
            _messageCommunication = MessageCommunicationManager.Get(_serverId);

            _obj = _messageCommunication.RegisterCommunicationFilter(SystemConfigurationChangedIndicationHandler,
                                                                     new VideoOS.Platform.Messaging.CommunicationIdFilter(VideoOS.Platform.Messaging.MessageId.System.SystemConfigurationChangedIndication));

            _messageCommunication.ConnectionStateChangedEvent += new EventHandler(_messageCommunication_ConnectionStateChangedEvent);

            _reloadTimer.Change(0, 15000);      // Lets display now
        }
Ejemplo n.º 14
0
        // private static readonly string modelsDirectory = Path.Combine(Environment.CurrentDirectory, @"ML\OnnxModels");


        /*
         * private void LoadModel()
         * {
         *  // Check for an Onnx model exported from Custom Vision
         *  var customVisionExport = Directory.GetFiles(modelsDirectory, "*.zip").FirstOrDefault();
         *
         *  // If there is one, use it.
         *  if (customVisionExport != null)
         *  {
         *      var customVisionModel = new CustomVisionModel(customVisionExport);
         *      var modelConfigurator = new OnnxModelConfigurator(customVisionModel);
         *
         *      outputParser = new OnnxOutputParser(customVisionModel);
         *      customVisionPredictionEngine = modelConfigurator.GetMlNetPredictionEngine<CustomVisionPrediction>();
         *  }
         *  else // Otherwise default to Tiny Yolo Onnx model
         *  {
         *      var tinyYoloModel = new TinyYoloModel(Path.Combine(modelsDirectory, "TinyYolo2_model.onnx"));
         *      var modelConfigurator = new OnnxModelConfigurator(tinyYoloModel);
         *
         *      outputParser = new OnnxOutputParser(tinyYoloModel);
         *      tinyYoloPredictionEngine = modelConfigurator.GetMlNetPredictionEngine<TinyYoloPrediction>();
         *  }
         * }
         *
         *
         *
         */



        public HeatMapPluginService()
        {
            //load Model
            //LoadModel();


            InitializeComponent();


            // Test Parameters
            //Item _newItem = Configuration.Instance.GetItem(new Guid("d198ae21-1aba-48fa-83d5-f0aa191439f9"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));
            Item _newItem = Configuration.Instance.GetItem(new Guid("D198AE21-1ABA-48FA-83D5-F0AA191439F9"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));

            //Item _newItem = Configuration.Instance.GetItem(new Guid("DD826D1C-E703-4FED-8124-7D67ECEAA317"), new Guid("5135ba21-f1dc-4321-806a-6ce2017343c0"));



            OpenStream(_newItem);

            blobCounter = new BlobCounter();

            // Initialize Analyc Image Process
            analyticsImageProcessing = new AnalyticsImageProcessing();

            // Start Metadata Device service
            metadataHandler          = new MetadataHandler();
            _metadataProviderChannel = metadataHandler.OpenHTTPService();

            _metadataProviderChannel.SessionOpening += MetadataProviderSessionOpening;
            _metadataProviderChannel.SessionClosed  += MetadataProviderSessionClosed;

            // Start Communication Manager
            MessageCommunicationManager.Start(EnvironmentManager.Instance.MasterSite.ServerId);
            _messageCommunication = MessageCommunicationManager.Get(EnvironmentManager.Instance.MasterSite.ServerId);

            // Create a fiter to get messages from Smart Client Plugin
            _messageCommunication.RegisterCommunicationFilter(HeatMapSearchHandler, new VideoOS.Platform.Messaging.CommunicationIdFilter("analyticsHeatMapSearch"));
        }
Ejemplo n.º 15
0
 public void Close()
 {
     _messageCommunication.UnRegisterCommunicationFilter(_systemConfigurationChangedIndicationRefefence);
     MessageCommunicationManager.Stop(EnvironmentManager.Instance.MasterSite.ServerId);
 }
Ejemplo n.º 16
0
        private void StartMessaging(ServerObject smo)
        {
            if (smo.MessCommunication == null)
            {
                //VideoOS.Platform.SDK.Environment.AddServer(smo.SiteItem, _credentialCache);
                Item site = smo.SiteItem;

                MessageCommunicationManager.Start(site.FQID.ServerId);
                MessageCommunication messageCommunication = MessageCommunicationManager.Get(site.FQID.ServerId);
                object newEventIndicationHandler          = messageCommunication.RegisterCommunicationFilter(
                    MessageHandler,
                    new VideoOS.Platform.Messaging.CommunicationIdFilter(
                        VideoOS.Platform.Messaging.MessageId.Server.NewEventIndication));
                object provideCurrentStateResponseHandler =
                    messageCommunication.RegisterCommunicationFilter(ProvideCurrentStateResponseHandler,
                                                                     new VideoOS.Platform.Messaging.
                                                                     CommunicationIdFilter(
                                                                         MessageCommunication
                                                                         .ProvideCurrentStateResponse));
                TreeNode treeNode = BuildTree(site.FQID);
                if (treeNode != null)
                {
                    smo.MessCommunication                  = messageCommunication;
                    smo.NewEventIndicationHandler          = newEventIndicationHandler;
                    smo.ProvideCurrentStateResponseHandler = provideCurrentStateResponseHandler;
                }

                try
                {
                    messageCommunication.TransmitMessage(
                        new VideoOS.Platform.Messaging.Message(MessageCommunication.ProvideCurrentStateRequest),
                        null, null, null);
                }
                catch (Exception ex)
                {
                    toolStripStatusLabel1.Text = "TransmitMessage Exception: " + ex.Message +
                                                 " -Happens on server: " + smo.SiteItem.Name;
                    // todo

                    {
                        if (IsHandleCreated && !IsDisposed)
                        {
                            this.BeginInvoke(new MethodInvoker(delegate()
                            {
                                TreeNode tn = smo.SitesTreeNode;
                                if (smo.MessCommunication != null)
                                {
                                    if (smo.MessCommunication.IsConnected)
                                    {
                                        tn.ToolTipText = "connected";
                                        tn.ForeColor   = Color.Black;
                                    }
                                    else
                                    {
                                        tn.ToolTipText = "not connected";
                                        tn.ForeColor   = Color.Gray;
                                    }
                                }
                            }));
                        }
                    }
                }

                messageCommunication.ConnectionStateChangedEvent +=
                    new EventHandler(MessageConnectionStateChangedEvent);
            }
        }