Ejemplo n.º 1
0
        unsafe public static List <DeviceInfo> GetDeviceList()
        {
            int            deviceCount = -1;
            OniDeviceInfo *deviceList  = (OniDeviceInfo *)IntPtr.Zero;
            OniStatus      status      = oniGetDeviceList(&deviceList, ref deviceCount);

            HandleError(status);

            List <DeviceInfo> list = new List <DeviceInfo>();

            for (int i = 0; i < deviceCount; i++)
            {
                DeviceInfo    tmpInfo    = new DeviceInfo();
                OniDeviceInfo deviceInfo = deviceList[i];
                tmpInfo.uri          = Marshal.PtrToStringAnsi((IntPtr)deviceInfo.uri);
                tmpInfo.name         = Marshal.PtrToStringAnsi((IntPtr)deviceInfo.name);
                tmpInfo.vendor       = Marshal.PtrToStringAnsi((IntPtr)deviceInfo.vendor);
                tmpInfo.usbProductId = deviceInfo.usbProductId;
                tmpInfo.usbVendorId  = deviceInfo.usbVendorId;
                list.Add(tmpInfo);
            }

            oniReleaseDeviceList((IntPtr)deviceList);

            return(list);
        }
Ejemplo n.º 2
0
        public static unsafe DeviceInfo[] GetDevices()
        {
            OniDeviceInfo *pDevices = null;
            var            count    = 0;

            OniCAPI.oniGetDeviceList(&pDevices, &count).ThrowExectionIfStatusIsNotOk();

            var devices = new DeviceInfo[count];

            for (var i = 0; i < count; i++)
            {
                var oniDeviceInfo = pDevices[i];

                devices[i] = oniDeviceInfo.ToManaged();
            }

            OniCAPI.oniReleaseDeviceList(pDevices).ThrowExectionIfStatusIsNotOk();

            return(devices);
        }
Ejemplo n.º 3
0
 private unsafe extern static OniStatus oniDeviceGetInfo(IntPtr device, OniDeviceInfo *pInfo);