| 1234567891011121314151617181920212223242526272829303132333435363738 |
- package ch.spherICIT.communication;
-
- import com.fazecast.jSerialComm.SerialPort;
-
- import javax.swing.SwingWorker;
-
- public class StatusLoopWorker extends SwingWorker<Void, Void> {
-
- private SerialPort serialPort;
-
- public StatusLoopWorker(SerialPort serialPort) {
- this.serialPort = serialPort;
- }
-
- @Override
- protected Void doInBackground() throws Exception {
-
- long counter = 0;
-
- while (counter < 4) {
- if (isCancelled()) {
- break;
- }
- if (counter == 0) {
- SerialCommHandler.sendRelaisStatusCommand(this.serialPort);
- } else if (counter == 1) {
- SerialCommHandler.sendCamStatusCommand(this.serialPort);
- } else if (counter == 2) {
- SerialCommHandler.sendCamVelocityStatusCommand(this.serialPort);
- } else {
- SerialCommHandler.sendActualAzimutCommand(this.serialPort);
- }
- counter++;
- Thread.sleep(3000);
- }
- return null;
- }
- }
|