public void SaveGlove(Glove glove) { foreach (Glove g in Glove.Gloves) { if (g.BluetoothAddress.Equals(glove.BluetoothAddress)) { Glove.Gloves.Remove(g); Glove.Gloves.Add(glove); break; } } }
public void broadCastFlexors(string trackingURL) { Dictionary <int, int> flexors; LegacyOpenGlove instance; if (trackingURL.Equals(rightGloveTrackingURL)) { // RightGlove = Glove.getRightlove(); instance = RightGlove.LegacyGlove; flexors = RightGlove.GloveConfiguration.GloveProfile.FlexorsMappings; } else { // LeftGlove = Glove.getLeftGlove(); instance = LeftGlove.LegacyGlove; flexors = LeftGlove.GloveConfiguration.GloveProfile.FlexorsMappings; } TimeSpan stop, start; Boolean iguales = Object.ReferenceEquals(RightGlove, Glove.getRightlove()); trackingData data = new trackingData(); data.FlexorsValues = new Dictionary <int, int>(); data.AccelerometerValues = new Dictionary <int, int>(); while (true) { start = new TimeSpan(DateTime.Now.Ticks); foreach (KeyValuePair <int, int> mapping in flexors) { data.FlexorsValues.Add(mapping.Key, Int32.Parse(instance.AnalogRead(mapping.Value))); } var json = NetJSON.NetJSON.Serialize(data); data.FlexorsValues.Clear(); // wssv.WebSocketServices[trackingURL].Sessions.Broadcast(mapping.Value.ToString() + ": " + instance.AnalogRead(mapping.Value)); wssv.WebSocketServices[trackingURL].Sessions.Broadcast(json); stop = new TimeSpan(DateTime.Now.Ticks); double a = stop.Subtract(start).TotalMilliseconds; // wssv.WebSocketServices[trackingURL].Sessions.Broadcast("tiempo: "+a); Thread.Sleep(delay); } }
public void SaveGlove(Glove glove) { for(int i = 0; i < Glove.Gloves.Count; i++) { if (Glove.Gloves[i].BluetoothAddress.Equals(glove.BluetoothAddress)) { //if (glove.Connected == true && glove.LegacyGlove == null) // { if(Glove.Gloves[i].LegacyGlove != null) { glove.LegacyGlove = Glove.Gloves[i].LegacyGlove; } else { glove.LegacyGlove = new LegacyOpenGlove(); } // } Glove.Gloves[i] = glove; break; } } }
public List <Glove> RefreshGloves() { return(Glove.RefreshGloves()); }
public void setLeftGloveWS(Glove glove) { LeftGlove = glove; }
public void setRightGloveWS(Glove glove) { RightGlove = glove; }