Skip to content

Commit

Permalink
Provide methods to get alarm status and screen fields
Browse files Browse the repository at this point in the history
  • Loading branch information
rabelenda-abstracta committed Apr 12, 2019
1 parent e656fdb commit ac5e329
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/net/infordata/em/TerminalClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.awt.Point;
import java.awt.event.KeyEvent;
import java.io.IOException;
import java.util.List;
import java.util.Optional;
import javax.net.SocketFactory;
import net.infordata.em.crt5250.XI5250Field;
Expand Down Expand Up @@ -57,6 +58,10 @@ public void soundAlarm() {
alarmSounded = true;
}

private boolean isAlarmOn() {
return alarmSounded;
}

private boolean resetAlarm() {
boolean ret = alarmSounded;
alarmSounded = false;
Expand Down Expand Up @@ -176,6 +181,10 @@ public String getScreenText() {
return screen.toString();
}

public List<XI5250Field> getFields() {
return emulator.getFields();
}

/**
* Get the screen dimensions of the terminal emulator screen.
*
Expand Down Expand Up @@ -223,6 +232,16 @@ public Optional<Point> getCursorPosition() {
.of(new Point(emulator.getCursorCol() + 1, emulator.getCursorRow() + 1)) : Optional.empty();
}

/**
* Gets the status of the alarm.
*
* Prefer using resetAlarm so it is properly reset when checking value. Use this operation only if
* you are implementing some tracing or debugging and don't want to change the alarm flag status.
*/
public boolean isAlarmOn() {
return emulator.isAlarmOn();
}

/**
* Allows resetting and getting the status of the alarm triggered by the terminal server.
*
Expand Down

0 comments on commit ac5e329

Please sign in to comment.