Пример #1
0
        //protected Peripheralstatus peripheralstatus = null;

        //protected Peripheralstatus prevperipheralstatus = null;

        public virtual bool OpenPeripheral(DPNP_DEVICE_TYPE type, int index)
        {
            if (DpnDevice._instance == null)
            {
                DpnDevice.create();
            }
            #if UNITY_ANDROID && !UNITY_EDITOR
            if (type == DPNP_DEVICE_TYPE.DPNP_DEVICE_TYPE_HEAD_TRACKER)
            {
                peripheral = DpnDevice.OpenPeripheral(string.Empty, this);
                return(true);
            }
            #endif

            int count = DpnPeripheral.DpnupQueryDeviceCount(type);
            if (count < 0 || index >= count)
            {
                return(false);
            }
            string devicename = DpnPeripheral.DpnupGetDeviceId(type, index);
            if (devicename != null)
            {
                return(OpenPeripheral(devicename));
            }
            return(false);
        }
Пример #2
0
        public virtual bool OpenPeripheral(string deviceId)
        {
            if (DpnDevice._instance == null)
            {
                DpnDevice.create();
            }
#if UNITY_ANDROID && UNITY_EDITOR
            if (DpnManager.androidEditorUseHmd)
            {
                DpnPeripheral peripheral = DpnDevice.OpenPeripheral(deviceId, this);
                return(peripheral != null);
            }
            else
            {
                peripheral = null;
                return(true);
            }
#else
            DpnPeripheral peripheral = DpnDevice.OpenPeripheral(deviceId, this);
            return(peripheral != null);
#endif
        }