コード例 #1
0
ファイル: NewDeviceDiscovery.cs プロジェクト: hekemp/ChessXR
        /// <summary>
        /// Starts the system. In server mode or client mode depending on isHost
        /// </summary>
        public void ManualStart()
        {
            Initialize();

            // In this case the host will be listening for a phone to ping it in order to switch on the camera
            if (isHost)
            {
                // As a host, we start listening for a ping to turn on the camera
                if (MarkerDetectionHololens == null)
                {
                    MarkerDetectionHololens = FindObjectOfType <MarkerDetectionHololens>();
                }
                StartAsClient();
            }
            else
            {
                StartAsServer();
            }
        }
コード例 #2
0
        // When discovering new devices the host listens to broadcasts to tell it to start looking for devices

        #region Host

        /// <summary>
        /// Called on the HoloLens when receiving a broadcast from a phone. It'll keep alive the scanning
        /// </summary>
        /// <param name="fromAddress">IP address that broadcasted the message</param>
        /// <param name="data">Broadcast message read</param>
        public override void OnReceivedBroadcast(string fromAddress, string data)
        {
            base.OnReceivedBroadcast(fromAddress, data);
            MarkerDetectionHololens.StartCapture();
        }