Remote Control zum Einschalten des 3D-Druckers und Bewegen der ebCam im Hobbyraum Brand
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

StatusLoopWorker.java 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package ch.spherICIT.communication;
  2. import com.fazecast.jSerialComm.SerialPort;
  3. import javax.swing.SwingWorker;
  4. public class StatusLoopWorker extends SwingWorker<Void, Void> {
  5. private SerialPort serialPort;
  6. public StatusLoopWorker(SerialPort serialPort) {
  7. this.serialPort = serialPort;
  8. }
  9. @Override
  10. protected Void doInBackground() throws Exception {
  11. long counter = 0;
  12. while (counter < 4) {
  13. if (isCancelled()) {
  14. break;
  15. }
  16. if (counter == 0) {
  17. SerialCommHandler.sendRelaisStatusCommand(this.serialPort);
  18. } else if (counter == 1) {
  19. SerialCommHandler.sendCamStatusCommand(this.serialPort);
  20. } else if (counter == 2) {
  21. SerialCommHandler.sendCamVelocityStatusCommand(this.serialPort);
  22. } else {
  23. SerialCommHandler.sendActualAzimutCommand(this.serialPort);
  24. }
  25. counter++;
  26. Thread.sleep(3000);
  27. }
  28. return null;
  29. }
  30. }