Example #1
0
        public List <GBDevInfo> DIOQueryDeviceList(E_VDA_NET_STORE_DEV_PROTOCOL_TYPE type)
        {
            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetDevInfo type:" + type);
            IntPtr ptr    = Marshal.AllocHGlobal(1000);
            uint   ChlNum = 0;

            IVXStreamIOSDKProtocol.StrmGetDevNum(type, out ChlNum);
            IntPtr pchlinfo = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(GBDevInfo)) * (int)ChlNum);
            uint   retVal   = IVXStreamIOSDKProtocol.StrmGetDevInfo(type, ChlNum, pchlinfo);

            if (retVal > 0)
            {
                DIO_GetError(retVal);
            }
            List <GBDevInfo> ret = new List <GBDevInfo>();
            StringBuilder    sb  = new StringBuilder();

            for (int i = 0; i < ChlNum; i++)
            {
                GBDevInfo temp = (GBDevInfo)Marshal.PtrToStructure(pchlinfo + Marshal.SizeOf(typeof(GBDevInfo)) * i, typeof(GBDevInfo));
                ret.Add(temp);
                sb.AppendLine("DevId:" + temp.DevId + ",LoginId:" + temp.LoginId);
            }

            MyLog4Net.ILogExtension.DebugWithDebugView(MyLog4Net.Container.Instance.Log, "IVXStreamIOSDKProtocol StrmGetDevInfo ret:" + 0 + ",list:" + sb.ToString());
            return(ret);
        }