public VibrationDevice(ITactPlayConnection tactPlayConnection) { this.tactPlayConnection = tactPlayConnection; timerThread = new Thread(() => { var interval = new TimeSpan(0, 0, 0, 0, 5); var nextTick = DateTime.Now + interval; while (keepTimerThreadRunning) { while (DateTime.Now < nextTick) { Thread.Sleep(Math.Max((nextTick - DateTime.Now).Milliseconds, 0)); } OnTimedEvent(); nextTick = DateTime.Now + interval; } }); timerThread.Start(); }
public BLEMotor(ITactPlayConnection connection, int motorID) { this.tactPlayConnection = connection; this.motorID = Convert.ToByte(motorID); }