private void ConfigureSensors() { locationProvider.Sensors.GeoLocationEnabled = SensorPermissionHelper.HasGeoLocationPermission(); locationProvider.Sensors.WifiEnabled = SensorPermissionHelper.HasWifiPermission(); locationProvider.Sensors.BluetoothEnabled = SensorPermissionHelper.HasBluetoothPermission(); locationProvider.Sensors.KnownBeaconProximityUuids = CoarseRelocSettings.KnownBluetoothProximityUuids; }
/// <summary> /// Start is called on the frame when a script is enabled just before any /// of the Update methods are called the first time. /// </summary> public override async void Start() { Debug.Log(">>Azure Spatial Anchors Demo Script Start"); base.Start(); if (!SanityCheckAccessConfiguration()) { return; } Debug.Log("Azure Spatial Anchors Demo script started"); enableAdvancingOnSelect = false; EnableCorrectUIControls(); if (CloudManager.Session == null) { await CloudManager.CreateSessionAsync(); } SensorPermissionHelper.RequestSensorPermissions(); }
public async override Task AdvanceDemoAsync() { switch (currentAppState) { case AppState.DemoStepCreateSession: if (CloudManager.Session == null) { await CloudManager.CreateSessionAsync(); } currentCloudAnchor = null; currentAppState = AppState.DemoStepConfigSession; break; case AppState.DemoStepConfigSession: ConfigureSession(); currentAppState = AppState.DemoStepStartSession; break; case AppState.DemoStepStartSession: await CloudManager.StartSessionAsync(); currentAppState = AppState.DemoStepCreateLocationProvider; break; case AppState.DemoStepCreateLocationProvider: locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; currentAppState = AppState.DemoStepConfigureSensors; break; case AppState.DemoStepConfigureSensors: SensorPermissionHelper.RequestSensorPermissions(); ConfigureSensors(); currentAppState = AppState.DemoStepCreateLocalAnchor; break; case AppState.DemoStepCreateLocalAnchor: if (spawnedObject != null) { currentAppState = AppState.DemoStepSaveCloudAnchor; } break; case AppState.DemoStepSaveCloudAnchor: currentAppState = AppState.DemoStepSavingCloudAnchor; await SaveCurrentObjectAnchorToCloudAsync(); break; case AppState.DemoStepStopSession: CloudManager.StopSession(); CleanupSpawnedObjects(); await CloudManager.ResetSessionAsync(); locationProvider = null; currentAppState = AppState.DemoStepCreateSessionForQuery; break; case AppState.DemoStepCreateSessionForQuery: ConfigureSession(); locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; ConfigureSensors(); currentAppState = AppState.DemoStepStartSessionForQuery; break; case AppState.DemoStepStartSessionForQuery: await CloudManager.StartSessionAsync(); currentAppState = AppState.DemoStepLookForAnchorsNearDevice; break; case AppState.DemoStepLookForAnchorsNearDevice: currentAppState = AppState.DemoStepLookingForAnchorsNearDevice; currentWatcher = CreateWatcher(); break; case AppState.DemoStepLookingForAnchorsNearDevice: break; case AppState.DemoStepStopWatcher: if (currentWatcher != null) { currentWatcher.Stop(); currentWatcher = null; } currentAppState = AppState.DemoStepStopSessionForQuery; break; case AppState.DemoStepStopSessionForQuery: CloudManager.StopSession(); currentWatcher = null; locationProvider = null; currentAppState = AppState.DemoStepComplete; break; case AppState.DemoStepComplete: currentCloudAnchor = null; currentAppState = AppState.DemoStepCreateSession; CleanupSpawnedObjects(); break; default: Debug.Log("Shouldn't get here for app state " + currentAppState.ToString()); break; } }
public async override Task AdvanceDemoAsync() { switch (currentAppState) { case AppState.DemoStepCreateSession: if (CloudManager.Session == null) { await CloudManager.CreateSessionAsync(); } currentCloudAnchor = null; currentAppState = AppState.DemoStepConfigSession; break; case AppState.DemoStepConfigSession: ConfigureSession(); currentAppState = AppState.DemoStepStartSession; break; case AppState.DemoStepStartSession: await CloudManager.StartSessionAsync(); currentAppState = AppState.DemoStepCreateLocationProvider; break; case AppState.DemoStepCreateLocationProvider: locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; currentAppState = AppState.DemoStepConfigureSensors; break; case AppState.DemoStepConfigureSensors: SensorPermissionHelper.RequestSensorPermissions(); ConfigureSensors(); currentAppState = AppState.DemoStepCreateLocalAnchor; // Enable advancing to next step on Air Tap, which is an easier interaction for placing the anchor. // (placing the anchor with Air tap automatically advances the demo). enableAdvancingOnSelect = true; break; case AppState.DemoStepCreateLocalAnchor: if (spawnedObject != null) { currentAppState = AppState.DemoStepSaveCloudAnchor; } enableAdvancingOnSelect = false; break; case AppState.DemoStepSaveCloudAnchor: currentAppState = AppState.DemoStepSavingCloudAnchor; await SaveCurrentObjectAnchorToCloudAsync(); break; case AppState.DemoStepStopSession: CloudManager.StopSession(); CleanupSpawnedObjects(); await CloudManager.ResetSessionAsync(); locationProvider = null; currentAppState = AppState.DemoStepCreateSessionForQuery; break; case AppState.DemoStepCreateSessionForQuery: ConfigureSession(); locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; ConfigureSensors(); currentAppState = AppState.DemoStepStartSessionForQuery; break; case AppState.DemoStepStartSessionForQuery: await CloudManager.StartSessionAsync(); currentAppState = AppState.DemoStepLookForAnchorsNearDevice; break; case AppState.DemoStepLookForAnchorsNearDevice: currentAppState = AppState.DemoStepLookingForAnchorsNearDevice; currentWatcher = CreateWatcher(); break; case AppState.DemoStepLookingForAnchorsNearDevice: break; case AppState.DemoStepStopWatcher: if (currentWatcher != null) { currentWatcher.Stop(); currentWatcher = null; } currentAppState = AppState.DemoStepStopSessionForQuery; break; case AppState.DemoStepStopSessionForQuery: CloudManager.StopSession(); currentWatcher = null; locationProvider = null; currentAppState = AppState.DemoStepComplete; break; case AppState.DemoStepComplete: currentCloudAnchor = null; currentAppState = AppState.DemoStepCreateSession; CleanupSpawnedObjects(); break; default: Debug.Log("Shouldn't get here for app state " + currentAppState.ToString()); break; } }
private async Task CreateAnchorsDemoAsync() { switch (currentAppState) { case AppState.DemoStepCreateSession: CleanupSpawnedObjects(); currentCloudAnchor = null; if (CloudManager.Session == null) { await CloudManager.CreateSessionAsync(); ConfigureSession(); await CloudManager.StartSessionAsync(); } else { CloudManager.StopSession(); await CloudManager.ResetSessionAsync(); ConfigureSession(); } locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; SensorPermissionHelper.RequestSensorPermissions(); ConfigureSensors(); currentAppState = AppState.DemoStepCreateLocalAnchor; break; case AppState.DemoStepCreateLocalAnchor: if (spawnedObject != null) { currentAppState = AppState.DemoStepSettingExplanationText; } break; case AppState.DemoStepSettingExplanationText: keyboardInputHelper = spawnedObject.GetComponentInChildren <SystemKeyboardInputHelper>(); if (keyboardInputHelper != null && !string.IsNullOrEmpty(keyboardInputHelper.text)) { explanationText = new Dictionary <string, string>(); explanationText.Add("Explanation", keyboardInputHelper.text); keyboardInputHelper = null; currentAppState = AppState.DemoStepSaveCloudAnchor; } break; case AppState.DemoStepSaveCloudAnchor: currentAppState = AppState.DemoStepSavingCloudAnchor; await SaveCurrentObjectAnchorToCloudAsync(); currentAppState = AppState.DemoStepReplay; spawnedObject = null; currentCloudAnchor = null; break; case AppState.DemoStepReplay: break; case AppState.DemoStepStopSession: CloudManager.StopSession(); CleanupSpawnedObjects(); await CloudManager.ResetSessionAsync(); locationProvider = null; currentAppState = AppState.DemoStepComplete; break; case AppState.DemoStepComplete: currentCloudAnchor = null; currentAppState = AppState.DemoStepSettingMode; CleanupSpawnedObjects(); break; } }
private async Task LocateAnchorsDemoAsync() { switch (currentAppState) { case AppState.DemoStepCreateSessionForQuery: CleanupSpawnedObjects(); currentCloudAnchor = null; if (CloudManager.Session == null) { await CloudManager.CreateSessionAsync(); ConfigureSession(); await CloudManager.StartSessionAsync(); } else { CloudManager.StopSession(); await CloudManager.ResetSessionAsync(); ConfigureSession(); } locationProvider = new PlatformLocationProvider(); CloudManager.Session.LocationProvider = locationProvider; SensorPermissionHelper.RequestSensorPermissions(); ConfigureSensors(); currentAppState = AppState.DemoStepLookForAnchorsNearDevice; break; case AppState.DemoStepLookForAnchorsNearDevice: currentAppState = AppState.DemoStepLookingForAnchorsNearDevice; currentWatcher = CreateWatcher(); break; case AppState.DemoStepLookingForAnchorsNearDevice: break; case AppState.DemoStepStopWatcher: if (currentWatcher != null) { currentWatcher.Stop(); currentWatcher = null; } break; case AppState.DemoStepStopSessionForQuery: CloudManager.StopSession(); currentWatcher = null; locationProvider = null; currentAppState = AppState.DemoStepComplete; break; case AppState.DemoStepComplete: currentCloudAnchor = null; currentAppState = AppState.DemoStepSettingMode; CleanupSpawnedObjects(); break; default: Debug.Log("Shouldn't get here for app state " + currentAppState.ToString()); break; } }