/// <summary>
        /// When the user presses "Start Streaming Steam", first check that they are paired
        /// </summary>
        public static async Task <StreamContext> StartStreaming(CoreDispatcher uiDispatcher, Computer computer, MoonlightStreamConfiguration streamConfig)
        {
            PairingManager p = new PairingManager(computer);

            // If we can't get the pair state, return
            bool?pairState = await p.QueryPairState();

            if (!pairState.HasValue)
            {
                DialogUtils.DisplayDialog(uiDispatcher, "Pair state query failed", "Failed to start streaming");
                return(null);
            }

            // If we're not paired, return
            if (pairState == false)
            {
                DialogUtils.DisplayDialog(uiDispatcher, "Device not paired", "Failed to start streaming");
                return(null);
            }

            // Lookup the desired app in the app list
            // NOTE: This will go away when we have a proper app list
            int appId = await LookupAppIdForApp(uiDispatcher, new NvHttp(computer.IpAddress), "Steam");

            if (appId == 0)
            {
                // LookupAppIdForApp() handles displaying a failure dialog
                return(null);
            }

            return(new StreamContext(computer, appId, streamConfig));
        }
        /// <summary>
        /// When the user presses "Start Streaming Steam", first check that they are paired
        /// </summary>
        public static async Task<StreamContext> StartStreaming(CoreDispatcher uiDispatcher, Computer computer, MoonlightStreamConfiguration streamConfig)
        {
            PairingManager p = new PairingManager(computer); 

            // If we can't get the pair state, return   
            bool? pairState = await p.QueryPairState();
            if (!pairState.HasValue)
            {
                DialogUtils.DisplayDialog(uiDispatcher, "Pair state query failed", "Failed to start streaming");
                return null;
            }

            // If we're not paired, return
            if (pairState == false)
            {
                DialogUtils.DisplayDialog(uiDispatcher, "Device not paired", "Failed to start streaming");
                return null;
            }

            // Lookup the desired app in the app list
            // NOTE: This will go away when we have a proper app list
            int appId = await LookupAppIdForApp(uiDispatcher, new NvHttp(computer.IpAddress), "Steam");
            if (appId == 0)
            {
                // LookupAppIdForApp() handles displaying a failure dialog
                return null;
            }

            return new StreamContext(computer, appId, streamConfig);
        }
Ejemplo n.º 3
0
        public virtual PairingManager GetPairingManager()
        {
            global::System.IntPtr cPtr = SharingClientPINVOKE.SharingManager_GetPairingManager(swigCPtr);
            PairingManager        ret  = (cPtr == global::System.IntPtr.Zero) ? null : new PairingManager(cPtr, true);

            return(ret);
        }
Ejemplo n.º 4
0
        protected void StartPairingManager()
        {
            PairingManager.PairingComplete += PairingManager_PairingComplete;
            PairingManager.Start();

            string pin = PairingManager.PIN;

            pinTextBox1.Text = pin[0].ToString();
            pinTextBox2.Text = pin[1].ToString();
            pinTextBox3.Text = pin[2].ToString();
            pinTextBox4.Text = pin[3].ToString();
        }
Ejemplo n.º 5
0
        private void StartPairing()
        {
            if (sharingMgr != null)
            {
                PairingManager pairingMgr = sharingMgr.GetPairingManager();

                PairingResult result = pairingMgr.BeginPairing(pairMaker, pairingAdapter);
                if (result != PairingResult.Ok)
                {
                    Debug.LogError("Failed to start pairing");
                }
            }
        }
Ejemplo n.º 6
0
        private void OnDestroy()
        {
            // SharingStage's OnDestroy() might execute first in the script order. Therefore we should check if
            // SharingStage.Instance still exists. Without the instance check, the execution of GetPairingManager
            // on a disposed sharing manager will crash the Unity Editor and application.
            if (SharingStage.IsInitialized && sharingMgr != null)
            {
                PairingManager pairingMgr = sharingMgr.GetPairingManager();
                pairingMgr.CancelPairing(); // Safe to call, even if no pairing is in progress.  Will not cause a disconnect

                // Remove our listener from the paired connection
                NetworkConnection pairedConnection = sharingMgr.GetPairedConnection();
                pairedConnection.RemoveListener((byte)MessageID.StatusOnly, connectionAdapter);
            }
        }
Ejemplo n.º 7
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PairingManager obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PairingManager obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }
Ejemplo n.º 9
0
 protected void StopPairingManager()
 {
     PairingManager.PairingComplete -= PairingManager_PairingComplete;
     PairingManager.Stop();
 }