IEnumerator DisconnectRemotingSession()
    {
        if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
        {
            Debug.LogWarning("Remoting is not connected. Please start an active remoting session before attempting to disconnect.");
        }
        else
        {
            HolographicRemoting.Disconnect();
            yield return(null);

            int currentRetries = 0;
            while (currentRetries < ConnectRetryCount && HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Disconnected)
            {
                currentRetries++;
                Debug.Log($"Waiting on disconnect: attempt {currentRetries}.");
                yield return(new WaitForSeconds(1f));

                currentRetries++;
            }

            if (currentRetries >= ConnectRetryCount)
            {
                Debug.LogError($"Unable to disconnedct from remote session after {currentRetries} attempts.");
            }
            else
            {
                XRSettings.enabled = false;
            }
        }
    }
 public void Connect()
 {
     if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
     {
         HolographicRemoting.Connect(IP);
     }
 }
示例#3
0
 public void Connect()
 {
     if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
     {
         HolographicRemoting.Connect(IP, 99999, RemoteDeviceVersion.V2);
     }
 }
示例#4
0
 public void ConnectToHoloB()
 {
     if (adress.text != null)
     {
         HolographicRemoting.Connect(adress.text);
     }
 }
 public void Connect()
 {
     if (HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Disconnected)
     {
         HolographicRemoting.Connect(IPText.text);
     }
 }
示例#6
0
 private void OnDestroy()
 {
     if (HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Connected)
     {
         HolographicRemoting.Disconnect();
     }
 }
 private void Start()
 {
     if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
     {
         Debug.Log("Connecting...");
         HolographicRemoting.Connect(hololensIP, 99999, RemoteDeviceVersion.V2);
     }
 }
 private void OnDestroy()
 {
     HolographicRemoting.Disconnect();
     connected = false;
     while (HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Connected)
     {
         ;
     }
 }
示例#9
0
        /// <summary>
        /// Starts up holographic remoting.
        /// </summary>
        public static void StartRemoting()
        {
            var remote = MixedRealityDisplay.currentDisplay.remote;

            if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
            {
                HolographicRemoting.Connect(remote.address, remote.maxBitRate);
            }

            Configuration.OnPreUpdate += CheckHolographicRemoting;
        }
示例#10
0
 public void ToggleConnection(bool connect)
 {
     if (!connect)
     {
         HolographicRemoting.Disconnect();
         connected = false;
     }
     else
     {
         Connect();
     }
 }
示例#11
0
    //private void Start()
    //{
    //    Connect();
    //}
    public void Connect()
    {
        if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
        {
            if (inputField != null && !string.IsNullOrEmpty(inputField.text))
            {
                IP = inputField.text;
            }

            HolographicRemoting.Connect(IP);
        }
    }
示例#12
0
    IEnumerator ConnectRemotingSession()
    {
        if (HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Disconnected)
        {
            Debug.LogWarning("Remoting already connected. Please disconnect before trying to connect again.");
        }
        else
        {
            Debug.Log("ConnectRemotingSession - trying to connect - " + this.IpV4RemotingAddress);

            HolographicRemoting.Connect(IpV4RemotingAddress);
            yield return(null);

            int currentRetries = 0;
            while (currentRetries < ConnectRetryCount && HolographicRemoting.ConnectionState != HolographicStreamerConnectionState.Connected)
            {
                currentRetries++;
                Debug.Log($"Waiting on connection: attempt {currentRetries}.  HolographicRemoting.ConnectionState=" + HolographicRemoting.ConnectionState);
                yield return(new WaitForSeconds(1f));
            }

            if (currentRetries >= ConnectRetryCount)
            {
                Debug.LogError($"Unable to connect to remote session after {currentRetries} attempts.");
            }
            else
            {
                Debug.Log("Loading Windows MR for Remoting...");
                XRSettings.LoadDeviceByName("WindowsMR");
                yield return(new WaitForSeconds(1));

                Debug.Log("Starting XR...");
                XRSettings.enabled = true;
                yield return(new WaitForSeconds(1));

                Debug.Log($"XR activation state: {XRSettings.enabled}");

                if (!XRSettings.enabled)
                {
                    HolographicRemoting.Disconnect();
                }
            }
        }
    }
示例#13
0
    private void Start()
    {
        current = this;

        // Read in all neccessary data
        ReadDisplayTrackerConfigs();
        ReadHoloLensConfigs();

        // Get the Holoport if it exists
        if (PlatformConfig.current.globals.ContainsKey("holoPort"))
        {
            holoPort = (int)PlatformConfig.current.globals["holoPort"];
        }

        // Set up the tracking to displays if available
        if (displayTrackerConfigs != null)
        {
            SetUpDisplayTrackers();
        }

        if (holoLensConfigs != null)
        {
            // Only create singleton if it will be used
            HoloLens.current = new HoloLens();

#if UNITY_WSA
            // Get the device it exists on this node
            if (HoloLens.current.display != null)
            {
                var remote = HoloLens.current.display.HoloLensData().remote;

                // Set up the holoLens now or wait for remoting
                if (remote == null)
                {
                    HoloLens.current.Enable();
                }
                else
                {
                    HolographicRemoting.Connect(remote.address, remote.maxBitRate);
                }
            }
#endif
        }
    }
示例#14
0
        // Runs every frame until holographic remoting starts
        private static void CheckHolographicRemoting()
        {
            MixedRealityDisplay display = MixedRealityDisplay.currentDisplay;

            // Get the remote
            var remote = display.remote;

            // If remoting has now connected
            if (HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Connected)
            {
                UniSAConfig.current.StartCoroutine(LoadDevice("WindowsMR"));
                Configuration.OnPreUpdate -= CheckHolographicRemoting;
                remote.connected           = true;
                MixedRealityDisplay.currentDisplay.Setup(MixedRealityDisplay.currentDisplayConfig, false);
            }
            else if (HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Disconnected)
            {
                HolographicRemoting.Connect(remote.address, remote.maxBitRate);
            }
        }
示例#15
0
    private void OnGUI()
    {
        IP = GUI.TextField(new Rect(10, 10, 200, 30), IP, 25);

        string button = (connected ? "Disconnect" : "Connect");

        if (GUI.Button(new Rect(220, 10, 100, 30), button))
        {
            if (connected)
            {
                HolographicRemoting.Disconnect();
                connected = false;
            }
            else
            {
                Connect();
            }
            Debug.Log(button);
        }
    }
示例#16
0
    void Update()
    {
        if (!connected && HolographicRemoting.ConnectionState == HolographicStreamerConnectionState.Connected)
        {
            connected = true;

            StartCoroutine(LoadDevice("WindowsMR"));
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            if (connected)
            {
                HolographicRemoting.Disconnect();
                connected = false;
            }
            else
            {
                Connect();
            }
        }
    }
 void OnDisable()
 {
     HolographicRemoting.Disconnect();
     Debug.Log("Was Disconnected");
 }
 void OnApplicationQuit()
 {
     HolographicRemoting.Disconnect();
     Debug.Log("Was Disconnected");
     Debug.Log("Application ending after " + Time.time + " seconds");
 }
示例#19
0
 public void DisconnectFromHoloB()
 {
     HolographicRemoting.Disconnect();
 }
示例#20
0
 private void Start()
 {
     HolographicRemoting.Connect(hololensIP);
 }