//------------------------------------------------------------------------------------------------------------------------------------ // Communication methods. #region Communication /// <summary> /// Extract a SenseGlove matching the parameters of this SenseGlove_Object from a list retieved by the SenseGloveCs.DeviceScanner. /// </summary> /// <param name="devices"></param> /// <returns></returns> private SenseGlove ExtractSenseGlove(SenseGloveCs.IODevice[] devices) { for (int i = 0; i < devices.Length; i++) { if (devices[i] is SenseGlove) { SenseGlove tempGlove = ((SenseGlove)devices[i]); GloveData tempData = tempGlove.GetData(false); //SenseGlove_Debugger.Log("Dataloaded = " + tempData.dataLoaded + ". IsUsed = " + SenseGlove_Manager.IsUsed(tempData.deviceID) + ". isRight = " + tempData.isRight); if (tempData.dataLoaded && !SenseGlove_Manager.IsUsed(tempData.deviceID)) { //the SenseGlove is done loading data AND is not already in memory if ((this.connectionMethod == ConnectionMethod.FindNextGlove) || (this.connectionMethod == ConnectionMethod.FindNextLeftHand && !tempData.isRight) || (this.connectionMethod == ConnectionMethod.FindNextRightHand && tempData.isRight)) { return(tempGlove); } } } } return(null); }
/// <summary> Create a new instance of the GloveDetectedArgs. </summary> /// <param name="glove"></param> public GloveDetectedArgs(SenseGlove glove, int gloveIndex) { this.DeviceID = glove.GetData(false).deviceID; this.RightHanded = glove.IsRight(); this.DeviceIndex = gloveIndex; }