Beispiel #1
0
 // Remove channel from the collection
 public void Remove(VsChannel channel)
 {
     try
     {
         InnerList.Remove(channel);
     }
     catch (Exception err)
     {
         logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
     }
 }
Beispiel #2
0
		// Add new channel to the collection
		public void Add(VsChannel channel)
		{
            try
            {
                InnerList.Add(channel);
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
		}
Beispiel #3
0
        // Set channel
        public void SetChannel(int channelID, VsChannel vsChannel)
        {
            try
            {
                if (vsChannelList.Count >= MaxChannel)
                {
                    return;
                }

                // add to list
                vsChannelList.Add(new ChannelList(channelID, vsChannel));
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }
Beispiel #4
0
        private void buttonConnecter_Click(object sender, EventArgs e)
        {
            switch (vsPropertyType)
            {
                case VsDeviceType.CAMERA:
                    {
                        this.vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);

                        if (vsCamera == null) return;
                        if (vsCamera.Running)
                            vsCoreMonitor.DisconnectCamera(vsTypeName);
                        else vsCoreMonitor.ConnectCamera(vsTypeName, false);                     
                    }
                    break;
                case VsDeviceType.CHANNEL:
                    {
                        this.vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                        if (vsChannel == null) return;
                        if (vsChannel.Running)
                            vsCoreMonitor.DisconnectChannel(vsTypeName);
                        else vsCoreMonitor.ConnectChannel(vsTypeName, false);
                    }
                    break;
                case VsDeviceType.PAGE:
                    {
                        this.vsPage = vsCoreMonitor.GetPageByName(vsTypeName);
                        if (vsPage == null) return;
                        if (vsPage.Running)
                            vsCoreMonitor.DisconnectPage(vsTypeName);
                        else vsCoreMonitor.ConnectPage(vsTypeName, false);
                    }
                    break;
            }
        }
Beispiel #5
0
        public void ActivatePropertyControl(VsDeviceType propType, String propName)
        {
            vsPropertyType = propType;
            vsTypeName = propName;

            this.Enabled = true;

            switch (vsPropertyType)
            {
                case VsDeviceType.CAMERA:
                    CameraProperty();
                    this.vsCamera = vsCoreMonitor.GetCameraByName(vsTypeName);
                    break;
                case VsDeviceType.CHANNEL:
                    ChannelProperty();
                    this.vsChannel = vsCoreMonitor.GetChannelByName(vsTypeName);
                    break;
                case VsDeviceType.PAGE:
                    PageProperty();
                    this.vsPage = vsCoreMonitor.GetPageByName(vsTypeName);
                    break;
            }
        }
Beispiel #6
0
 public ChannelList(int pageID, VsChannel channel)
 {
     ChannelID = pageID;
     ChannelHandler = channel;
 }
Beispiel #7
0
        // Set channel
        public void SetChannel(int channelID, VsChannel vsChannel)
        {
            try
            {
                if (vsChannelList.Count >= MaxChannel) return;

                // add to list
                vsChannelList.Add(new ChannelList(channelID, vsChannel));
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }
        }
Beispiel #8
0
        // drag drop into window
        void VsCameraViewer_DragDrop(object sender, DragEventArgs e)
        {
            this.BorderStyle = BorderStyle.None;

            if (vsStatus == VsViewStatusType.VIEW_CONNECTING || vsStatus == VsViewStatusType.VIEW_CONNECTED) return;

            string send = (string)e.Data.GetData(typeof(string));
            string[] cmd = send.Split('\\');

            vsDeviceName = cmd[1];
            // check if not root node
            if (cmd.Length == 2 && cmd[0] == "Analyzers")
            {
                // set flag
                vsDeviceType = VsDeviceType.CAMERA;
                vsStatus = VsViewStatusType.VIEW_CONNECTING;

                // update event
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                    new VsParameter(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_SIGLEVIEW, vsDeviceType, vsDeviceName)));

                labelStatus.Text = "Connecting...";
                // the current camera is connected
                if (!vsCoreMonitor.ConnectingCamera(vsDeviceName))
                {
                    // not connected
                    // try to connect
                    if (!vsCoreMonitor.ConnectCamera(vsDeviceName, false))
                        return;

                    // cache current camera
                    vsCamera = vsCoreMonitor.GetCameraByName(vsDeviceName);
                }

                // the camera is connected
                // attach to current view
                vsCoreMonitor.AttachCameraView(vsDeviceName, this);
                vsAttachType = VsAttachType.ATTACH_RECEIVER;

                // enable toolbox
                buttonStop.Enabled = true;
                buttonAttach.Enabled = true;
                buttonAnalyzer.Enabled = true;
            }
            else if (cmd.Length == 2 && cmd[0] == "Layouts")
            {
                // set flag
                vsDeviceType = VsDeviceType.CHANNEL;
                vsStatus = VsViewStatusType.VIEW_CONNECTING;

                // update event
                this.vsUpdateEvent(this, new VsMonitorEventArgs(
                    new VsParameter(VsAppControlType.APP_SIGLEVIEW, VsAppControlType.APP_SIGLEVIEW, vsDeviceType, vsDeviceName)));

                // the current channel is connected
                if (!vsCoreMonitor.ConnectingChannel(vsDeviceName))
                {
                    // not connected
                    // try to connect
                    if (!vsCoreMonitor.ConnectChannel(vsDeviceName, false))
                        return;

                    // cache current camera
                    vsChannel = vsCoreMonitor.GetChannelByName(vsDeviceName);
                }

                // the camera is connected
                // attach to current view
                vsCoreMonitor.AttachChannelView(vsDeviceName, this);

                // enable toolbox
                buttonStop.Enabled = true;
                buttonAttach.Enabled = true;
                buttonAnalyzer.Enabled = true;
            }
        }
