/// <summary>
 /// Register to get Tango event callbacks.
 /// 
 /// NOTE: Tango event callbacks happen on a different thread than the main
 /// Unity thread.
 /// </summary>
 internal virtual void SetCallback()
 {
     m_onEventAvaialableCallback = new TangoEvents.TangoService_onEventAvailable(_onEventAvailable);
     TangoEvents.SetCallback(m_onEventAvaialableCallback);
     m_tangoEvent = new TangoEvent();
     m_isDirty = false;
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Register to get Tango event callbacks.
 ///
 /// NOTE: Tango event callbacks happen on a different thread than the main
 /// Unity thread.
 /// </summary>
 internal virtual void SetCallback()
 {
     m_onEventAvaialableCallback = new TangoEvents.TangoService_onEventAvailable(_onEventAvailable);
     TangoEvents.SetCallback(m_onEventAvaialableCallback);
     m_tangoEvent = new TangoEvent();
     m_isDirty    = false;
 }
 /// <summary>
 /// This is called each time a Tango event happens.
 /// </summary>
 /// <param name="tangoEvent">Tango event.</param>
 public void OnTangoEventAvailableEventHandler(Tango.TangoEvent tangoEvent)
 {
     if (tangoEvent.type == TangoEnums.TangoEventType.TANGO_EVENT_AREA_LEARNING &&
         tangoEvent.event_key == "AreaDescriptionSaveProgress")
     {
         m_adfSavePercentComplete = float.Parse(tangoEvent.event_value);
     }
 }
 /// <summary>
 /// DEPRECATED: Handle the callback sent by the Tango Service
 /// when a new event is issued.
 /// </summary>
 /// <param name="callbackContext">Callback context.</param>
 /// <param name="tangoEvent">Tango event.</param>
 protected void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
 {
     if (tangoEvent != null)
     {
         m_previousEvent.timestamp   = tangoEvent.timestamp;
         m_previousEvent.type        = tangoEvent.type;
         m_previousEvent.event_key   = tangoEvent.event_key;
         m_previousEvent.event_value = tangoEvent.event_value;
         m_isDirty = true;
     }
 }
Ejemplo n.º 5
0
    /// <summary>
    /// This is called each time a Tango event happens.
    /// </summary>
    /// <param name="tangoEvent">Tango event.</param>
    public void OnTangoEventAvailableEventHandler(Tango.TangoEvent tangoEvent)
    {
        // We will not have the saving progress when the learning mode is off.
        if (!m_tangoApplication.m_areaDescriptionLearningMode)
        {
            return;
        }

        if (tangoEvent.type == TangoEnums.TangoEventType.TANGO_EVENT_AREA_LEARNING &&
            tangoEvent.event_key == "AreaDescriptionSaveProgress")
        {
            m_savingText.text = "Saving. " + (float.Parse(tangoEvent.event_value) * 100) + "%";
        }
    }
        /// <summary>
        /// Stop getting Tango event callbacks.
        /// </summary>
        internal static void Reset()
        {
            // Avoid calling into tango_client_api before the correct library is loaded.
            if (m_onEventAvailableCallback != null)
            {
                TangoEventProvider.ClearCallback();
            }

            m_onEventAvailableCallback = null;
            m_onTangoEventAvailable = null;
            m_onTangoEventMultithreadedAvailable = null;
            m_tangoEvent = new TangoEvent();
            m_isDirty = false;
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Stop getting Tango event callbacks.
        /// </summary>
        internal static void Reset()
        {
            // Avoid calling into tango_client_api before the correct library is loaded.
            if (m_onEventAvailableCallback != null)
            {
                TangoEventProvider.ClearCallback();
            }

            m_onEventAvailableCallback           = null;
            m_onTangoEventAvailable              = null;
            m_onTangoEventMultithreadedAvailable = null;
            m_tangoEvent = new TangoEvent();
            m_isDirty    = false;
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Handle the callback sent by the Tango Service when a new event is issued.
        /// </summary>
        /// <param name="callbackContext">Callback context.</param>
        /// <param name="tangoEvent">Tango event.</param>
        private void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
        {
            if (tangoEvent != null)
            {
                if (m_onTangoEventMultithreadedAvailable != null)
                {
                    m_onTangoEventMultithreadedAvailable(tangoEvent);
                }

                lock (m_lockObject)
                {
                    m_tangoEvent.timestamp   = tangoEvent.timestamp;
                    m_tangoEvent.type        = tangoEvent.type;
                    m_tangoEvent.event_key   = tangoEvent.event_key;
                    m_tangoEvent.event_value = tangoEvent.event_value;
                    m_isDirty = true;
                }
            }
        }
    /// <summary>
    /// Initialize the controller.
    /// </summary>
    void Start ()
    {
        m_eventString = string.Empty;
        m_tangoApplication = GameObject.FindObjectOfType<TangoApplication>();
		m_previousEvent = new TangoEvent();
    }
 /// <summary>
 /// DEPRECATED: Handle the callback sent by the Tango Service
 /// when a new event is issued.
 /// </summary>
 /// <param name="callbackContext">Callback context.</param>
 /// <param name="tangoEvent">Tango event.</param>
 protected void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
 {
     if (tangoEvent != null)
     {
         m_previousEvent.timestamp = tangoEvent.timestamp;
         m_previousEvent.type = tangoEvent.type;
         m_previousEvent.event_key = tangoEvent.event_key;
         m_previousEvent.event_value = tangoEvent.event_value;
         m_isDirty = true;
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Handle the callback sent by the Tango Service
 /// when a new event is issued.
 /// </summary>
 /// <param name="callbackContext">Callback context.</param>
 /// <param name="tangoEvent">Tango event.</param>
 protected abstract void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent);
Ejemplo n.º 12
0
        /// <summary>
        /// Handle the callback sent by the Tango Service when a new event is issued.
        /// </summary>
        /// <param name="callbackContext">Callback context.</param>
        /// <param name="tangoEvent">Tango event.</param>
        private void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
        {
            if (tangoEvent != null)
            {
                if (m_onTangoEventMultithreadedAvailable != null)
                {
                    m_onTangoEventMultithreadedAvailable(tangoEvent);
                }

                lock (m_lockObject)
                {
                    m_tangoEvent.timestamp = tangoEvent.timestamp;
                    m_tangoEvent.type = tangoEvent.type;
                    m_tangoEvent.event_key = tangoEvent.event_key;
                    m_tangoEvent.event_value = tangoEvent.event_value;
                    m_isDirty = true;
                }
            }
        }
Ejemplo n.º 13
0
 protected override void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
 {
     Debug.Log("Tango event fired : " + tangoEvent.event_value);
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Handle the callback sent by the Tango Service
 /// when a new Tango event is sampled.
 /// DO NOT USE THE UNITY API FROM INSIDE THIS FUNCTION!
 /// </summary>
 /// <param name="callbackContext">Callback context.</param>
 /// <param name="tangoEvent">Tango event.</param>
 protected override void _onEventAvailable(IntPtr callbackContext, TangoEvent tangoEvent)
 {
     m_eventString = tangoEvent.event_key + ": " + tangoEvent.event_value;
 }