コード例 #1
0
        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);
        }
コード例 #2
0
 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.");
     }
 }
コード例 #3
0
 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.");
     }
 }
コード例 #4
0
 public RssiEventArgs(Myo myo, DateTime timestamp, sbyte rssi)
     : base(myo, timestamp)
 {
     this.Rssi = rssi;
 }
コード例 #5
0
 public PoseEventArgs(Myo myo, DateTime timestamp, Pose pose)
     : base(myo, timestamp)
 {
     this.Pose = pose;
 }
コード例 #6
0
 public TrainingEventArgs(Myo myo, DateTime timestamp, byte value, byte progress)
     : base(myo, timestamp)
 {
     this.Value    = value;
     this.Progress = progress;
 }
コード例 #7
0
 public RssiEventArgs(Myo myo, DateTime timestamp, sbyte rssi)
     : base(myo, timestamp)
 {
     this.Rssi = rssi;
 }
コード例 #8
0
 public PoseEventArgs(Myo myo, DateTime timestamp, Pose pose)
     : base(myo, timestamp)
 {
     this.Pose = pose;
 }
コード例 #9
0
 public GyroscopeDataEventArgs(Myo myo, DateTime timestamp, Vector3 gyroscope)
     : base(myo, timestamp)
 {
     this.Gyroscope = gyroscope;
 }
コード例 #10
0
 public ArmSyncedEventArgs(Myo myo, DateTime timestamp, Arm arm, XDirection xDirection)
     : base(myo, timestamp)
 {
     this.Arm        = arm;
     this.XDirection = xDirection;
 }
コード例 #11
0
ファイル: EventTypes.cs プロジェクト: kaivan29/MyoHero
 public EmgDataEventArgs(Myo myo, DateTime timestamp, int[] emg)
     : base(myo, timestamp)
 {
     this.Emg = emg;
 }
コード例 #12
0
 public EmgEventArgs(Myo myo, DateTime timestamp, sbyte[] emg)
     : base(myo, timestamp)
 {
     this.Emg = emg;
 }
コード例 #13
0
 public EmgDataEventArgs(Myo myo, DateTime timestamp, int[] emg)
     : base(myo, timestamp)
 {
     this.Emg = emg;
 }
コード例 #14
0
 public EmgEventArgs(Myo myo, DateTime timestamp, Dictionary <int, sbyte> emg)
     : base(myo, timestamp)
 {
     this.Emg = emg;
 }
コード例 #15
0
 public MyoEventArgs(Myo myo, DateTime timestamp)
 {
     this.Myo = myo;
     this.Timestamp = timestamp;
 }
コード例 #16
0
		public EmgEventArgs (Myo myo, DateTime timestamp, Dictionary<int, sbyte> emg)
			: base (myo, timestamp)
		{
			this.Emg = emg;
		}
コード例 #17
0
 public ArmSyncedEventArgs(Myo myo, DateTime timestamp, Arm arm, XDirection xDirection)
     : base(myo, timestamp)
 {
     this.Arm = arm;
     this.XDirection = xDirection;
 }
コード例 #18
0
 public AccelerometerDataEventArgs(Myo myo, DateTime timestamp, Vector3 accelerometer)
     : base(myo, timestamp)
 {
     this.Accelerometer = accelerometer;
 }
コード例 #19
0
 public AccelerometerDataEventArgs(Myo myo, DateTime timestamp, Vector3 accelerometer)
     : base(myo, timestamp)
 {
     this.Accelerometer = accelerometer;
 }
コード例 #20
0
 public OrientationDataEventArgs(Myo myo, DateTime timestamp, Quaternion orientation)
     : base(myo, timestamp)
 {
     this.Orientation = orientation;
 }
コード例 #21
0
 public GyroscopeDataEventArgs(Myo myo, DateTime timestamp, Vector3 gyroscope)
     : base(myo, timestamp)
 {
     this.Gyroscope = gyroscope;
 }
コード例 #22
0
 public MyoEventArgs(Myo myo, DateTime timestamp)
 {
     this.Myo       = myo;
     this.Timestamp = timestamp;
 }
コード例 #23
0
 public OrientationDataEventArgs(Myo myo, DateTime timestamp, Quaternion orientation)
     : base(myo, timestamp)
 {
     this.Orientation = orientation;
 }
コード例 #24
0
ファイル: Hub.cs プロジェクト: Ozhogi/WearablePack-Myo
        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;
        }
コード例 #25
0
 public EmgEventArgs(Myo myo, DateTime timestamp, sbyte[] emg)
     : base(myo, timestamp)
 {
     this.Emg = emg;
 }