Newer
Older
package org.josast.UVSQsatDecoder;
import java.awt.image.BufferedImage;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileWriter;
import java.net.MalformedURLException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import org.josast.ModuleSoundModem.SoundModemConfiguration;
import org.josast.SIDS.Station;
import org.josast.UVSQsatDecoder.util.LogFile;
import org.josast.javafx.AlertHelper;
import org.josast.propertyHttp.ConfigHttp;
import org.josast.uvsqsat.generated.Uvsqsat.AntsHk;
import org.josast.uvsqsat.generated.Uvsqsat.IepsHkStatus;
import org.josast.uvsqsat.generated.Uvsqsat.ImtqHk;
import org.josast.uvsqsat.generated.Uvsqsat.MainboardAllScience;
import org.josast.uvsqsat.generated.Uvsqsat.MainboardHk;
import org.josast.uvsqsat.generated.Uvsqsat.ObcHk;
import org.josast.uvsqsat.generated.Uvsqsat.ObcStatus;
import org.josast.uvsqsat.generated.Uvsqsat.TrxvurxHk;
import org.josast.uvsqsat.generated.Uvsqsat.TrxvutxHk;
import javafx.application.Platform;
import javafx.concurrent.WorkerStateEvent;
import javafx.embed.swing.SwingFXUtils;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.fxml.FXML;
import javafx.scene.control.Alert;
import javafx.scene.control.Button;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.Tab;
import javafx.scene.control.TextArea;
import javafx.scene.control.TextField;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.scene.layout.VBox;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javafx.stage.Stage;
import javafx.stage.Window;
public class Controler {
private static Logger appLogger = Logger.getLogger("AmsatLogger");
private int delayRefresh = 6; // toute les 6 heures
private LogFile logfile = null;
private static final String LINE_SEPARATOR = "\r\n";
private static final int STATE_INIT = 0;
private static final int STATE_START = 1;
protected static final int STATE_STOP = 2;
private static final int STATE_SAVE = 3;
//
private Ax25Display ax25display = new Ax25Display();
private DisplayUVSQsat displayUVSQsat = new DisplayUVSQsat();
ModelReceivedData receivedFrame = new ModelReceivedData();
private TaskSoundmodemTCP task;
private SendSIDS SendSIDSSatnogs;
private SendSIDS SendSIDSMVPAmsat;
private String imgAmsat = "logoAmsat.png";
private String imgSatellite = "OIP.jpg";
Station station = new Station();
Configuration conf = Configuration.getInstance();
private String version = "0.6";
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
// main variable
@FXML
private TextArea DecodedData;
@FXML
private Label LabelFrame;
@FXML
private Label LabelInformation;
@FXML
private Button ButtonStart;
@FXML
private Button ButtonStop;
@FXML
private Button ButtonSave;
@FXML
private Button ButtonSaveConfiguration;
@FXML
private Label labelStatus;
@FXML
private TextArea TexAreaLog;
@FXML
private TextField TextFieldCallsign;
@FXML
private TextField TextFieldLatitude;
@FXML
private TextField TextFieldLongitude;
@FXML
private CheckBox CheckboxAmsatFDatabase;
@FXML
private CheckBox CheckBoxSatNogs;
@FXML
private TextField TextFieldSIDSEntrysat;
@FXML
private TextField TextFieldSIDSSatnogs;
@FXML
private TextField FieldIP;
@FXML
private TextField FieldPort;
@FXML
private ImageView ImageViewAMSAT;
@FXML
private ImageView imageViewSatellite;
@FXML
private WebView WebViewInfo;
@FXML
private VBox VboxInfo;
//
@FXML
private TextField tfDateCurrent;
@FXML
private TextField tfFrameSid;
@FXML
private TextField tfFrameName;
private Stage primaryStage = null;
// Add generated FXML variable
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
@FXML
private TextField tfsideAAntsTemperatureRaw;
@FXML
private TextField tfsideAAntsDeploymentStatusRaw;
@FXML
private TextField tfsideAAntsUptimeRaw;
@FXML
private TextField tfsideADeploymentCountAntenna1Raw;
@FXML
private TextField tfsideADeploymentCountAntenna2Raw;
@FXML
private TextField tfsideADeploymentCountAntenna3Raw;
@FXML
private TextField tfsideADeploymentCountAntenna4Raw;
@FXML
private TextField tfsideADeploymentTimeAntenna1Raw;
@FXML
private TextField tfsideADeploymentTimeAntenna2Raw;
@FXML
private TextField tfsideADeploymentTimeAntenna3Raw;
@FXML
private TextField tfsideADeploymentTimeAntenna4Raw;
@FXML
private TextField tfsideBAntsTemperatureRaw;
@FXML
private TextField tfsideBAntsDeploymentStatusRaw;
@FXML
private TextField tfsideBAntsUptimeRaw;
@FXML
private TextField tfsideBDeploymentCountAntenna1Raw;
@FXML
private TextField tfsideBDeploymentCountAntenna2Raw;
@FXML
private TextField tfsideBDeploymentCountAntenna3Raw;
@FXML
private TextField tfsideBDeploymentCountAntenna4Raw;
@FXML
private TextField tfsideBDeploymentTimeAntenna1Raw;
@FXML
private TextField tfsideBDeploymentTimeAntenna2Raw;
@FXML
private TextField tfsideBDeploymentTimeAntenna3Raw;
@FXML
private TextField tfsideBDeploymentTimeAntenna4Raw;
// beacon
@FXML
private TextField tfswModeRaw;
@FXML
private TextField tfresetOrderRaw;
@FXML
private TextField tfformatSdcardOrderRaw;
@FXML
private TextField tfnbTcPingSinceFirstStartRaw;
// IEPS HK
@FXML
private TextField tfhKStidRaw;
@FXML
private TextField tfhKIvidRaw;
@FXML
private TextField tfhKRcRaw;
@FXML
private TextField tfhKBidRaw;
@FXML
private TextField tfhKCmderrRaw;
@FXML
private TextField tfhKStatRaw;
@FXML
private TextField tfvoltBrdSupRawV;
@FXML
private TextField tftempRawT;
@FXML
private TextField tfvDistInputRawV;
@FXML
private TextField tfiDistInputRawMa;
@FXML
private TextField tfpDistInputRawMw;
private TextField tfvBattInputRawV;
@FXML
private TextField tfiBattInputRawMa;
@FXML
private TextField tfpBattInputRawMw;
@FXML
private TextField tfstatObcOnRaw;
@FXML
private TextField tfstatObcOcfRaw;
@FXML
private TextField tfbatStatRaw;
@FXML
private TextField tfbatTemp2RawT;
@FXML
private TextField tfvoltVd0Raw;
@FXML
private TextField tfvoltVd1Raw;
@FXML
private TextField tfvoltVd2Raw;
@FXML
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
private TextField tfvObc00V;
@FXML
private TextField tfiObc00Ma;
@FXML
private TextField tfpObc00Mw;
@FXML
private TextField tfvObc01V;
@FXML
private TextField tfiObc01Ma;
@FXML
private TextField tfpObc01Mw;
@FXML
private TextField tfvObc02V;
@FXML
private TextField tfiObc02Ma;
@FXML
private TextField tfpObc02Mw;
@FXML
private TextField tfvObc03V;
@FXML
private TextField tfiObc03Ma;
@FXML
private TextField tfpObc03Mw;
@FXML
private TextField tfvObc05V;
@FXML
private TextField tfiObc05Ma;
@FXML
private TextField tfpObc05Mw;
@FXML
private TextField tfvObc06V;
@FXML
private TextField tfiObc06Ma;
@FXML
private TextField tfpObc06Mw;
@FXML
private TextField tfcc1Byte;
@FXML
private TextField tfcc2Byte;
@FXML
private TextField tfcc3Byte;
@FXML
private TextField tfstatusStidRaw;
@FXML
private TextField tfstatusIvidRaw;
@FXML
private TextField tfstatusRcRaw;
@FXML
private TextField tfstatusBidRaw;
@FXML
private TextField tfstatusCmderrRaw;
@FXML
private TextField tfstatusStatRaw;
@FXML
private TextField tfmodeRaw;
@FXML
private TextField tfconfRaw;
@FXML
private TextField tfresetCauseRaw;
@FXML
private TextField tfuptimeRaw;
@FXML
private TextField tferrorRaw;
@FXML
private TextField tfrcCntPwronRaw;
@FXML
private TextField tfrcCntWdgRaw;
@FXML
private TextField tfrcCntCmdRaw;
@FXML
private TextField tfrcCntMcuRaw;
@FXML
private TextField tfrcCntEmlopoRaw;
@FXML
private TextField tfprevcmdElapsedRaw;
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
@FXML
private TextField tfdigitaleVoltageV;
@FXML
private TextField tfanalogVoltageV;
@FXML
private TextField tfdigitalCurrentRaw;
@FXML
private TextField tfanalogCurrentRaw;
@FXML
private TextField tfmeasureCoilXCurrentMa;
@FXML
private TextField tfmeasureCoilYCurrentMa;
@FXML
private TextField tfmeasureCoilZCurrentMa;
@FXML
private TextField tfmeasureCoilXTemperatureC;
@FXML
private TextField tfmeasureCoilYTemperatureC;
@FXML
private TextField tfmeasureCoilZTemperatureC;
@FXML
private TextField tfmcuTemperatureC;
@FXML
private TextField tfimtqSystemStateModeRaw;
@FXML
private TextField tfimtqSystemStateErrorRaw;
@FXML
private TextField tfimtqSystemStateConfigurationRaw;
@FXML
private TextField tfimtqSystemStateUptimeRaw;
@FXML
private TextField tfmainboardScienceTimeRaw;
@FXML
private TextField tfteachWearOnRaw;
@FXML
private TextField tffrequenceOfAcquisitionsRaw;
@FXML
private TextField tfgainRaw;
@FXML
private TextField tfnumberOfAcquisitionCommandedRaw;
@FXML
private TextField tfnumberOfRealAcquisitionRaw;
private TextField tfhkPlus5vRaw;
private TextField tfhkMinus5vRaw;
@FXML
private TextField tfhkMinus5vPolarRaw;
@FXML
private TextField tfhkTempAdcRaw;
@FXML
private TextField tfhkFeePlusXVrefRaw;
@FXML
private TextField tfhkFeeMinusXVrefRaw;
@FXML
private TextField tfhkFeePlusYVrefRaw;
@FXML
private TextField tfhkFeeMinusYVrefRaw;
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
@FXML
private TextField tffeePlusXErs1SignalRaw;
@FXML
private TextField tffeePlusXErs1TemperatureRaw;
@FXML
private TextField tffeePlusXErs2SignalRaw;
@FXML
private TextField tffeePlusXErs2TemperatureRaw;
@FXML
private TextField tffeePlusXErs3SignalRaw;
@FXML
private TextField tffeePlusXErs3TemperatureRaw;
@FXML
private TextField tffeePlusXUvsSignalRaw;
@FXML
private TextField tffeeMinusXErs1SignalRaw;
@FXML
private TextField tffeeMinusXErs1TemperatureRaw;
@FXML
private TextField tffeeMinusXErs2SignalRaw;
@FXML
private TextField tffeeMinusXErs2TemperatureRaw;
@FXML
private TextField tffeeMinusXErs3SignalRaw;
@FXML
private TextField tffeeMinusXErs3TemperatureRaw;
@FXML
private TextField tffeeMinusXUvsSignalRaw;
@FXML
private TextField tffeePlusYErs1SignalRaw;
@FXML
private TextField tffeePlusYErs1TemperatureRaw;
@FXML
private TextField tffeePlusYErs2SignalRaw;
@FXML
private TextField tffeePlusYErs2TemperatureRaw;
@FXML
private TextField tffeePlusYErs3SignalRaw;
@FXML
private TextField tffeePlusYErs3TemperatureRaw;
@FXML
private TextField tffeePlusYUvsSignalRaw;
@FXML
private TextField tffeeMinusYErs1SignalRaw;
@FXML
private TextField tffeeMinusYErs1TemperatureRaw;
@FXML
private TextField tffeeMinusYErs2SignalRaw;
@FXML
private TextField tffeeMinusYErs2TemperatureRaw;
@FXML
private TextField tffeeMinusYErs3SignalRaw;
@FXML
private TextField tffeeMinusYErs3TemperatureRaw;
@FXML
private TextField tffeeMinusYUvsSignalRaw;
@FXML
private TextField tfteachwearAccXRaw;
@FXML
private TextField tfteachwearAccYRaw;
@FXML
private TextField tfteachwearAccZRaw;
@FXML
private TextField tfteachwearDegCRaw;
@FXML
private TextField tfteachwearGyroXRaw;
@FXML
private TextField tfteachwearGyroYRaw;
@FXML
private TextField tfteachwearGyroZRaw;
@FXML
private TextField tfteachwearMagnXRaw;
@FXML
private TextField tfteachwearMagnYRaw;
@FXML
private TextField tfteachwearMagnZRaw;
@FXML
private TextField tfteachwearStateRaw;
@FXML
private TextField tfteachwearResetReasonRaw;
@FXML
private TextField tfteachwearCRCRaw;
@FXML
private TextField tfnbTmSinceFirstStartRaw;
@FXML
private TextField tfmainboardHKTimeRaw;
@FXML
private TextField tfhkPlus5VRaw;
@FXML
private TextField tfhkMinus5VRaw;
@FXML
private TextField tfhkMinusPolarRaw;
@FXML
private TextField tfhkTempADCRaw;
//@FXML
//private TextField tfhkFeePlusXVrefRaw;
//@FXML
//private TextField tfhkFeeMinusXVrefRaw;
//@FXML
//private TextField tfhkFeePlusYVrefRaw;
//@FXML
//private TextField tfhkFeeMinusYVrefRaw;
@FXML
private TextField tfdummyRaw;
//@FXML
//private TextField tfspiCommandStatusRaw;
@FXML
private TextField tfsupervisorEnableStatusRaw;
@FXML
private TextField tfsupervisorUptimeRaw;
@FXML
private TextField tfiobcResetCountRaw;
@FXML
private TextField tfiobcUptimeRaw;
@FXML
private TextField tfiobcMeasure3v3InRaw;
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
@FXML
private TextField tfiobcMeasure3v3Raw;
@FXML
private TextField tfiobcMeasure2vReferenceRaw;
@FXML
private TextField tfiobcMeasure1v8Raw;
@FXML
private TextField tfiobcMeasure1v0Raw;
@FXML
private TextField tfiobcMeasureCurrent3v3Raw;
@FXML
private TextField tfiobcMeasureCurrent1v8Raw;
@FXML
private TextField tfiobcMeasureCurrent1v0Raw;
@FXML
private TextField tfiobcMeasureVoltRtcRaw;
@FXML
private TextField tfiobcAdcUpdateFlagRaw;
@FXML
private TextField tfiobcCrc8Raw;
@FXML
private TextField tfphotodiode1Raw;
@FXML
private TextField tfphotodiode2Raw;
@FXML
private TextField tfphotodiode3Raw;
@FXML
private TextField tfphotodiode4Raw;
@FXML
private TextField tfphotodiode5Raw;
@FXML
private TextField tfphotodiode6Raw;
@FXML
private TextField tfpanelTemperature1C;
@FXML
private TextField tfpanelTemperature2C;
@FXML
private TextField tfpanelTemperature3C;
@FXML
private TextField tfpanelTemperature4C;
@FXML
private TextField tfpanelTemperature5C;
@FXML
private TextField tfpanelTemperature6C;
@FXML
private TextField tfspiCommandStatusRaw;
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
@FXML
private TextField tfsupervisorIndexOfSubsystemRaw;
@FXML
private TextField tfsupervisorMajorVersionRaw;
@FXML
private TextField tfsupervisorMinorVersionRaw;
@FXML
private TextField tfsupervisorPatchVersionRaw;
@FXML
private TextField tfsupervisorGitHeadVersionRaw;
@FXML
private TextField tfsupervisorSerialNumberRaw;
@FXML
private TextField tfcompilationInformationByte;
@FXML
private TextField tfclockSpeedRaw;
@FXML
private TextField tfcodeTypeRaw;
@FXML
private TextField tfcrc8Raw;
@FXML
private TextField tfswMmodeRaw;
@FXML
private TextField tflastResetReasonRaw;
@FXML
private TextField tfreservedRaw;
@FXML
private TextField tfnbResetRaw;
@FXML
private TextField tfreserved2Raw;
@FXML
private TextField tfdeployAntennasSystemRaw;
//@FXML
//private TextField tfnbTmSinceFirstStartRaw;
@FXML
private TextField tfnbTcSinceFirstStartRaw;
@FXML
private TextField tfnbBadTcSinceFirstStartRaw;
@FXML
private TextField tfnbTmInSdcardRaw;
@FXML
private TextField tfsdcardStatusRaw;
@FXML
private TextField tfsdcardLastErrorRaw;
@FXML
private TextField tfoldTimeTMInSdcardRaw;
@FXML
private TextField tfnewTimeTMInSdcardRaw;
@FXML
private TextField tftrxvurxInstantaneousReceivedSignalDopplerHz;
@FXML
private TextField tftrxvurxInstantaneousReceivedSignalStrengthDbm;
@FXML
private TextField tftrxvurxSupplyVoltageV;
@FXML
private TextField tftrxvurxTotalSupplyCurrentMa;
@FXML
private TextField tftrxvurxTransmitterCurrentMa;
@FXML
private TextField tftrxvurxReceiverCurrentMa;
@FXML
private TextField tftrxvurxPowerAmplifierCurrentMa;
@FXML
private TextField tftrxvurxPowerAmplifierTemperatureC;
@FXML
private TextField tftrxvurxLocalOscillatorTemperatureC;
@FXML
private TextField tftrxvurxZeroPaddingRaw;
@FXML
@FXML
private TextField tftrxvutxInstantaneousRfReflectedPowerFromTransmitterPortMw;
@FXML
private TextField tftrxvutxInstantaneousRfForwardPowerFromTransmitterPortMw;
@FXML
private TextField tftrxvutxSupplyVoltageV;
@FXML
private TextField tftrxvutxTotalSupplyCurrentMa;
@FXML
private TextField tftrxvutxTransmitterCurrentMa;
@FXML
private TextField tftrxvutxReceiverCurrentMa;
@FXML
private TextField tftrxvutxPowerAmplifierCurrentMa;
@FXML
private TextField tftrxvutxPowerAmplifierTemperatureC;
@FXML
private TextField tftrxvutxLocalOscillatorTemperatureC;
@FXML
private TextField tftrxvutxZeroPaddingRaw;
@FXML
private TextField tftrxvuTxUptimeRaw;
@FXML
private TextField tftrxvuTxStateRaw;
@FXML
private Tab TabDataSream;
@FXML
private Tab infoTab;
ScheduledExecutorService ses = Executors.newScheduledThreadPool(1);
private ScheduledFuture<?> scheduledFuture = null;
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
private void setupDataStream ()
{
ReceivedData decodedData = receivedFrame.getLastReceivedData();
if (decodedData != null) {
DecodedData.clear();
ax25display.setdata(decodedData);
if (ax25display.GetCallsignFrom().contains("LATMOS")) {
displayUVSQsat.setData(decodedData);
Frame frame = displayUVSQsat.getFrame();
if (frame !=null)
{
DecodedData.appendText(displayUVSQsat.getData());
}
else
{
DecodedData.appendText(ax25display.getDisplay());
}
// release memory
frame=null;
}else
{
DecodedData.appendText(ax25display.getDisplay());
}
}
else
{
DecodedData.setText("No Value to display");
}
}
@FXML
private void HandleTabDataSreamChange()
{
Platform.runLater(new Runnable() {
@Override
public void run() {
if(TabDataSream.isSelected())
setupDataStream();
}});
}
private void HandleIP(ActionEvent event)
{
}
@FXML
private void HandlePort(ActionEvent event)
{
}
@FXML
private void handleStart(ActionEvent event) {
manageStatusinformation("Connected to modem", "Connection to modem");
manageStateMMI(STATE_START);
// TODO : to improve
SoundModemConfiguration smc = new SoundModemConfiguration("configuration.ini");
smc.setSmIPadress(FieldIP.getText());
smc.setSmPort(Integer.parseInt(FieldPort.getText()));
if (task == null) {
receivedFrame
.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
// final ;
// final ReceivedData decodedData = receivedFrame.getLastReceivedData();
Platform.runLater(new Runnable() {
@Override
public void run() {
ReceivedData decodedData = receivedFrame.getLastReceivedData();
try {
;
if (decodedData != null) {
updateFrame(receivedFrame.getNumberFrame());
ax25display.setdata(decodedData);
if (ax25display.GetCallsignFrom().contains("LATMOS")) {
Frame frame = displayUVSQsat.getFrame();
if (frame !=null)
{
String date = displayUVSQsat.getFrame().getPacketSecondaryHeader().getTime();
tfDateCurrent.setText(date);
int sid = displayUVSQsat.getFrame().getSid();
tfFrameSid.setText(""+sid);
if(TabDataSream.isSelected()) // append le texte uniquement si visible
{
displayUvsqsat(sid,(UiFrame) displayUVSQsat.getFrame().getUiFrame());
//release memory
date=null;
{
displayLog( "Frame not reconized");
ax25display.setdata(decodedData);
displayLog(decodedData.toString());
DecodedData.appendText(ax25display.getDisplay());
}
// release memory
frame=null;
}else
{
ax25display.setdata(decodedData);
displayLog(decodedData.toString());
// DecodedData.appendText(ax25display.getDisplay());
}
} else {
displayLog(
"received frame : null");
}
} catch (Exception e) {
displayLog("Run - error");
displayLog(e.toString());
e.printStackTrace();
}
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
});
}
}
);
}
task = new TaskSoundmodemTCP(smc, receivedFrame);
task.setOnSucceeded(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent event) {
// La tache s'est correctement terminee.
manageStatusinformation("KISS TCP CONNECTION FAILED",
"KISS TCP DISCONNECTED");
manageStateMMI(STATE_STOP);
}
});
task.setOnFailed(new EventHandler<WorkerStateEvent>() {
@Override
public void handle(WorkerStateEvent event) {
// La tache s'est correctement terminee.
manageStatusinformation("KISS TCP CONNECTION FAILED",
"KISS TCP DISCONNECTED - Connection failed");
displayLog(event.toString());
displayLog(event.getSource().toString());
manageStateMMI(STATE_STOP);
}
});
Thread backgroundThread = new Thread(task);
backgroundThread.setDaemon(true);
backgroundThread.start();
}
@FXML
private void handleStop(ActionEvent event)
{
manageStateMMI(STATE_STOP);
task.arreter();
manageStatusinformation("Stop received data",
"Stop task to receive telemetrie");
}
@FXML
private void handleSave(ActionEvent event)
{
manageStateMMI(STATE_SAVE);
manageStatusinformation("save data", "save Telemetry in file");
saveDataFile();
manageStatusinformation("Data Saved", "Telemetry Data saved in file");
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
private void HandleSaveConfiguration(ActionEvent event) {
String erreurmsg = null;
String Callsign = null;
if (TextFieldCallsign.getText().isEmpty()) {
erreurmsg += "please enter a CallSign \r\n";
} else {
Callsign = TextFieldCallsign.getText();
}
String Latitude = TextFieldLatitude.getText();
String Longitude = TextFieldLongitude.getText();
if (station.checkLatitude(Latitude) == false) {
erreurmsg += "Wrong format for Latitude : XX.XXE/W \r\n";
}
if (station.checkLongitude(Longitude) == false) {
erreurmsg += "Wrong format for Longitude : XX.XXS/N \r\n";
}
if (erreurmsg != null) {
Window owner = ButtonSaveConfiguration.getScene().getWindow();
AlertHelper.showAlert(Alert.AlertType.ERROR, owner, "Form Error!",
erreurmsg);
return;
}
station.setCallsign(Callsign);
station.setLatitude(Latitude);
station.setLongitude(Longitude);
conf.setCallsign(Callsign);
conf.setLatitude(Latitude);
conf.setLongitude(Longitude);
conf.setSIDSAMSATSource(TextFieldSIDSEntrysat.getText());
conf.setSIDSSatnogsSource(TextFieldSIDSSatnogs.getText());
conf.setSoundModemIP(FieldIP.getText());
conf.setSoundModemPort(FieldPort.getText());
Station StationSatnogs = new Station(conf.getSIDSSatnogsSource(),
station.getLongitude(), station.getLatitude());
Station StationEntry = new Station(conf.getSIDSAMSATSource(),
station.getLongitude(), station.getLatitude());
if (CheckboxAmsatFDatabase.isSelected() == true) {
conf.setSIDSAMSAT("1");
SendSIDSMVPAmsat = new SendSIDS(StationEntry, conf.getNorad(),
conf.getSIDSAMSATUrl());
} else {
conf.setSIDSAMSAT("0");
}
if (CheckBoxSatNogs.isSelected() == true) {
conf.setSIDSSatnogs("1");
SendSIDSSatnogs = new SendSIDS(StationSatnogs, conf.getNorad(),
conf.getSIDSSatnogsURL());
} else {
conf.setSIDSSatnogs("0");
}
conf.save();
manageStatusinformation("Configuration Saved", "Configuration Saved");
}
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
public void updateDistantconfiguration ()
{
String ver;
String message;
int NoradIdConf = conf.getNorad();
ConfigHttp c = new ConfigHttp("http://site.amsat-f.org/download/117652/");
if (c.isConnected()) {
ver = c.GetProperty("UVSQSatDecoder");
message = c.GetProperty("Message");
String noradid = c.GetProperty("NoradID");
if(noradid!=null)
{
NoradIdConf = Integer
.parseUnsignedInt(c.GetProperty("NoradID").trim());
}
} else {
ver = version;
message = "not connected to internet";
}
if (NoradIdConf != 0)
{
// ID norad attribué - mise à jours du logiciel
if (NoradIdConf != conf.getNorad()) {
conf.setNorad(NoradIdConf);
conf.save();
SendSIDSSatnogs.setNorad(NoradIdConf);
SendSIDSMVPAmsat.setNorad(NoradIdConf);
displayLog("Norad ID updated ");
}
}
if (ver.equals(version) == false) {
erreurmsg = message + " New version " + ver + " available ! ";