RTC fixes

WIP-PC2
Harald Christian Joachim Wolff 2018-01-15 18:33:28 +01:00
parent c0286e6a2e
commit 098199123a
6 changed files with 17 additions and 7 deletions

View File

@ -11,7 +11,6 @@ public class Application {
Logging.Init(args, "synololog.log"); Logging.Init(args, "synololog.log");
PulsCounterApplication application = new PulsCounterApplication(args); PulsCounterApplication application = new PulsCounterApplication(args);
log(LogLevel.INFO,"Application initialized, starting up user interface"); log(LogLevel.INFO,"Application initialized, starting up user interface");

View File

@ -259,11 +259,11 @@ public class PulsCounterApplication implements ServiceLinkListener{
waitUiFinished(); waitUiFinished();
ShutdownNotification sn = new ShutdownNotification(); // ShutdownNotification sn = new ShutdownNotification();
if (Component.class.isInstance(ui)){ // if (Component.class.isInstance(ui)){
sn.setLocationRelativeTo((Component)ui); // sn.setLocationRelativeTo((Component)ui);
} // }
sn.setVisible(true); // sn.setVisible(true);
try { try {
@ -273,7 +273,7 @@ public class PulsCounterApplication implements ServiceLinkListener{
log(e); log(e);
} }
sn.setVisible(false); // sn.setVisible(false);
} }
private void initialize(){ private void initialize(){

View File

@ -77,4 +77,6 @@ public interface IDeviceConnector {
public void shutdown(); public void shutdown();
public void checkRealTimeClock();
} }

View File

@ -118,6 +118,8 @@ public class SimpleLinkDeviceConnector implements IDeviceConnector {
public int[] getCounters() { public int[] getCounters() {
checkOpen(); checkOpen();
checkRealTimeClock();
try { try {
return ArrayHelper.unbox(this.simpleLink.readInt(0x0600,32)); return ArrayHelper.unbox(this.simpleLink.readInt(0x0600,32));
} catch (ServiceLinkException | IOException e){ } catch (ServiceLinkException | IOException e){
@ -734,6 +736,8 @@ public class SimpleLinkDeviceConnector implements IDeviceConnector {
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
try { try {
checkOpen();
Integer deviceTime = simpleLink.readInt(0x001C); Integer deviceTime = simpleLink.readInt(0x001C);
Long currentTime = (System.currentTimeMillis()/1000); Long currentTime = (System.currentTimeMillis()/1000);

View File

@ -303,4 +303,8 @@ public class SimulatedCounter implements IDeviceConnector {
@Override @Override
public void shutdown() { public void shutdown() {
} }
@Override
public void checkRealTimeClock() {
}
} }

View File

@ -26,6 +26,7 @@ public class BatchRunner implements PulsCounterApplicationListener{
} }
public void run(){ public void run(){
pulsCounterApplication.getInterfaces().get(0).checkRealTimeClock();
for (String cmd: pulsCounterApplication.getBatchCommands()){ for (String cmd: pulsCounterApplication.getBatchCommands()){
String[] tokens = cmd.split(":"); String[] tokens = cmd.split(":");