mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Merge remote-tracking branch 'origin/main' into Tethys
This commit is contained in:
commit
a761100ba7
@ -198,6 +198,7 @@ public class PSFXReadWriter {
|
|||||||
BinaryHeader bh = new BinaryHeader();
|
BinaryHeader bh = new BinaryHeader();
|
||||||
bh.readHeader(dis);
|
bh.readHeader(dis);
|
||||||
PamSettingsGroup psg = new PamSettingsGroup(bh.getDataDate());
|
PamSettingsGroup psg = new PamSettingsGroup(bh.getDataDate());
|
||||||
|
ArrayList<ModuleNameObject> moduleNames = new ArrayList<ModuleNameObject>();
|
||||||
/*
|
/*
|
||||||
*
|
*
|
||||||
dos.writeInt(totalLen);
|
dos.writeInt(totalLen);
|
||||||
@ -217,6 +218,7 @@ public class PSFXReadWriter {
|
|||||||
dis.read(data);
|
dis.read(data);
|
||||||
if (objectId == ModuleNameObject.typeId) {
|
if (objectId == ModuleNameObject.typeId) {
|
||||||
ModuleNameObject mno = new ModuleNameObject(data);
|
ModuleNameObject mno = new ModuleNameObject(data);
|
||||||
|
moduleNames.add(mno);
|
||||||
}
|
}
|
||||||
else if (objectId == 2) {
|
else if (objectId == 2) {
|
||||||
PamControlledUnitSettings pcsu = PamControlledUnitSettings.createFromNamedByteArray(data);
|
PamControlledUnitSettings pcsu = PamControlledUnitSettings.createFromNamedByteArray(data);
|
||||||
|
@ -26,7 +26,7 @@ import offlineProcessing.OfflineTaskGroup;
|
|||||||
* them, but for some of the batch processing control, we need to be able to load and
|
* them, but for some of the batch processing control, we need to be able to load and
|
||||||
* manipulate a second set of modules, which do nothing within the running
|
* manipulate a second set of modules, which do nothing within the running
|
||||||
* configuration, but are there to allow us to set up a configuration to send to
|
* configuration, but are there to allow us to set up a configuration to send to
|
||||||
* other batch processes in viewer mode.
|
* other batch processes in viewer mode. This is also being used in an improved module import system.
|
||||||
* @author dg50
|
* @author dg50
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -142,6 +142,12 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
// flag used in main() to indicate that pamguard should exit as soon as processing ends.
|
// flag used in main() to indicate that pamguard should exit as soon as processing ends.
|
||||||
public static final String AUTOEXIT = "-autoexit";
|
public static final String AUTOEXIT = "-autoexit";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Never changed. Needed to identify settings for list of modules in prfx files.
|
||||||
|
*/
|
||||||
|
public static final String unitName = "Pamguard Controller";
|
||||||
|
public static final String unitType = "PamController";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The pam model.
|
* The pam model.
|
||||||
*/
|
*/
|
||||||
@ -1865,12 +1871,12 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnitName() {
|
public String getUnitName() {
|
||||||
return "Pamguard Controller";
|
return unitName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getUnitType() {
|
public String getUnitType() {
|
||||||
return "PamController";
|
return unitType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,9 +33,7 @@ public class PamSettingsGroup implements Comparable<PamSettingsGroup> {
|
|||||||
* @param settingsTime settings time in milliseconds.
|
* @param settingsTime settings time in milliseconds.
|
||||||
*/
|
*/
|
||||||
public PamSettingsGroup(long settingsTime) {
|
public PamSettingsGroup(long settingsTime) {
|
||||||
super();
|
this(settingsTime, new ArrayList<PamControlledUnitSettings>());
|
||||||
this.settingsTime = settingsTime;
|
|
||||||
unitSettings = new ArrayList<PamControlledUnitSettings>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,7 +8,8 @@ import PamModel.parametermanager.PamParameterSet.ParameterSetType;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Very simple class used in an ArrayList of used modules that
|
* Very simple class used in an ArrayList of used modules that
|
||||||
* get's saved between runs.
|
* get's saved between runs. This forms the core of the settings system
|
||||||
|
* so don't f*** with it !
|
||||||
* @author Doug
|
* @author Doug
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@ -15,10 +15,12 @@ import PamController.PamController;
|
|||||||
import PamController.PamSettingManager;
|
import PamController.PamSettingManager;
|
||||||
import PamController.PamSettings;
|
import PamController.PamSettings;
|
||||||
import PamController.PamSettingsGroup;
|
import PamController.PamSettingsGroup;
|
||||||
|
import PamController.UsedModuleInfo;
|
||||||
import PamModel.PamModel;
|
import PamModel.PamModel;
|
||||||
import PamModel.PamModuleInfo;
|
import PamModel.PamModuleInfo;
|
||||||
import PamModel.SMRUEnable;
|
import PamModel.SMRUEnable;
|
||||||
import PamView.dialog.PamFileBrowser;
|
import PamView.dialog.PamFileBrowser;
|
||||||
|
import PamView.dialog.warn.WarnOnce;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to handle the import of settings from other psf files.
|
* Class to handle the import of settings from other psf files.
|
||||||
@ -180,9 +182,16 @@ public class SettingsImport {
|
|||||||
/**
|
/**
|
||||||
* Now make a new Pamcontrolled unit with the given name ...
|
* Now make a new Pamcontrolled unit with the given name ...
|
||||||
*/
|
*/
|
||||||
|
// need to find the module information in the PamModel
|
||||||
|
// PamModel pamModel = PamModel.getPamModel();
|
||||||
|
// pamModel.
|
||||||
|
PamModuleInfo moduleInfo = PamModuleInfo.findModuleInfo(importGroup.getUsedModuleInfo().className);
|
||||||
// find the module info for this one
|
// find the module info for this one
|
||||||
PamModuleInfo moduleInfo = importGroup.getModuleInfo();
|
// PamModuleInfo moduleInfo = importGroup.getUsedModuleInfo();
|
||||||
if (moduleInfo == null) {
|
if (moduleInfo == null) {
|
||||||
|
String msg = String.format("Unable to find module information for type %s main class %s in model",
|
||||||
|
importGroup.getUsedModuleInfo().getUnitType(), importGroup.getUsedModuleInfo().className);
|
||||||
|
WarnOnce.showWarning("Module creating error!", msg, WarnOnce.WARNING_MESSAGE);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,6 +215,7 @@ public class SettingsImport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
loadSubUnitSettings(importGroup, unit.getUnitName());
|
loadSubUnitSettings(importGroup, unit.getUnitName());
|
||||||
|
unit.setupControlledUnit();
|
||||||
return unit;
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,45 +225,64 @@ public class SettingsImport {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ArrayList<SettingsImportGroup> organiseSettingsGroups(ArrayList<PamControlledUnitSettings> settings) {
|
ArrayList<SettingsImportGroup> organiseSettingsGroups(ArrayList<PamControlledUnitSettings> settings) {
|
||||||
|
/**
|
||||||
|
* this needs rewriting for psfx files which are organised differently. first we need to find
|
||||||
|
* a list of PAMGuard modules by finding the settings group of the PAMController.
|
||||||
|
*/
|
||||||
|
|
||||||
ArrayList<SettingsImportGroup> groupedSettings = new ArrayList<>();
|
ArrayList<SettingsImportGroup> groupedSettings = new ArrayList<>();
|
||||||
// first pull out the settings for PamControlledNnits.
|
ArrayList<UsedModuleInfo> usedModules = findPamControllerSettings(settings);
|
||||||
|
// make the group list based on the list of modules.
|
||||||
|
for (UsedModuleInfo usedModule : usedModules) {
|
||||||
|
groupedSettings.add(new SettingsImportGroup(usedModule));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// // first pull out the settings for PamControlledNnits.
|
||||||
boolean[] used = new boolean[settings.size()];
|
boolean[] used = new boolean[settings.size()];
|
||||||
for (int i = 0; i < settings.size(); i++) {
|
// for (int i = 0; i < settings.size(); i++) {
|
||||||
PamControlledUnitSettings aSet = settings.get(i);
|
// PamControlledUnitSettings aSet = settings.get(i);
|
||||||
if (aSet.getOwnerClassName() == null) {
|
// if (aSet.getOwnerClassName() == null) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
Class ownerClass = null;
|
// Class ownerClass = null;
|
||||||
try {
|
// try {
|
||||||
ownerClass = Class.forName(aSet.getOwnerClassName());
|
// ownerClass = Class.forName(aSet.getOwnerClassName());
|
||||||
} catch (ClassNotFoundException e) {
|
// } catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// // TODO Auto-generated catch block
|
||||||
// e.printStackTrace();
|
//// e.printStackTrace();
|
||||||
// this is happening since the ownerclassname is not set correctly in psfx files
|
// // this is happening since the ownerclassname is not set correctly in psfx files
|
||||||
// so we have to deserialise the data to find the class.
|
// // so we have to deserialise the data to find the class.
|
||||||
// ownerClass = getClassFromData(aSet.getSerialisedByteArray());
|
//// ownerClass = getClassFromData(aSet.getSerialisedByteArray());
|
||||||
// ownerClass = PamModuleInfo.findModuleClass(aSet.getUnitType());
|
//// ownerClass = PamModuleInfo.findModuleClass(aSet.getUnitType());
|
||||||
}
|
// }
|
||||||
if (ownerClass == null) {
|
// if (ownerClass == null) {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
if (PamControlledUnit.class.isAssignableFrom(ownerClass)) {
|
// if (PamControlledUnit.class.isAssignableFrom(ownerClass)) {
|
||||||
PamModuleInfo moduleInfo = PamModuleInfo.findModuleInfo(aSet.getOwnerClassName());
|
// PamModuleInfo moduleInfo = PamModuleInfo.findModuleInfo(aSet.getOwnerClassName());
|
||||||
groupedSettings.add(new SettingsImportGroup(aSet, moduleInfo));
|
// groupedSettings.add(new SettingsImportGroup(moduleInfo));
|
||||||
used[i] = true;
|
// used[i] = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// now match all the remaining settings into the first set based on ModuleName.
|
// now match all the remaining settings into the first set based on ModuleName.
|
||||||
for (int i = 0; i < settings.size(); i++) {
|
for (int i = 0; i < settings.size(); i++) {
|
||||||
PamControlledUnitSettings aSet = settings.get(i);
|
PamControlledUnitSettings aSet = settings.get(i);
|
||||||
if (used[i]) continue;
|
// if (used[i]) continue;
|
||||||
SettingsImportGroup mainGroup = findGroup(groupedSettings, aSet.getUnitName());
|
SettingsImportGroup mainGroup = findGroup(groupedSettings, aSet.getUnitName());
|
||||||
if (mainGroup != null) {
|
if (mainGroup != null) {
|
||||||
|
// main settings will have same type as well as same name.
|
||||||
|
boolean mainType = isMainType(mainGroup, aSet);
|
||||||
|
if (mainType) {
|
||||||
|
mainGroup.setMainSettings(aSet);
|
||||||
|
}
|
||||||
|
else {
|
||||||
mainGroup.addSubSettings(aSet);
|
mainGroup.addSubSettings(aSet);
|
||||||
|
}
|
||||||
used[i] = true;
|
used[i] = true;
|
||||||
System.out.println(String.format("Adding %s-%s to %s-%s group", aSet.getUnitType(), aSet.getUnitName(),
|
// System.out.println(String.format("Adding %s-%s to %s-%s group", aSet.getUnitType(), aSet.getUnitName(),
|
||||||
mainGroup.getMainSettings().getUnitType(), mainGroup.getMainSettings().getUnitName()));
|
// mainGroup.getMainSettings().getUnitType(), mainGroup.getMainSettings().getUnitName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,6 +301,34 @@ public class SettingsImport {
|
|||||||
return groupedSettings;
|
return groupedSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IS this the main settings group for this module ? If it is, it should have the same
|
||||||
|
* type as well as the same name.
|
||||||
|
* @param mainGroup
|
||||||
|
* @param aSet
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private boolean isMainType(SettingsImportGroup mainGroup, PamControlledUnitSettings aSet) {
|
||||||
|
boolean isMain = mainGroup.getUsedModuleInfo().getUnitType().equals(aSet.getUnitType());
|
||||||
|
return isMain;
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<UsedModuleInfo> findPamControllerSettings(ArrayList<PamControlledUnitSettings> settings) {
|
||||||
|
if (settings == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
for (PamControlledUnitSettings aSet : settings) {
|
||||||
|
if (aSet.getUnitName().equals(PamController.unitName) &&
|
||||||
|
aSet.getUnitType().equals(PamController.unitType)) {
|
||||||
|
Object sets = aSet.getSettings();
|
||||||
|
if (sets instanceof ArrayList) {
|
||||||
|
return (ArrayList<UsedModuleInfo>) sets;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private Class getClassFromData(byte[] data) {
|
private Class getClassFromData(byte[] data) {
|
||||||
try {
|
try {
|
||||||
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
|
ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(data));
|
||||||
@ -285,7 +342,7 @@ public class SettingsImport {
|
|||||||
|
|
||||||
private SettingsImportGroup findGroup(ArrayList<SettingsImportGroup> groupedSettings, String unitName) {
|
private SettingsImportGroup findGroup(ArrayList<SettingsImportGroup> groupedSettings, String unitName) {
|
||||||
for (SettingsImportGroup iG:groupedSettings) {
|
for (SettingsImportGroup iG:groupedSettings) {
|
||||||
if (iG.getMainSettings().getUnitName().equals(unitName)) {
|
if (iG.getUsedModuleInfo().unitName.equals(unitName)) {
|
||||||
return iG;
|
return iG;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ import javax.swing.JPanel;
|
|||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
import javax.swing.border.TitledBorder;
|
||||||
import javax.swing.event.ListSelectionEvent;
|
import javax.swing.event.ListSelectionEvent;
|
||||||
import javax.swing.event.ListSelectionListener;
|
import javax.swing.event.ListSelectionListener;
|
||||||
import javax.swing.table.AbstractTableModel;
|
import javax.swing.table.AbstractTableModel;
|
||||||
@ -66,6 +67,7 @@ public class SettingsImportDialog extends PamDialog {
|
|||||||
moduleTable.getColumnModel().getColumn(2).setPreferredWidth(200);
|
moduleTable.getColumnModel().getColumn(2).setPreferredWidth(200);
|
||||||
|
|
||||||
JPanel mainPanel = new JPanel(new BorderLayout());
|
JPanel mainPanel = new JPanel(new BorderLayout());
|
||||||
|
mainPanel.setBorder(new TitledBorder("Module import selection"));
|
||||||
JScrollPane scrollPanel = new JScrollPane(moduleTable);
|
JScrollPane scrollPanel = new JScrollPane(moduleTable);
|
||||||
mainPanel.add(BorderLayout.CENTER, scrollPanel);
|
mainPanel.add(BorderLayout.CENTER, scrollPanel);
|
||||||
mainPanel.setPreferredSize(new Dimension(600, 250));
|
mainPanel.setPreferredSize(new Dimension(600, 250));
|
||||||
|
@ -5,6 +5,7 @@ import java.util.ArrayList;
|
|||||||
import PamController.PamControlledUnit;
|
import PamController.PamControlledUnit;
|
||||||
import PamController.PamControlledUnitSettings;
|
import PamController.PamControlledUnitSettings;
|
||||||
import PamController.PamController;
|
import PamController.PamController;
|
||||||
|
import PamController.UsedModuleInfo;
|
||||||
import PamModel.PamModuleInfo;
|
import PamModel.PamModuleInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -20,19 +21,26 @@ public class SettingsImportGroup {
|
|||||||
|
|
||||||
private ArrayList<PamControlledUnitSettings> subSettings = new ArrayList<>();
|
private ArrayList<PamControlledUnitSettings> subSettings = new ArrayList<>();
|
||||||
|
|
||||||
private PamModuleInfo moduleInfo;
|
private UsedModuleInfo usedModuleInfo;
|
||||||
|
|
||||||
private ArrayList<ImportChoice> importChoices;
|
private ArrayList<ImportChoice> importChoices;
|
||||||
|
|
||||||
private ImportChoice importChoice;
|
private ImportChoice importChoice;
|
||||||
|
|
||||||
|
|
||||||
|
public SettingsImportGroup(UsedModuleInfo moduleInfo) {
|
||||||
|
super();
|
||||||
|
this.usedModuleInfo = moduleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor takes the main settings
|
* Constructor takes the main settings
|
||||||
* @param mainSettings
|
* @param mainSettings
|
||||||
* @param moduleInfo
|
* @param moduleInfo
|
||||||
*/
|
*/
|
||||||
public SettingsImportGroup(PamControlledUnitSettings mainSettings, PamModuleInfo moduleInfo) {
|
public SettingsImportGroup(PamControlledUnitSettings mainSettings, UsedModuleInfo moduleInfo) {
|
||||||
this.mainSettings = mainSettings;
|
this.mainSettings = mainSettings;
|
||||||
this.moduleInfo = moduleInfo;
|
this.usedModuleInfo = moduleInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +80,7 @@ public class SettingsImportGroup {
|
|||||||
importChoices.add(importChoice = new ImportChoice(ImportChoice.DONT_IMPORT, null));
|
importChoices.add(importChoice = new ImportChoice(ImportChoice.DONT_IMPORT, null));
|
||||||
Class ownerClass = null;
|
Class ownerClass = null;
|
||||||
try {
|
try {
|
||||||
ownerClass = Class.forName(mainSettings.getOwnerClassName());
|
ownerClass = Class.forName(usedModuleInfo.className);
|
||||||
} catch (ClassNotFoundException e) {
|
} catch (ClassNotFoundException e) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -80,8 +88,9 @@ public class SettingsImportGroup {
|
|||||||
ArrayList<PamControlledUnit> existingModules =
|
ArrayList<PamControlledUnit> existingModules =
|
||||||
PamController.getInstance().findControlledUnits(ownerClass);
|
PamController.getInstance().findControlledUnits(ownerClass);
|
||||||
int maxnumber = 1; // this will only ever be used by the Array Manager which doesn't have a moduleInfo.
|
int maxnumber = 1; // this will only ever be used by the Array Manager which doesn't have a moduleInfo.
|
||||||
if (this.moduleInfo != null) {
|
PamModuleInfo pamModuleInfo = getPamModuleInfo();
|
||||||
maxnumber = moduleInfo.getMaxNumber();
|
if (pamModuleInfo != null) {
|
||||||
|
maxnumber = pamModuleInfo.getMaxNumber();
|
||||||
}
|
}
|
||||||
if (existingModules != null) {
|
if (existingModules != null) {
|
||||||
for (int i = 0; i < existingModules.size(); i++) {
|
for (int i = 0; i < existingModules.size(); i++) {
|
||||||
@ -111,10 +120,29 @@ public class SettingsImportGroup {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* This is the information from an existing module, which may not
|
||||||
|
* have the full class name, but does have the type and name of the
|
||||||
|
* module being imported.
|
||||||
* @return the moduleInfo
|
* @return the moduleInfo
|
||||||
*/
|
*/
|
||||||
public PamModuleInfo getModuleInfo() {
|
public UsedModuleInfo getUsedModuleInfo() {
|
||||||
return moduleInfo;
|
return usedModuleInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* this is the module information held in the PamModel which
|
||||||
|
* is used to create a module.
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public PamModuleInfo getPamModuleInfo() {
|
||||||
|
return PamModuleInfo.findModuleInfo(usedModuleInfo.className);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mainSettings the mainSettings to set
|
||||||
|
*/
|
||||||
|
public void setMainSettings(PamControlledUnitSettings mainSettings) {
|
||||||
|
this.mainSettings = mainSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@ import alarm.actions.AlarmAction;
|
|||||||
import alarm.actions.email.SendEmailAction;
|
import alarm.actions.email.SendEmailAction;
|
||||||
import alarm.actions.serial.AlarmSerialAction;
|
import alarm.actions.serial.AlarmSerialAction;
|
||||||
import alarm.actions.sound.PlaySound;
|
import alarm.actions.sound.PlaySound;
|
||||||
|
import alarm.actions.tast.TastAction;
|
||||||
import alarm.actions.udp.AlarmUDPAction;
|
import alarm.actions.udp.AlarmUDPAction;
|
||||||
import userDisplay.UserDisplayComponent;
|
import userDisplay.UserDisplayComponent;
|
||||||
import userDisplay.UserDisplayControl;
|
import userDisplay.UserDisplayControl;
|
||||||
@ -54,6 +55,7 @@ public class AlarmControl extends PamControlledUnit implements PamSettings {
|
|||||||
alarmActions.add(new AlarmSerialAction(this));
|
alarmActions.add(new AlarmSerialAction(this));
|
||||||
alarmActions.add(new SendEmailAction(this));
|
alarmActions.add(new SendEmailAction(this));
|
||||||
alarmActions.add(new AlarmUDPAction(this));
|
alarmActions.add(new AlarmUDPAction(this));
|
||||||
|
// alarmActions.add(new TastAction(this)); // uncomment when alarm action string ready
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
26
src/alarm/actions/tast/TastAction.java
Normal file
26
src/alarm/actions/tast/TastAction.java
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
package alarm.actions.tast;
|
||||||
|
|
||||||
|
import alarm.AlarmControl;
|
||||||
|
import alarm.AlarmDataUnit;
|
||||||
|
import alarm.actions.serial.AlarmSerialAction;
|
||||||
|
|
||||||
|
public class TastAction extends AlarmSerialAction {
|
||||||
|
|
||||||
|
public TastAction(AlarmControl alarmControl) {
|
||||||
|
super(alarmControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getActionName() {
|
||||||
|
return "TAST Trigger";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String createAlarmString(AlarmDataUnit alarmDataUnit) {
|
||||||
|
// TODO. To define serial string to send to TAST device once we hear back
|
||||||
|
// from GenusWave.
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,7 +24,7 @@ public class EchoDetectionTask extends OfflineTask<ClickDetection> {
|
|||||||
this.clickControl = clickControl;
|
this.clickControl = clickControl;
|
||||||
echoDetectionSystem = clickControl.getEchoDetectionSystem();
|
echoDetectionSystem = clickControl.getEchoDetectionSystem();
|
||||||
setParentDataBlock(clickControl.getClickDataBlock());
|
setParentDataBlock(clickControl.getClickDataBlock());
|
||||||
// addAffectedDataBlock(clickControl.getClickDataBlock());
|
addAffectedDataBlock(clickControl.getClickDataBlock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -302,6 +302,21 @@ public abstract class OfflineTask<T extends PamDataUnit> {
|
|||||||
return affectedDataBlocks.get(iBlock);
|
return affectedDataBlocks.get(iBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a formatted string list of affected data blocks
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String getAffectedBlocksList() {
|
||||||
|
if (affectedDataBlocks == null || affectedDataBlocks.size() == 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
String blocks = affectedDataBlocks.get(0).getDataName();
|
||||||
|
for (int i = 1; i < affectedDataBlocks.size(); i++) {
|
||||||
|
blocks += "; " + affectedDataBlocks.get(i).getDataName();
|
||||||
|
}
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return whether or not the task SHOULD be run - i.e. if it is selected in
|
* Return whether or not the task SHOULD be run - i.e. if it is selected in
|
||||||
* the dialog, etc...
|
* the dialog, etc...
|
||||||
|
Loading…
Reference in New Issue
Block a user