/// <summary> Fires when the Sense Glove has calculated new finger Lengths. </summary> /// <param name="source"></param> /// <param name="args"></param> private void SenseGlove_OnCalibrationFinished(object source, CalibrationArgs args) { if (this.canUpdate) { //the new gloveLengths have already been applied to the SenseGlove-Object, but should be updated in the database. HandProfile updatedProfile = new HandProfile(args.newFingerLengths); UserProfiles.AddEntry(this.userName, updatedProfile); //update / add entry SenseGlove_Debugger.Log("Updated " + this.userName); } }
//-------------------------------------------------------------------------------------- // Profile / Class Methods /// <summary> If this user exists within the database, apply their hand profile to this SenseGlove_Object. </summary> /// <param name="userName"></param> public void SetProfile(string name) { if (userName != null && userName.Length > 0) { this.canUpdate = false; this.userName = name; UserProfiles.SetLastUser(this.userName, this.senseGlove.GloveData().deviceID); HandProfile newProfile = UserProfiles.GetProfile(name); this.SetProfile(newProfile); SenseGlove_Debugger.Log("Set Profile for " + this.userName); this.canUpdate = true; //prevent additional calls to fingerCalibrationFinished while we update the profile. } else { SenseGlove_Debugger.LogWarning("Invalid Username"); } }
/// <summary> Apply the desired hand profile to the Sense Glove connected to this Profile </summary> /// <param name="profile"></param> private void SetProfile(HandProfile profile) { this.SetProfile(profile.fingerLengths); }