Beispiel #9
0
 public ChannelList(int pageID, VsChannel channel)
 {
     ChannelID      = pageID;
     ChannelHandler = channel;
 }
Beispiel #10
0
        // Load vsChannels
        private void LoadChannels(XmlTextReader reader)
        {
            try
            {
                // load all vsChannels
                while (reader.Name == "Channel")
                {
                    int depth = reader.Depth;

                    // create new camera
                    VsChannel view = new VsChannel(reader.GetAttribute("name"), SyncTimer);

                    view.LocalHost = LocalHost;
                    view.LocalStorage = LocalStorage;
                    
                    view.ChannelID = int.Parse(reader.GetAttribute("id"));
                    view.Description = reader.GetAttribute("desc");

                    // view size
                    view.Rows = short.Parse(reader.GetAttribute("rows"));
                    view.Cols = short.Parse(reader.GetAttribute("cols"));
                    view.CellWidth = short.Parse(reader.GetAttribute("width"));
                    view.CellHeight = short.Parse(reader.GetAttribute("height"));

                    // read vsCameras
                    string[] strIDs = reader.GetAttribute("cameras").Split(',');
                    for (int i = 0; i < VsChannel.MaxCam; i++)
                    {
                        if (strIDs[i].Length > 0)
                        {
                            int id = int.Parse(strIDs[i]);
                            view.SetCamera(id, GetCameraByID(id));
                        }
                    }

                    view.SetLayout(ChannelLayout.TH_GRID_1);

                    // view configuration
                    view.Analyser = vsAnalysers.GetAnalyserByName(reader.GetAttribute("analyzer"));
                    view.Encoder = vsEncoders.GetEncoderByName(reader.GetAttribute("encoder"));

                    // load analyser configuration
                    if (view.Analyser != null)
                        view.AnalyserConfiguration = view.Analyser.LoadConfiguration(reader);

                    // load encoder configuration
                    if (view.Encoder != null)
                        view.EncoderConfiguration = view.Encoder.LoadConfiguration(reader);

                    // add view
                    vsChannels.Add(view);

                    if (view.ChannelID >= vsNextChannelID)
                        vsNextChannelID = view.ChannelID + 1;

                    // move to next node
                    reader.Read();

                    // move to next element node
                    while (reader.NodeType == XmlNodeType.EndElement)
                        reader.Read();
                    if (reader.Depth < depth)
                        return;
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #11
0
        // Check channel
        public bool CheckChannel(VsChannel channel)
        {
            try
            {
                foreach (VsChannel v in vsChannels)
                {
                    if ((channel.ChannelName == v.ChannelName) && ((channel.ChannelID == 0) || (channel.ChannelID != v.ChannelID)))
                        return false;
                }
                return true;
            }
            catch (Exception err)
            {
                logger.Log(LogLevel.Error, err.Message + " " + err.Source + " " + err.StackTrace);;
            }

            return false;
        }
Beispiel #12
0
        //  Delete channel
        public bool DeleteChannel(VsChannel channel)
        {
            try
            {
                vsChannels.Remove(channel);

                // save
                if (bSaveConfig) SaveChannels();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return true;
        }
Beispiel #13
0
        // Add channel
        public bool AddChannel(String channelName, String[] cameraList)
        {
            try
            {
                // if this name is already exist
                if (GetChannelByName(channelName) != null)
                    return false;

                VsChannel vsChannel = new VsChannel(channelName, SyncTimer);

                // set layout
                vsChannel.SetLayout(ChannelLayout.TH_GRID_1);
                vsChannel.Rows = 5;
                vsChannel.Cols = 5;

                foreach (String cameraName in cameraList)
                {
                    VsCamera vsCam = GetCameraByName(cameraName);
                    if (vsCam != null)
                        vsChannel.SetCamera(vsCam.CameraID, vsCam);
                }

                // add to views collection
                AddChannel(vsChannel);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

            return true;
        }
Beispiel #14
0
        // Add channel
        public VsChannel AddChannel(String channelName, int width, int height, int quality)
        {
            try
            {
                // if this name is already exist
                if (GetChannelByName(channelName) != null)
                    return null;

                VsChannel vsChannel = new VsChannel(channelName, SyncTimer, width, height, quality);

                AddChannel(vsChannel);

                return vsChannel;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return null;
        }
Beispiel #15
0
        // Add channel
        public void AddChannel(VsChannel channel)
        {
            try
            {
                // add channel
                channel.ChannelID = vsNextChannelID++;
                vsChannels.Add(channel);

                // save
                if (bSaveConfig) SaveChannels();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Beispiel #16
0
		// On page changing
		protected override void OnPageChanging(int page)
		{
            if (page == 1)
            {
                vsChannel = vsChannelDescription.Channel;
                vsChannelStructure.Channel = vsChannel;
                vsAnalyzerSetting.Channel = vsChannel;
                vsEncoderSetting.Channel = vsChannel;
            }
			base.OnPageChanging(page);
		}