Beispiel #1
0
        /// <summary>
        /// 获取在线相机列表
        /// </summary>
        /// <param name="list"></param>
        /// <param name="size">list总的字节数</param>
        /// <returns></returns>
        public uint GetTerminalList(GroupSDK.ENUM_INFO[] list, uint unit_count)
        {
            if (!m_bIsIntialized)
            {
                return(0);
            }
            //创建新的实例
            GroupSDK.ENUM_INFO[] camers = new GroupSDK.ENUM_INFO[32];

            uint size = (uint)Marshal.SizeOf(typeof(GroupSDK.CAMERA_INFO)) * unit_count;

            IntPtr ptr       = Marshal.AllocHGlobal((int)size);
            IntPtr ptrBackup = ptr;

            uint dev_num = GroupSDK.MAG_GetTerminalList(ptr, size);

            for (int i = 0; i < dev_num; i++)
            {
                camers[i] = (GroupSDK.ENUM_INFO)Marshal.PtrToStructure(ptr, typeof(GroupSDK.ENUM_INFO));
                ptr       = (IntPtr)((int)ptr + Marshal.SizeOf(typeof(GroupSDK.ENUM_INFO)));
            }

            Marshal.FreeHGlobal(ptrBackup);
            int index = 0;

            for (int i = 0; i < dev_num; i++)
            {
                string nowip = IntToIP(camers[i].intCamIp);
                if (nowip == Globals.CameraIp1 || nowip == Globals.CameraIp2)//如果相机属于配置文件里面的IP
                {
                    list[index] = camers[i];
                    index++;
                    if (index == 2)
                    {
                        break;
                    }
                }
            }
            if (dev_num >= 2)
            {
                dev_num = 2;
            }

            return(dev_num);
        }
Beispiel #2
0
        /// <summary>
        /// 获取在线相机列表
        /// </summary>
        /// <param name="list"></param>
        /// <param name="size">list总的字节数</param>
        /// <returns></returns>
        public uint GetTerminalList(GroupSDK.ENUM_INFO[] list, uint unit_count)
        {
            if (!m_bIsIntialized)
            {
                return(0);
            }

            uint size = (uint)Marshal.SizeOf(typeof(GroupSDK.CAMERA_INFO)) * unit_count;

            IntPtr ptr       = Marshal.AllocHGlobal((int)size);
            IntPtr ptrBackup = ptr;

            uint dev_num = GroupSDK.MAG_GetTerminalList(ptr, size);

            for (int i = 0; i < dev_num; i++)
            {
                list[i] = (GroupSDK.ENUM_INFO)Marshal.PtrToStructure(ptr, typeof(GroupSDK.ENUM_INFO));
                ptr     = (IntPtr)((int)ptr + Marshal.SizeOf(typeof(GroupSDK.ENUM_INFO)));
            }

            Marshal.FreeHGlobal(ptrBackup);

            return(dev_num);
        }
Beispiel #3
0
 public uint GetTerminalCount()
 {
     return(m_bIsIntialized ? GroupSDK.MAG_GetTerminalList(IntPtr.Zero, 0) : 0);
 }