/// Method to get the relevant hand tracker for a specific axis
 ///
 /// @param trackerName the name of the tracker to use.
 /// @return the tracker (null if not found).
 public NIPointTracker GetTracker(string trackerName)
 {
     if (trackerName == null)
     {
         m_context.Log("tried to get tracker with a null name!", NIEventLogger.Categories.Errors, NIEventLogger.Sources.Input);
         return(null); // illegal index.
     }
     for (int i = 0; i < m_trackers.Length; i++)
     {
         if (m_trackers[i] == null)
         {
             continue; // an illegal tracker
         }
         if (trackerName.CompareTo(m_trackers[i].GetTrackerType()) == 0)
         {
             // we found the tracker!
             if (m_references[i] == 0)
             {
                 // first time we access it, we need to init it...
                 if (m_trackers[i].InitTracking(m_context) == false)
                 {
                     m_context.Log("Failed to initialize axis " + trackerName, NIEventLogger.Categories.Errors, NIEventLogger.Sources.Input);
                     return(null);
                 }
             }
             m_references[i]++;
             return(m_trackers[i]);
         }
     }
     return(null); // we didn't find it!
 }
Example #2
0
 /// This does a safe log (i.e. checks if the logger is null before logging
 /// @param str the string to log
 /// @param category the category of the log
 /// @param source the source of the log
 public void Log(string str, NIEventLogger.Categories category, NIEventLogger.Sources source)
 {
     if (m_context != null)
     {
         m_context.Log(str, category, source);
     }
 }
Example #3
0
    // protected methods

    /// an internal method to initialize the context.
    /// @param newContext the context to initialize
    /// @return true on success (which also initializes the context) and false on failure
    /// (releasing is the responsibility of the caller)
    protected virtual bool InitContext(OpenNISettingsManager newContext)
    {
        // checks we have a context and hands.
        if (newContext.Valid == false)
        {
            newContext.Log("received invalid context!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.Hands, NIEventLogger.VerboseLevel.Errors);
            return(false);
        }
        m_context = newContext;
        return(true);
    }
 /// @brief callback for updating structures when calibration ends
 ///
 /// This callback is called when a calibration process ends. If the calibration succeeded
 /// then the user is in a calibrated state, otherwise it starts the calibration process from
 /// scratch.
 /// @param sender who called the callback
 /// @param e the arguments of the event.
 private void CalibrationEndCallback(object sender, CalibrationProgressEventArgs e)
 {
     if (e.ID != m_openNIUserID)
     {
         return; // not us...
     }
     m_settingsManager.Log("finished calibration for user="******" status=" + e.Status, NIEventLogger.Categories.Callbacks, NIEventLogger.Sources.Skeleton, NIEventLogger.VerboseLevel.Verbose);
     if (e.Status == CalibrationStatus.OK)
     {
         UserCalibrationEndSuccess();
     }
     else
     {
         UserCalibrationEndFail(e);
     }
 }
Example #5
0
 /// @brief callback for updating structures when a user is lost
 ///
 /// This callback is called when a user is lost. It removes the user from all structures...
 /// @param sender who called the callback
 /// @param e the arguments of the event.
 private void LostUserCallback(object sender, UserLostEventArgs e)
 {
     m_contextManager.Log("Lost user, userID=" + e.ID, NIEventLogger.Categories.Callbacks, NIEventLogger.Sources.Skeleton, NIEventLogger.VerboseLevel.Verbose);
     RemoveUser(e.ID);
 }
    // protected methods

    /// an internal method to initialize the context. 
    /// @param newContext the context to initialize
    /// @return true on success (which also initializes the context) and false on failure 
    /// (releasing is the responsibility of the caller)
    protected virtual bool InitContext(OpenNISettingsManager newContext)
    {
        // checks we have a context and hands.
        if (newContext.Valid == false)
        {
            newContext.Log("received invalid context!", NIEventLogger.Categories.Initialization, NIEventLogger.Sources.Hands, NIEventLogger.VerboseLevel.Errors);
            return false;
        }
        m_context = newContext;
        return true;
    }