Skip to content

Commit a510c6f

Browse files
committed
Bug Fixes
Some bugs fixed: - Startup scripts for Linux and Windows changed to ensure that Jpos116Dummy.jar is always before javapos jar file, if present. - Device classes sorted case insensitive now. - PointCardRD added to device class list on startup screen. - New writable properties for POSPower added. - Error handling added for Lights and POSPower methods which are new in UPOS 1.16
1 parent 7188780 commit a510c6f

7 files changed

Lines changed: 63 additions & 17 deletions

File tree

JavaPOS-SPF-Test.cmd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,11 @@ if exist jpos.xml if exist jpos\res\jpos.properties goto :AddExternals
7272
rem ****************************************************************
7373
rem * Add jpos115 and all other necessary jar files from *
7474
rem * sub-folder jar *
75+
rem * Jpos116Dummy must be added to class path first, if present *
7576
rem ****************************************************************
7677

77-
for %%k in (jar\*.jar) do call :addtoclasspath %%~dpfk
78+
for %%k in (jar\Jpos116Dummy.jar) do call :addtoclasspath %%~dpfk
79+
for %%k in (jar\*.jar) do if not %%k==jar\Jpos116Dummy.jar call :addtoclasspath %%~dpfk
7880

7981
rem ****************************************************************
8082
rem * Now call the Java command *

