Exemplo n.º 1
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     // Check which request we're responding to
     if (requestCode == Tango.TangoIntentActivitycode)
     {
         // Make sure the request was successful
         if (resultCode == Result.Canceled)
         {
             Toast.MakeText(this, "This app requires Motion Tracking permission!", ToastLength.Long).Show();
             Finish();
             return;
         }
         try
         {
             SetTangoListeners();
         }
         catch (TangoErrorException)
         {
             Toast.MakeText(this, "Tango Error! Restart the app!", Android.Widget.ToastLength.Short).Show();
         }
         try
         {
             mTango.Connect(mConfig);
             mIsTangoServiceConnected = true;
         }
         catch (TangoOutOfDateException)
         {
             Toast.MakeText(ApplicationContext, "Tango Service out of date!", Android.Widget.ToastLength.Short).Show();
         }
         catch (TangoErrorException)
         {
             Toast.MakeText(ApplicationContext, "Tango Error! Restart the app!", Android.Widget.ToastLength.Short).Show();
         }
     }
 }
Exemplo n.º 2
0
 private void StartTango()
 {
     tango = new Tango(this, new Runnable(() =>
     {
         Log.Debug(Tag, "TangoRunnable");
         try
         {
             TangoSupport.Initialize();
             var tangoConfig = GetTangoConfig(tango);
             tango.Connect(tangoConfig);
             TangoAddListeners();
             tango.ConnectTextureId(TangoCameraIntrinsics.TangoCameraColor, -1);
         }
         catch (TangoOutOfDateException e)
         {
             Log.Error(Tag, "TangoOutOfDateException", e);
         }
         catch (TangoErrorException e)
         {
             Log.Error(Tag, "TangoErrorException", e);
         }
         catch (TangoInvalidException e)
         {
             Log.Error(Tag, "TangoInvalidException", e);
         }
     }));
 }
Exemplo n.º 3
0
 protected override void OnResume()
 {
     base.OnResume();
     try
     {
         SetTangoListeners();
     }
     catch (TangoErrorException)
     {
         Toast.MakeText(ApplicationContext, Resource.String.TangoError, Android.Widget.ToastLength.Short).Show();
     }
     try
     {
         mTango.Connect(mConfig);
     }
     catch (TangoOutOfDateException)
     {
         Toast.MakeText(ApplicationContext, Resource.String.TangoOutOfDateException, Android.Widget.ToastLength.Short).Show();
     }
     catch (TangoErrorException)
     {
         Toast.MakeText(ApplicationContext, Resource.String.TangoError, Android.Widget.ToastLength.Short).Show();
     }
     SetUpExtrinsics();
 }
Exemplo n.º 4
0
        public void SurfaceCreated(ISurfaceHolder holder)
        {
            Surface surface = holder.Surface;

            if (surface.IsValid)
            {
                TangoConfig config = new TangoConfig();
                config = mTango.GetConfig(TangoConfig.ConfigTypeCurrent);
                // TODO : Verify Connect doesn't require new set up without ConnectSurface
                //mTango.ConnectSurface(0, surface);
                mTango.Connect(config);
            }
        }
Exemplo n.º 5
0
        private void InitializeMotionTracking(string uuid)
        {
            var config = ConfigInitialize.SetupTangoConfigForNavigating(tango, uuid);

            try
            {
                tango.Connect(config);
                TangoAddListeners();
            }
            catch (TangoOutOfDateException e)
            {
                Log.Error(Tag, "TangoOutOfDateException", e);
            }
            catch (TangoErrorException e)
            {
                Log.Error(Tag, "TangoErrorException", e);
            }
            catch (TangoInvalidException e)
            {
                Log.Error(Tag, "TangoInvalidException", e);
            }
        }
Exemplo n.º 6
0
        protected override void OnResume()
        {
            Log.Debug(Tag, "OnResume");
            base.OnResume();

            _tango = new Tango(this, new Runnable(() =>
            {
                Log.Debug(Tag, "TangoRunnable");
                //try
                //{
                TangoSupport.Initialize();
                _tangoConfig = SetupTangoConfig(_tango);
                _tango.Connect(_tangoConfig);
                startupTango();
                //}
                //catch (TangoOutOfDateException e)
                //{
                //    Log.Error(Tag, GetString(R.
                //    string.exception_out_of_date),
                //    e)
                //    ;
                //}
                //catch (TangoErrorException e)
                //{
                //    Log.Error(Tag, GetString(R.
                //    string.exception_tango_error),
                //    e)
                //    ;
                //}
                //catch (TangoInvalidException e)
                //{
                //    Log.Error(Tag, GetString(R.
                //    string.exception_tango_invalid),
                //    e)
                //    ;
                //}
            }));
        }
Exemplo n.º 7
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
 {
     // Check which request we're responding to
     if (requestCode == Tango.TangoIntentActivitycode)
     {
         Log.Info(TAG, "Triggered");
         // Make sure the request was successful
         if (resultCode == Result.Canceled)
         {
             Toast.MakeText(this, Resource.String.motiontrackingpermission, ToastLength.Long).Show();
             Finish();
             return;
         }
         try
         {
             SetTangoListeners();
         }
         catch (TangoErrorException)
         {
             Toast.MakeText(this, Resource.String.TangoError, Android.Widget.ToastLength.Short).Show();
         }
         try
         {
             mTango.Connect(mConfig);
             mIsTangoServiceConnected = true;
         }
         catch (TangoOutOfDateException)
         {
             Toast.MakeText(ApplicationContext, Resource.String.TangoOutOfDateException, Android.Widget.ToastLength.Short).Show();
         }
         catch (TangoErrorException)
         {
             Toast.MakeText(ApplicationContext, Resource.String.TangoError, Android.Widget.ToastLength.Short).Show();
         }
         SetUpExtrinsics();
     }
 }
Exemplo n.º 8
0
        protected override void OnResume()
        {
            base.OnResume();

            _tango = new Tango(this, new Runnable(() =>
            {
                Log.Debug(Tag, "TangoRunnable");
                try
                {
                    TangoSupport.Initialize();
                    _tangoConfig = SetupTangoConfig(_tango);
                    _tango.Connect(_tangoConfig);
                    _isConnected = true;
                    var adfs     = _tango.ListAreaDescriptions();

                    // get the number of adfs
                    var nr       = adfs.Count;
                    var textView = FindViewById <TextView>(Resource.Id.textView2);

                    RunOnUiThread(() => textView.Text = nr.ToString());
                }
                catch (TangoOutOfDateException e)
                {
                    Log.Error(Tag, "TangoOutOfDateException", e);
                }
                catch (TangoErrorException e)
                {
                    // this exception gets thrown
                    Log.Error(Tag, "TangoErrorException", e);
                }
                catch (TangoInvalidException e)
                {
                    Log.Error(Tag, "TangoInvalidException", e);
                }
            }));
        }