private static libmyo.HandlerResult HandleEvent(IntPtr userData, IntPtr evt) { GCHandle handle = (GCHandle)userData; Hub self = (Hub)handle.Target; var type = libmyo.event_get_type(evt); var timestamp = TIMESTAMP_EPOCH.AddMilliseconds(libmyo.event_get_timestamp(evt) / 1000); var myoHandle = libmyo.event_get_myo(evt); switch (type) { case libmyo.EventType.Paired: var myo = new Myo(self, myoHandle); self._myos.Add(myoHandle, myo); if (self.Paired != null) { self.Paired(self, new MyoEventArgs(myo, DateTime.Now)); } break; default: Debug.Assert(self._myos[myoHandle] != null); self._myos[myoHandle].HandleEvent(type, timestamp, evt); break; } return(libmyo.HandlerResult.Continue); }
internal TrainingData(Myo myo) { _myo = myo; //TODO/NOTE: leak this until we move ownership of the training data to libmyo's Myo if (libmyo.training_create_dataset(_myo.Handle, out _handle, IntPtr.Zero) != libmyo.Result.Success) { throw new InvalidOperationException("Unable to create training data."); } }
public RssiEventArgs(Myo myo, DateTime timestamp, sbyte rssi) : base(myo, timestamp) { this.Rssi = rssi; }
public PoseEventArgs(Myo myo, DateTime timestamp, Pose pose) : base(myo, timestamp) { this.Pose = pose; }
public TrainingEventArgs(Myo myo, DateTime timestamp, byte value, byte progress) : base(myo, timestamp) { this.Value = value; this.Progress = progress; }
public GyroscopeDataEventArgs(Myo myo, DateTime timestamp, Vector3 gyroscope) : base(myo, timestamp) { this.Gyroscope = gyroscope; }
public ArmSyncedEventArgs(Myo myo, DateTime timestamp, Arm arm, XDirection xDirection) : base(myo, timestamp) { this.Arm = arm; this.XDirection = xDirection; }
public EmgDataEventArgs(Myo myo, DateTime timestamp, int[] emg) : base(myo, timestamp) { this.Emg = emg; }
public EmgEventArgs(Myo myo, DateTime timestamp, sbyte[] emg) : base(myo, timestamp) { this.Emg = emg; }
public EmgEventArgs(Myo myo, DateTime timestamp, Dictionary <int, sbyte> emg) : base(myo, timestamp) { this.Emg = emg; }
public MyoEventArgs(Myo myo, DateTime timestamp) { this.Myo = myo; this.Timestamp = timestamp; }
public EmgEventArgs (Myo myo, DateTime timestamp, Dictionary<int, sbyte> emg) : base (myo, timestamp) { this.Emg = emg; }
public AccelerometerDataEventArgs(Myo myo, DateTime timestamp, Vector3 accelerometer) : base(myo, timestamp) { this.Accelerometer = accelerometer; }
public OrientationDataEventArgs(Myo myo, DateTime timestamp, Quaternion orientation) : base(myo, timestamp) { this.Orientation = orientation; }
private static libmyo.HandlerResult HandleEvent(IntPtr userData, IntPtr evt) { GCHandle handle = (GCHandle)userData; Hub self = (Hub)handle.Target; var type = libmyo.event_get_type(evt); var timestamp = TIMESTAMP_EPOCH.AddMilliseconds(libmyo.event_get_timestamp(evt) / 1000); var myoHandle = libmyo.event_get_myo(evt); switch (type) { case libmyo.EventType.Paired: var myo = new Myo(self, myoHandle); self._myos.Add(myoHandle, myo); if (self.Paired != null) { self.Paired(self, new MyoEventArgs(myo, DateTime.Now)); } break; default: Debug.Assert(self._myos[myoHandle] != null); self._myos[myoHandle].HandleEvent(type, timestamp, evt); break; } return libmyo.HandlerResult.Continue; }