3232 */
3333public 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" ,
0 commit comments