JavaPOS-SPF-Test.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ else
2323
fi
2424
fi
2525
classpath=$(pwd)
26+
test -f jar/Jpos116Dummy.jar && classpath="$classpath:$i"
2627
for i in $(pwd)/jar/*.jar
2728
do
28-
classpath="$classpath:$i"
29+
test $i = "jar/Jpos116Dummy.jar" || classpath="$classpath:$i"
2930
done
3031
echo "java $VM_Flags -cp $classpath SPF_Test.Main"
3132
java $VM_Flags -cp $classpath SPF_Test.Main || error "Press Enter to continue"

src/SPF_Test/Controller.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import java.net.URL;
2929
import java.util.ArrayList;
3030
import java.util.Collections;
31+
import java.util.Comparator;
3132
import java.util.ResourceBundle;
3233

3334
/**
@@ -48,7 +49,12 @@ public class Controller implements Initializable {
4849
public void initialize(URL url, ResourceBundle resourceBundle) {
4950
DeviceControl.loadDevices("jpos.xml", this);
5051
ArrayList<String> categories = DeviceControl.getCategories();
51-
Collections.sort(categories);
52+
Collections.sort(categories, new Comparator<String>() {
53+
@Override
54+
public int compare(String o1, String o2) {
55+
return o1.toLowerCase().compareTo(o2.toLowerCase());
56+
}
57+
});
5258
DeviceCategory.setItems(FXCollections.observableList(categories));
5359
DeviceCategory.setVisibleRowCount(categories.size());
5460
DeviceCategory.setOnAction(new EventHandler<ActionEvent>() {

src/SPF_Test/LightsController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public void SwitchOnMultiple(ActionEvent actionEvent) {
187187
})){
188188
try {
189189
TheLights.switchOnMultiple(lights, blinkOnCycle, blinkOffCycle, color, alarm);
190-
} catch (JposException e) {
190+
} catch (Throwable e) {
191191
getFullErrorMessageAndPrintTrace(e);
192192
}
193193
}
@@ -200,10 +200,10 @@ public void switchOnPattern(ActionEvent actionEvent) {
200200
if (validate(new Object[]{
201201
pattern, "pattern",
202202
alarm, "alarm"
203-
})){
203+
})) {
204204
try {
205205
TheLights.switchOnPattern(pattern, alarm);
206-
} catch (JposException e) {
206+
} catch (Throwable e) {
207207
getFullErrorMessageAndPrintTrace(e);
208208
}
209209
}
@@ -213,7 +213,7 @@ public void switchOnPattern(ActionEvent actionEvent) {
213213
public void switchOffPattern(ActionEvent actionEvent) {
214214
try {
215215
TheLights.switchOffPattern();
216-
} catch (JposException e) {
216+
} catch (Throwable e) {
217217
getFullErrorMessageAndPrintTrace(e);
218218
}
219219
updateGui();

src/SPF_Test/POSPower.fxml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,16 @@
5959
<TextArea fx:id="_statisticsBuffer" layoutX="330" layoutY="200" prefWidth="350" prefHeight="75" promptText="statisticsBuffer"/>
6060
<Separator layoutX="0" layoutY="280" prefWidth="980" orientation="HORIZONTAL"/>
6161
<Label text="Specific Properties And Methods" layoutX="10" layoutY="285" underline="true"/>
62-
<Label text="BatteryCriticallyLowThreshold" layoutX="0" layoutY="320" alignment="CENTER_RIGHT" prefWidth="150"/>
63-
<TextField fx:id="BatteryCriticallyLowThreshold" layoutX="155" layoutY="315" prefWidth="155" promptText="BatteryCriticallyLowThreshold"/>
64-
<Label text="BatteryLowThreshold" layoutX="0" layoutY="350" alignment="CENTER_RIGHT" prefWidth="150"/>
65-
<TextField fx:id="BatteryLowThreshold" layoutX="155" layoutY="345" prefWidth="155" promptText="BatteryLowThreshold"/>
66-
<Label text="EnforcedShutdownDelayTime" layoutX="0" layoutY="380" alignment="CENTER_RIGHT" prefWidth="150"/>
67-
<TextField fx:id="EnforcedShutdownDelayTime" layoutX="155" layoutY="375" prefWidth="155" promptText="EnforcedShutdownDelayTime"/>
62+
<Label text="BatteryCriticallyLowThreshold" layoutX="0" layoutY="320" alignment="CENTER_RIGHT" prefWidth="195"/>
63+
<TextField fx:id="BatteryCriticallyLowThreshold" layoutX="200" layoutY="315" prefWidth="110" promptText="BatteryCriticallyLowThreshold"/>
64+
<Label text="BatteryCriticallyLowThresholdInSeconds" layoutX="0" layoutY="350" alignment="CENTER_RIGHT" prefWidth="195"/>
65+
<TextField fx:id="BatteryCriticallyLowThresholdInSeconds" layoutX="200" layoutY="345" prefWidth="110" promptText="BatteryCriticallyLowThresholdInSeconds"/>
66+
<Label text="BatteryLowThreshold" layoutX="0" layoutY="380" alignment="CENTER_RIGHT" prefWidth="195"/>
67+
<TextField fx:id="BatteryLowThreshold" layoutX="200" layoutY="375" prefWidth="110" promptText="BatteryLowThreshold"/>
68+
<Label text="BatteryLowThresholdInSeconds" layoutX="0" layoutY="410" alignment="CENTER_RIGHT" prefWidth="195"/>
69+
<TextField fx:id="BatteryLowThresholdInSeconds" layoutX="200" layoutY="405" prefWidth="110" promptText="BatteryLowThresholdInSeconds"/>
70+
<Label text="EnforcedShutdownDelayTime" layoutX="0" layoutY="440" alignment="CENTER_RIGHT" prefWidth="195"/>
71+
<TextField fx:id="EnforcedShutdownDelayTime" layoutX="200" layoutY="435" prefWidth="110" promptText="EnforcedShutdownDelayTime"/>
6872
<Button onAction="#restartPOS" layoutX="330" layoutY="315" prefWidth="100" text="RestartPOS"/>
6973
<Button onAction="#shutdownPOS" layoutX="330" layoutY="345" prefWidth="100" text="ShutdownPOS"/>
7074
<Button onAction="#standbyPOS" layoutX="330" layoutY="375" prefWidth="100" text="StandbyPOS"/>

src/SPF_Test/POSPowerController.java

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@
3232
*/
3333
public class POSPowerController extends CommonController {
3434
public TextField BatteryCriticallyLowThreshold;
35+
public TextField BatteryCriticallyLowThresholdInSeconds;
3536
public TextField BatteryLowThreshold;
37+
public TextField BatteryLowThresholdInSeconds;
3638
public TextField EnforcedShutdownDelayTime;
3739
public ComboBox<String> SP_reason;
3840
private POSPower ThePOSPower;
3941
private PropertyTableRow BatteryCriticallyLowThresholdRow;
42+
private PropertyTableRow BatteryCriticallyLowThresholdInSecondsRow;
4043
private PropertyTableRow BatteryLowThresholdRow;
44+
private PropertyTableRow BatteryLowThresholdInSecondsRow;
4145
private PropertyTableRow EnforcedShutdownDelayTimeRow;
4246
private PropertyTableRow BatteryCapacityRemainingRow;
4347
private PropertyTableRow PowerSourceRow;
@@ -75,9 +79,9 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
7579
Properties.getItems().add(new PropertyTableRow("CapVariableBatteryLowThreshold", ""));
7680
Properties.getItems().add(new PropertyTableRow("CapVariableBatteryLowThresholdInSeconds", ""));
7781
Properties.getItems().add(BatteryCriticallyLowThresholdRow = new PropertyTableRow("BatteryCriticallyLowThreshold", ""));
78-
Properties.getItems().add(new PropertyTableRow("BatteryCriticallyLowThresholdInSeconds", ""));
82+
Properties.getItems().add(BatteryCriticallyLowThresholdInSecondsRow = new PropertyTableRow("BatteryCriticallyLowThresholdInSeconds", ""));
7983
Properties.getItems().add(BatteryLowThresholdRow = new PropertyTableRow("BatteryLowThreshold", ""));
80-
Properties.getItems().add(new PropertyTableRow("BatteryLowThresholdInSeconds", ""));
84+
Properties.getItems().add(BatteryLowThresholdInSecondsRow = new PropertyTableRow("BatteryLowThresholdInSeconds", ""));
8185
Properties.getItems().add(new PropertyTableRow("ChargeTime", ""));
8286
Properties.getItems().add(EnforcedShutdownDelayTimeRow = new PropertyTableRow("EnforcedShutdownDelayTime", ""));
8387
Properties.getItems().add(new PropertyTableRow("CheckHealthText", ""));
@@ -92,6 +96,8 @@ public void initialize(URL url, ResourceBundle resourceBundle) {
9296
Properties.getItems().add(new PropertyTableRow("CapUpdateStatistics", ""));
9397
setPropertyOnFocusLost(BatteryCriticallyLowThreshold, "BatteryCriticallyLowThreshold");
9498
setPropertyOnFocusLost(BatteryLowThreshold, "BatteryLowThreshold");
99+
setPropertyOnFocusLost(BatteryCriticallyLowThresholdInSeconds, "BatteryCriticallyLowThresholdInSeconds");
100+
setPropertyOnFocusLost(BatteryLowThresholdInSeconds, "BatteryLowThresholdInSeconds");
95101
setPropertyOnFocusLost(EnforcedShutdownDelayTime, "EnforcedShutdownDelayTime");
96102
Values val = new SP_reasonValues();
97103
for (int i = 1; i < val.ValueList.length; i += 2)
@@ -106,6 +112,8 @@ void updateGui() {
106112
InUpdateGui = true;
107113
BatteryLowThreshold.setText(BatteryLowThresholdRow.getValue());
108114
BatteryCriticallyLowThreshold.setText(BatteryCriticallyLowThresholdRow.getValue());
115+
BatteryLowThresholdInSeconds.setText(BatteryLowThresholdInSecondsRow.getValue());
116+
BatteryCriticallyLowThresholdInSeconds.setText(BatteryCriticallyLowThresholdInSecondsRow.getValue());
109117
EnforcedShutdownDelayTime.setText(EnforcedShutdownDelayTimeRow.getValue());
110118
InUpdateGui = false;
111119
}
@@ -147,6 +155,30 @@ public void setBatteryLowThreshold(ActionEvent dummy) {
147155
}
148156
}
149157

158+
public void setBatteryCriticallyLowThresholdInSeconds(ActionEvent dummy) {
159+
Integer batteryCriticallyLowThresholdInSeconds = new IntValues().getInteger(BatteryCriticallyLowThresholdInSeconds.getText());
160+
if (!invalid(batteryCriticallyLowThresholdInSeconds, "batteryCriticallyLowThresholdInSeconds")) {
161+
try {
162+
ThePOSPower.setBatteryCriticallyLowThresholdInSeconds(batteryCriticallyLowThresholdInSeconds);
163+
} catch (Throwable e) {
164+
getFullErrorMessageAndPrintTrace(e);
165+
}
166+
updateGui();
167+
}
168+
}
169+
170+
public void setBatteryLowThresholdInSeconds(ActionEvent dummy) {
171+
Integer batteryLowThresholdInSeconds = new IntValues().getInteger(BatteryLowThresholdInSeconds.getText());
172+
if (!invalid(batteryLowThresholdInSeconds, "batteryLowThresholdInSeconds")) {
173+
try {
174+
ThePOSPower.setBatteryLowThresholdInSeconds(batteryLowThresholdInSeconds);
175+
} catch (Throwable e) {
176+
getFullErrorMessageAndPrintTrace(e);
177+
}
178+
updateGui();
179+
}
180+
}
181+
150182

151183
public void setEnforcedShutdownDelayTime(ActionEvent dummy) {
152184
Integer enforcedShutdownDelayTime = new TimeoutValues().getInteger(EnforcedShutdownDelayTime.getText());
@@ -209,6 +241,7 @@ private class POSPStatusUpdateValues extends StatusUpdateValues {
209241
POSPowerConst.PWR_SUE_BAT_LOW, "SUE_BAT_LOW",
210242
POSPowerConst.PWR_SUE_BAT_CRITICAL, "SUE_BAT_CRITICAL",
211243
POSPowerConst.PWR_SUE_BAT_CAPACITY_REMAINING, "SUE_BAT_CAPACITY_REMAINING",
244+
POSPowerConst.PWR_SUE_BAT_CAPACITY_REMAINING_IN_SECONDS, "SUE_BAT_CAPACITY_REMAINING_IN_SECONDS",
212245
POSPowerConst.PWR_SUE_FAN_RUNNING, "SUE_FAN_RUNNING",
213246
POSPowerConst.PWR_SUE_FAN_STOPPED, "SUE_FAN_STOPPED",
214247
POSPowerConst.PWR_SUE_PWR_SOURCE, "SUE_PWR_SOURCE",

src/SPF_Test/SPF-Test.fxml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<Label layoutX="20" layoutY="150" wrapText="true" prefWidth="950" text="Belt, BillAcceptor, BillDispenser,
4444
Biometrics, BumpBar, CashChanger, CashDrawer, CAT, CheckScanner, CoinAcceptor, CoinDispenser, ElectronicJournal,
4545
ElectronicValueRW, FiscalPrinter, Gate, HardTotals, ImageScanner, ItemDispenser, Keylock, Lights, LineDisplay,
46-
MICR, MotionSensor, MSR, PINPad, POSKeyboard, POSPower, POSPrinter, RemoteOrderDisplay, RFIDScanner, Scale, Scanner,
47-
SignatureCapture, SmartCardRW and ToneIndicator."/>
46+
MICR, MotionSensor, MSR, PINPad, PointCardRW, POSKeyboard, POSPower, POSPrinter, RemoteOrderDisplay, RFIDScanner,
47+
Scale, Scanner, SignatureCapture, SmartCardRW and ToneIndicator."/>
4848
<Label layoutX="20" layoutY="200" text="To integrate a service into the test program, follow these steps:"/>
4949
<Label layoutX="40" layoutY="230" text="● Add the necessary entries to jpos.xml, located in the working directory of the test program."/>
5050
<Label layoutX="40" layoutY="250" text="● Add the necessary jar files to the classpath. You can adjust the startup script to do this."/>

0 commit comments

Comments
 (0)