예제 #1
0
    private void CheckHostingProgress()
    {
        numOfSuccess = 0;
        numOfFailed  = 0;
        numOfUnable  = 0;
        for (i = 0; i < numOfQueued; i++)
        {
            if (cloudAnchorList[i] != null)
            {
                CloudAnchorState cloudAnchorState = cloudAnchorList[i].cloudAnchorState;
                if (cloudAnchorState == CloudAnchorState.Success)
                {
                    // _arDebugManager.LogError($"Anchor #{(i + 1).ToString()} successfully hosted");

                    // keep track of cloud anchors added
                    anchorToResolveList[i] = cloudAnchorList[i].cloudAnchorId;
                    numOfSuccess++;
                }
                else if (cloudAnchorState != CloudAnchorState.TaskInProgress)
                {
                    _arDebugManager.LogError($"Fail to host anchor #{(i + 1).ToString()} with state: {cloudAnchorState}");
                    numOfFailed++;
                }
            }
            else
            {
                numOfUnable++;
                // _arDebugManager.LogError($"Firsttttttttt #{(i + 1).ToString()}, numOfUnable ={numOfUnable}");
                _arDebugManager.LogError($"Unable to host cloud anchor #{(i + 1).ToString()}, numOfUnable ={numOfUnable}");
            }
        }

        if (numOfFailed != 0 || numOfUnable != 0)
        {
            _arDebugManager.LogInfo($"Too much unable/failed to host, please pick anchor again");
            anchorUpdateInProgress = false;
            _arPlacementManager.RemovePlacements();
        }

        if (numOfSuccess == numOfQueued)
        {
            anchorUpdateInProgress = false;
            numOfToBeResolved      = numOfSuccess;

            // _cloudAnchorsMetaManager.join((int)quality);
            // _cloudAnchorsMetaManager.join();
            // _cloudAnchorsMetaManager.uploadAnchorToResolveList(anchorToResolveList);

            for (i = 0; i < numOfSuccess; i++)
            {
                _arDebugManager.LogError($"Anchor #{(i + 1).ToString()} successfully hosted, id = {anchorToResolveList[i]}");
            }

            _arDebugManager.LogError($"Cloud Anchors ID uploaded to session");
        }
    }
예제 #2
0
    private void CheckHostingProgress()
    {
        numOfSuccess = 0;
        numOfFailed  = 0;
        numOfUnable  = 0;
        for (i = 0; i < numOfQueued; i++)
        {
            if (cloudAnchorList[i] != null)
            {
                CloudAnchorState cloudAnchorState = cloudAnchorList[i].cloudAnchorState;
                if (cloudAnchorState == CloudAnchorState.Success)
                {
                    // _arDebugManager.LogError($"Anchor #{(i + 1).ToString()} successfully hosted");

                    // keep track of cloud anchors added
                    anchorToResolveList[i] = cloudAnchorList[i].cloudAnchorId;
                    numOfSuccess++;
                }
                else if (cloudAnchorState != CloudAnchorState.TaskInProgress)
                {
                    _arDebugManager.LogError($"Fail to host anchor #{(i + 1).ToString()} with state: {cloudAnchorState}");
                    numOfFailed++;
                }
                else
                {
                    // arDebugManager.LogInfo($"CheckHostingProgress #{(i + 1).ToString()}");
                    // arDebugManager.LogInfo($"#{(i + 1).ToString()}: NumOfCloudAnchor() = {NumOfCloudAnchor().ToString()}");
                }
            }
            else
            {
                numOfUnable++;
                _arDebugManager.LogError($"Unable to host cloud anchor #{(i + 1).ToString()}, numOfUnable ={numOfUnable}");
                // TODO: Remove the broken anchor and allow ARPlacementManger to add one new anchor to pendingHostAnchorList
            }
        }

        if (numOfFailed != 0 || numOfUnable != 0)
        {
            _arDebugManager.LogInfo($"Too much unable/failed to host, please pick anchor again");
            anchorUpdateInProgress = false;
            _arPlacementManager.RemovePlacements();
        }

        if (numOfSuccess == numOfQueued)
        {
            anchorUpdateInProgress = false;
            numOfToBeResolved      = numOfSuccess;

            for (i = 0; i < numOfSuccess; i++)
            {
                _arDebugManager.LogError($"Anchor #{(i + 1).ToString()} successfully hosted");
            }

            _arCloudAnchorsMetaManger.SendUpdate(anchorToResolveList);
        }
    }