private void Disconnect()
 {
     if (PerceptionRemotingPlugin.GetConnectionState() != HolographicStreamerConnectionState.Disconnected)
     {
         PerceptionRemotingPlugin.Disconnect();
     }
 }
        void Update()
        {
            switch (m_Mode)
            {
            case EmulationMode.Simulated:
                HolographicEmulation.SetGestureHand(m_Hand);
                break;

            case EmulationMode.RemoteDevice:
                HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();
                if (connectionState != m_LastConnectionState)
                {
                    Repaint();
                }
                var lastConnectionFailureReason = PerceptionRemotingPlugin.CheckForDisconnect();
                if (lastConnectionFailureReason == HolographicStreamerConnectionFailureReason.Unreachable ||
                    lastConnectionFailureReason == HolographicStreamerConnectionFailureReason.ConnectionLost)
                {
                    Debug.LogWarning("Disconnected with failure reason " + lastConnectionFailureReason + ", attempting to reconnect.");
                    Connect();
                }
                else if (lastConnectionFailureReason != HolographicStreamerConnectionFailureReason.None)
                {
                    Debug.LogError("Disconnected with error " + lastConnectionFailureReason);
                }
                m_LastConnectionState = connectionState;
                break;
            }
        }
 private void Connect()
 {
     PerceptionRemotingPlugin.SetVideoEncodingParameters(m_MaxBitrateKbps);
     PerceptionRemotingPlugin.SetEnableVideo(m_EnableVideo);
     PerceptionRemotingPlugin.SetEnableAudio(m_EnableAudio);
     PerceptionRemotingPlugin.Connect(m_RemoteMachineAddress);
 }
示例#4
0
        private void Update()
        {
            EmulationMode mode = this.m_Mode;

            if (mode != EmulationMode.Simulated)
            {
                if (mode == EmulationMode.RemoteDevice)
                {
                    HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();
                    if (connectionState != this.m_LastConnectionState)
                    {
                        base.Repaint();
                    }
                    HolographicStreamerConnectionFailureReason holographicStreamerConnectionFailureReason = PerceptionRemotingPlugin.CheckForDisconnect();
                    if (holographicStreamerConnectionFailureReason == HolographicStreamerConnectionFailureReason.Unreachable || holographicStreamerConnectionFailureReason == HolographicStreamerConnectionFailureReason.ConnectionLost)
                    {
                        Debug.LogWarning("Disconnected with failure reason " + holographicStreamerConnectionFailureReason + ", attempting to reconnect.");
                        this.Connect();
                    }
                    else if (holographicStreamerConnectionFailureReason != HolographicStreamerConnectionFailureReason.None)
                    {
                        Debug.LogError("Disconnected with error " + holographicStreamerConnectionFailureReason);
                    }
                    this.m_LastConnectionState = connectionState;
                }
            }
            else
            {
                HolographicEmulation.SetGestureHand(this.m_Hand);
            }
        }
示例#5
0
 private void HandleButtonPress()
 {
     if (EditorApplication.isPlayingOrWillChangePlaymode)
     {
         Debug.LogError("Unable to connect / disconnect remoting while playing.");
     }
     else
     {
         HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();
         if (connectionState == HolographicStreamerConnectionState.Connecting || connectionState == HolographicStreamerConnectionState.Connected)
         {
             this.Disconnect();
         }
         else if (this.RemoteMachineNameSpecified)
         {
             this.Connect();
         }
         else
         {
             Debug.LogError("Cannot connect without a remote machine address specified");
         }
     }
 }
示例#6
0
 internal static HolographicStreamerConnectionState GetConnectionState()
 {
     return(PerceptionRemotingPlugin.GetConnectionState_Internal());
 }
