Beispiel #1
0
        // Get the first camera found.
        static bool CameraGrab()
        {
            UInt32 connected = 0;

            tCameraInfo[] list = new tCameraInfo[1];

            return(Pv.CameraList(list, 1, ref connected) >= 1);
        }
Beispiel #2
0
        // Get the UID and Serial Number of the first camera listed.
        static bool CameraGet(ref tCamera Camera)
        {
            UInt32 count, connected = 0;

            tCameraInfo[] list = new tCameraInfo[1];

            if ((count = Pv.CameraList(list, 1, ref connected)) != 0)
            {
                Camera.UID = list[0].UniqueId;
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #3
0
        // get the UID and Serial Number of the first camera listed.
        static bool CameraGrab(ref tCamera Camera)
        {
            UInt32 count, connected = 0;

            tCameraInfo[] list = new tCameraInfo[1];

            if ((count = Pv.CameraList(list, 1, ref connected)) != 0)
            {
                Camera.UID    = list[0].UniqueId;
                Camera.Serial = list[0].SerialString;
                Console.WriteLine("Grabbing camera: {0}", Camera.Serial);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
        // Get the UID  and Serial number of the first camera listed.
        static bool CameraGrab()
        {
            UInt32 count, connected = 0;

            tCameraInfo[] list = new tCameraInfo[1];

            if ((count = Pv.CameraList(list, 1, ref connected)) != 0)
            {
                GCamera.UID    = list[0].UniqueId;
                GCamera.Serial = list[0].SerialString;
                Console.WriteLine("Camera {0} grabbed. ", GCamera.Serial);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #5
0
        // Get the UID and Serial Number of the first camera listed.
        static bool CameraGet()
        {
            UInt32 count, connected = 0;

            tCameraInfo[] list = new tCameraInfo[1];
            count = Pv.CameraList(list, 1, ref connected);
            if (count == 1)
            {
                GCamera.UID    = list[0].UniqueId;
                GCamera.Serial = list[0].SerialString;
                Console.WriteLine("Got camera: {0}", GCamera.Serial);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        static void ListingCameras(ref in_addr Camera)
        {
            UInt32 MaxCameraList = 20;

            tCameraInfo[] CameraList = new tCameraInfo[MaxCameraList];
            UInt32        CameraNum  = 0;
            UInt32        CameraRle;
            UInt32        Zero  = 0;
            bool          gstop = true;


            while (gstop)
            {
                Console.WriteLine("***********************************");

                // Get list of reachable cameras.
                CameraNum = Pv.CameraList(CameraList, MaxCameraList, ref Zero);

                // Store how many cameras listed are reachable.
                CameraRle = CameraNum;

                // Append the list of unreachable cameras.
                if (CameraNum < MaxCameraList)
                {
                    CameraNum += Pv.CameraListUnreachable(CameraList, (MaxCameraList - CameraNum), ref Zero);
                }

                if (CameraNum > 0)
                {
                    // Go through the number of cameras detected.
                    for (UInt32 i = 0; i < CameraNum; i++)
                    {
                        if (i < CameraRle)
                        {
                            // Get the camera's IP configuration.
                            if ((Camera.lErr = Pv.CameraIpSettingsGet(CameraList[i].UniqueId, ref Camera.Conf)) == tErr.eErrSuccess)
                            {
                                Camera.S_addr = Camera.Conf.CurrentIpAddress;
                                System.Net.IPAddress Address = new IPAddress(Camera.S_addr);

                                // Display the camera info.
                                Console.Write("{0}- {1} - Unique ID = {2} IP@ = {3}", CameraList[i].SerialString, CameraList[i].DisplayName, CameraList[i].UniqueId, Address);

                                // Check to see if the camera is being used.
                                if (CameraList[i].PermittedAccess == 6)
                                {
                                    Console.WriteLine(" [Available]");
                                }
                                else
                                {
                                    Console.WriteLine(" [In use]");
                                }

                                Console.WriteLine();
                            }
                            else
                            {
                                Console.Write("{0}- {1} - Unique ID = {2} [Unavailable] ", CameraList[i].SerialString, CameraList[i].DisplayName, CameraList[i].UniqueId);
                            }
                        }
                        else
                        {
                            Console.Write("{0}- {1} - Unique ID = {2}", CameraList[i].SerialString, CameraList[i].DisplayName, CameraList[i].UniqueId);
                        }
                    }
                    if (CameraNum != CameraRle)
                    {
                        Console.WriteLine("Camera is unreachable.");
                    }
                }
                else
                {
                    Console.WriteLine("There is no camera detected.");
                }

                // Wait a certain amount of time before checking again.
                Thread.Sleep(1500);
            }
        }