/// <summary> /// Reset permissions flags. /// </summary> private void _ResetPermissionsFlags() { if (m_requiredPermissions == PermissionsTypes.NONE) { m_requiredPermissions |= m_enableMotionTracking ? PermissionsTypes.MOTION_TRACKING : PermissionsTypes.NONE; m_requiredPermissions |= m_enableAreaLearning ? PermissionsTypes.AREA_LEARNING : PermissionsTypes.NONE; } }
/// <summary> /// A Tango permission was denied. /// </summary> private void _PermissionWasDenied() { m_requiredPermissions = PermissionsTypes.NONE; if (m_permissionEvent != null) { _SendPermissionEvent(false); } }
/// <summary> /// Flip a permission bit and check to see if all permissions were accepted. /// </summary> /// <param name="permission">Permission.</param> private void _FlipBitAndCheckPermissions(PermissionsTypes permission) { m_requiredPermissions ^= permission; if (m_requiredPermissions == 0) // all permissions are good! { Debug.Log("All permissions have been accepted!"); _SendPermissionEvent(true); } else { _RequestNextPermission(); } }
/// <summary> /// EventHandler for Android's on activity result. /// </summary> /// <param name="requestCode">Request code.</param> /// <param name="resultCode">Result code.</param> /// <param name="data">Data.</param> private void _androidOnActivityResult(int requestCode, int resultCode, AndroidJavaObject data) { Debug.Log("Activity returned result code : " + resultCode); // was it accepted? if (resultCode == (int)Common.AndroidResult.SUCCESS) { Debug.Log("Toggle these permissions"); if (requestCode == Common.TANGO_MOTION_TRACKING_PERMISSIONS_REQUEST_CODE) { m_requiredPermissions ^= PermissionsTypes.MOTION_TRACKING; } else if (requestCode == Common.TANGO_ADF_LOAD_SAVE_PERMISSIONS_REQUEST_CODE) { m_requiredPermissions ^= PermissionsTypes.AREA_LEARNING; } // are we still waiting on permissions? if (m_requiredPermissions == 0) // all permissions are good! { Debug.Log("All permissions have been accepted!"); if (m_permissionEvent != null) { Debug.Log("Firing permission event with value TRUE!"); m_permissionEvent(true); } } else { Debug.Log("Firing permission event with value FALSE!"); _RequestNextPermission(); } } else { m_requiredPermissions = PermissionsTypes.NONE; if (m_permissionEvent != null) { m_permissionEvent(false); } } }
/// <summary> /// Reset permissions flags. /// </summary> private void _ResetPermissionsFlags() { if (m_requiredPermissions == PermissionsTypes.NONE) { m_requiredPermissions |= m_enableAreaLearning ? PermissionsTypes.AREA_LEARNING : PermissionsTypes.NONE; m_requiredPermissions |= m_enableADFLoading ? PermissionsTypes.AREA_LEARNING : PermissionsTypes.NONE; } }
/// <summary> /// Reset permissions flags. /// </summary> private void _ResetPermissionsFlags() { if (m_requiredPermissions == PermissionsTypes.NONE) { m_requiredPermissions |= m_enableAreaDescriptions ? PermissionsTypes.AREA_LEARNING : PermissionsTypes.NONE; } }
/// <summary> /// EventHandler for Android's on activity result. /// </summary> /// <param name="requestCode">Request code.</param> /// <param name="resultCode">Result code.</param> /// <param name="data">Data.</param> private void _androidOnActivityResult(int requestCode, int resultCode, AndroidJavaObject data) { Debug.Log("Activity returned result code : " + resultCode); // was it accepted? if(resultCode == (int)Common.AndroidResult.SUCCESS) { Debug.Log("Toggle these permissions"); if(requestCode == Common.TANGO_MOTION_TRACKING_PERMISSIONS_REQUEST_CODE) { m_requiredPermissions ^= PermissionsTypes.MOTION_TRACKING; } else if(requestCode == Common.TANGO_ADF_LOAD_SAVE_PERMISSIONS_REQUEST_CODE) { m_requiredPermissions ^= PermissionsTypes.AREA_LEARNING; } // are we still waiting on permissions? if(m_requiredPermissions == 0) // all permissions are good! { Debug.Log("All permissions have been accepted!"); if(m_permissionEvent != null) { Debug.Log("Firing permission event with value TRUE!"); m_permissionEvent(true); } } else { Debug.Log("Firing permission event with value FALSE!"); _RequestNextPermission(); } } else { m_requiredPermissions = PermissionsTypes.NONE; if(m_permissionEvent != null) { m_permissionEvent(false); } } }
/// <summary> /// Reset permissions flags. /// </summary> private void _ResetPermissionsFlags() { #if UNITY_EDITOR m_requiredPermissions = PermissionsTypes.NONE; #else if (m_requiredPermissions == PermissionsTypes.NONE) { m_requiredPermissions |= (m_enableAreaDescriptions && !m_enableDriftCorrection) ? PermissionsTypes.AREA_LEARNING : PermissionsTypes.NONE; } // It is always required to rebind to the service. m_requiredPermissions |= PermissionsTypes.SERVICE_BOUND; #endif }