private void InitResourceCombo()
        {
            comboBox_Device.Items.Clear();
            int    i            = 0;
            Object selectedItem = comboBox_Server.SelectedItem;

            // Add "Acq" resources (cameras) to combo
            for (i = 0; i < SapManager.GetResourceCount(selectedItem.ToString(), SapManager.ResourceType.Acq); i++)
            {
                string resourceName = SapManager.GetResourceName(selectedItem.ToString(), SapManager.ResourceType.Acq, i);
                if (SapManager.IsResourceAvailable(selectedItem.ToString(), SapManager.ResourceType.Acq, i))
                {
                    comboBox_Device.Items.Add(resourceName);
                    if (i == m_ResourceIndex)
                    {
                        comboBox_Device.SelectedItem = resourceName;
                    }
                }
                else
                {
                    comboBox_Device.Items.Add("Not Available - Resource in Use");
                    comboBox_Device.SelectedIndex = 0;
                }
            }
            // Add "AcqDevice" resources (cameras) to combo
            for (i = 0; i < SapManager.GetResourceCount(selectedItem.ToString(), SapManager.ResourceType.AcqDevice); i++)
            {
                string resourceName;

                //Removed this code to fix a crash with the latest GigE driver. To be reapplied for CLHS

                /*
                 * SapLocation location = new SapLocation(m_ServerName, i);
                 * SapAcqDevice camera = new SapAcqDevice(location, false);
                 *
                 *      bool status = camera.Create();
                 *      int nPort = 1; //default to 1 streaming port
                 * if (status && camera.IsParameterAvailable(SapAcqDevice.Prm.NUM_PORTS))
                 *  camera.GetParameter(SapAcqDevice.Prm.NUM_PORTS, out nPort);
                 *
                 *      // Destroy acquisition device object
                 *      if (!camera.Destroy())
                 *  continue;
                 *  if (nPort == 0)
                 * {
                 *          continue; //skip this AcqDevice since it doesn't have a video streaming port.
                 * }
                 */
                resourceName = SapManager.GetResourceName(selectedItem.ToString(), SapManager.ResourceType.AcqDevice, i);
                comboBox_Device.Items.Add(resourceName);
                if (i == m_ResourceIndex)
                {
                    comboBox_Device.SelectedItem = resourceName;
                }
            }
            m_ResourceIndex = comboBox_Device.SelectedIndex;
        }
Ejemplo n.º 2
0
        public bool CreateNewObjects(SapLocation location, string fileName, bool Restore)
        {
            if (Online)
            {
                if (!Restore)
                {
                    Location = location;
                }

                if (!SapManager.IsResourceAvailable(location, SapManager.ResourceType.Acq))
                {
                    Debug.WriteLine(fileName + "available");
                    return(false);
                }

                Acquisition = new SapAcquisition(Location, fileName);
                if (SapBuffer.IsBufferTypeSupported(Location, SapBuffer.MemoryType.ScatterGather))
                {
                    Buffers = new SapBufferWithTrash(4, Acquisition, SapBuffer.MemoryType.ScatterGather);
                }
                else
                {
                    Buffers = new SapBufferWithTrash(4, Acquisition, SapBuffer.MemoryType.ScatterGatherPhysical);
                }
                Xfer   = new SapAcqToBuf(Acquisition, Buffers);
                m_View = new SapView(Buffers);

                Xfer.Pairs[0].EventType = SapXferPair.XferEventType.EndOfFrame;
                Xfer.XferNotify        += xfer_XferNotify;
                Xfer.XferNotifyContext  = this;
            }
            else
            {
                Buffers = new SapBuffer();
            }

            if (!CreateObjects())
            {
                DisposeObjects();
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
        private void InitResourceCombo()
        {
            comboBox_Device.Items.Clear();
            int    i            = 0;
            Object selectedItem = comboBox_Server.SelectedItem;

            // Add "Acq" resources (cameras) to combo
            for (i = 0; i < SapManager.GetResourceCount(selectedItem.ToString(), SapManager.ResourceType.Acq); i++)
            {
                string resourceName = SapManager.GetResourceName(selectedItem.ToString(), SapManager.ResourceType.Acq, i);
                if (SapManager.IsResourceAvailable(selectedItem.ToString(), SapManager.ResourceType.Acq, i))
                {
                    comboBox_Device.Items.Add(resourceName);
                    if (i == m_ResourceIndex)
                    {
                        comboBox_Device.SelectedItem = resourceName;
                    }
                }
                else
                {
                    comboBox_Device.Items.Add("Not Available - Resource in Use");
                    comboBox_Device.SelectedIndex = 0;
                }
            }
            // Add "AcqDevice" resources (cameras) to combo
            if (SapManager.GetResourceCount(selectedItem.ToString(), SapManager.ResourceType.Acq) == 0)
            {
                for (i = 0; i < SapManager.GetResourceCount(selectedItem.ToString(), SapManager.ResourceType.AcqDevice); i++)
                {
                    string resourceName;
                    resourceName = SapManager.GetResourceName(selectedItem.ToString(), SapManager.ResourceType.AcqDevice, i);
                    comboBox_Device.Items.Add(resourceName);
                    if (i == m_ResourceIndex)
                    {
                        comboBox_Device.SelectedItem = resourceName;
                    }
                }
            }
            m_ResourceIndex = comboBox_Device.SelectedIndex;
        }