Add notify command

Add notify command to try to debug notification handling. Send udp command notify with a single integer parameter, e.g. notify 16
This commit is contained in:
Douglas Gillespie 2025-03-14 13:52:37 +00:00
parent dfadf25b5e
commit 3dbbdfbe8f
3 changed files with 49 additions and 1 deletions

View File

@ -30,6 +30,7 @@ public abstract class CommandManager extends PamControlledUnit {
commandsList.add(new StartCommand());
commandsList.add(new StopCommand());
commandsList.add(new PingCommand());
commandsList.add(new NotifyCommand());
commandsList.add(new StatusCommand());
commandsList.add(new SummaryCommand());
commandsList.add(new SummaryPeekCommand());

View File

@ -0,0 +1,47 @@
package PamController.command;
import javax.swing.SwingUtilities;
import PamController.PamController;
public class NotifyCommand extends ExtCommand {
public NotifyCommand() {
super("notify", false);
}
@Override
public String getHint() {
return "Send an integer notification method to PamController";
}
@Override
public String execute(String command) {
String[] commandWords = CommandManager.splitCommandLine(command);
if (commandWords.length < 2) {
return "Notify command requires one parameter";
}
String pStr = commandWords[1];
int pInt = 0;
try {
pInt = Integer.valueOf(pStr);
}
catch (NumberFormatException e) {
return String.format("Command \"%s\" is not a valid parameter for the notiry command", pStr);
}
final int pInt2 = pInt;
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
PamController.getInstance().notifyModelChanged(pInt2);
}
});
return null;
}
}

View File

@ -169,7 +169,7 @@ public class DataMapControl extends PamControlledUnit implements PamSettings {
getDataMapGUI().createDataGraphs();
dataMapPanel.repaintAll();
}
break;
// break;
case PamControllerInterface.OFFLINE_DATA_LOADED:
dataMapPanel.repaintAll();
}