示例#7
0
 internal static HolographicStreamerConnectionFailureReason CheckForDisconnect()
 {
     return(PerceptionRemotingPlugin.CheckForDisconnect_Internal());
 }
        void ConnectionStateGUI()
        {
            if (s_ConnectedTexture == null)
            {
                s_ConnectedTexture    = EditorGUIUtility.LoadIconRequired("sv_icon_dot3_sml");
                s_ConnectingTexture   = EditorGUIUtility.LoadIconRequired("sv_icon_dot4_sml");
                s_DisconnectedTexture = EditorGUIUtility.LoadIconRequired("sv_icon_dot6_sml");
            }

            Texture2D  iconTexture;
            GUIContent labelContent;
            GUIContent buttonContent;
            HolographicStreamerConnectionState connectionState = PerceptionRemotingPlugin.GetConnectionState();

            switch (connectionState)
            {
            case HolographicStreamerConnectionState.Disconnected:
            default:
                iconTexture   = s_DisconnectedTexture;
                labelContent  = s_ConnectionStateDisconnectedText;
                buttonContent = s_ConnectionButtonConnectText;
                break;

            case HolographicStreamerConnectionState.Connecting:
                iconTexture   = s_ConnectingTexture;
                labelContent  = s_ConnectionStateConnectingText;
                buttonContent = s_ConnectionButtonDisconnectText;
                break;

            case HolographicStreamerConnectionState.Connected:
                iconTexture   = s_ConnectedTexture;
                labelContent  = s_ConnectionStateConnectedText;
                buttonContent = s_ConnectionButtonDisconnectText;
                break;
            }

            EditorGUILayout.BeginHorizontal();

            EditorGUILayout.PrefixLabel(s_ConnectionStatusText, "Button");
            float iconSize = EditorGUIUtility.singleLineHeight;
            Rect  iconRect = GUILayoutUtility.GetRect(iconSize, iconSize, GUILayout.ExpandWidth(false));

            GUI.DrawTexture(iconRect, iconTexture);
            EditorGUILayout.LabelField(labelContent);

            EditorGUILayout.EndHorizontal();

            EditorGUI.BeginDisabledGroup(m_InPlayMode);
            bool pressed = EditorGUILayout.DropdownButton(buttonContent, FocusType.Passive, EditorStyles.miniButton);

            EditorGUI.EndDisabledGroup();

            if (pressed)
            {
                if (EditorGUIUtility.editingTextField)
                {
                    EditorGUIUtility.editingTextField = false;
                    GUIUtility.keyboardControl        = 0;
                }
                //we delay the call to let the RemoteMachineAddress control commit the value
                EditorApplication.CallDelayed(() =>
                {
                    HandleButtonPress();
                }, 0f);
            }
        }
 private bool IsConnectedToRemoteDevice()
 {
     return(PerceptionRemotingPlugin.GetConnectionState() == HolographicStreamerConnectionState.Connected);
 }
示例#10
0
        private void ConnectionStateGUI()
        {
            if (HolographicEmulationWindow.s_ConnectedTexture == null)
            {
                HolographicEmulationWindow.s_ConnectedTexture    = EditorGUIUtility.LoadIconRequired("sv_icon_dot3_sml");
                HolographicEmulationWindow.s_ConnectingTexture   = EditorGUIUtility.LoadIconRequired("sv_icon_dot4_sml");
                HolographicEmulationWindow.s_DisconnectedTexture = EditorGUIUtility.LoadIconRequired("sv_icon_dot6_sml");
            }
            Texture2D  image;
            GUIContent label;
            GUIContent content;

            switch (PerceptionRemotingPlugin.GetConnectionState())
            {
            case HolographicStreamerConnectionState.Disconnected:
IL_5D:
                image   = HolographicEmulationWindow.s_DisconnectedTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateDisconnectedText;
                content = HolographicEmulationWindow.s_ConnectionButtonConnectText;
                goto IL_A2;

            case HolographicStreamerConnectionState.Connecting:
                image   = HolographicEmulationWindow.s_ConnectingTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateConnectingText;
                content = HolographicEmulationWindow.s_ConnectionButtonDisconnectText;
                goto IL_A2;

            case HolographicStreamerConnectionState.Connected:
                image   = HolographicEmulationWindow.s_ConnectedTexture;
                label   = HolographicEmulationWindow.s_ConnectionStateConnectedText;
                content = HolographicEmulationWindow.s_ConnectionButtonDisconnectText;
                goto IL_A2;
            }
            goto IL_5D;
IL_A2:
            EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
            EditorGUILayout.PrefixLabel(HolographicEmulationWindow.s_ConnectionStatusText, "Button");
            float singleLineHeight = EditorGUIUtility.singleLineHeight;
            Rect  rect             = GUILayoutUtility.GetRect(singleLineHeight, singleLineHeight, new GUILayoutOption[]
            {
                GUILayout.ExpandWidth(false)
            });

            GUI.DrawTexture(rect, image);
            EditorGUILayout.LabelField(label, new GUILayoutOption[0]);
            EditorGUILayout.EndHorizontal();
            EditorGUI.BeginDisabledGroup(this.m_InPlayMode);
            bool flag = EditorGUILayout.DropdownButton(content, FocusType.Passive, EditorStyles.miniButton, new GUILayoutOption[0]);

            EditorGUI.EndDisabledGroup();
            if (flag)
            {
                if (EditorGUIUtility.editingTextField)
                {
                    EditorGUIUtility.editingTextField = false;
                    GUIUtility.keyboardControl        = 0;
                }
                EditorApplication.CallDelayed(delegate
                {
                    this.HandleButtonPress();
                }, 0f);
            }
        }
 private void Disconnect()
 {
     PerceptionRemotingPlugin.Disconnect();
 }