Adding Core Modules
There are two types of PAMGuard module. Core modules which are built into the main PAMGuard code and Plugin modules which are distributed sparately. This page tells you how to add a core module to PAMGuard.
Before reading this page, make sure you’ve read up on how to develop a core module
Writing PAMGuard Plug-ins
Adding plug-ins to the Core PAMGuard model
To make a PAMGuard plug-in available to PAMGuard users it is necessary to edit the java file PamModel/PamModel.java.
First you register the module with PAMGuard using
= PamModuleInfo.registerControlledUnit (String className, String description); PamModuleInfo myModule
where className is the class name of the class PamControlledUnit and description is the descriptive name of the module.
For example
= PamModuleInfo.registerControlledUnit ("GPS.GPSControl", "GPS Processing"); PamModuleInfo myModule
adds the GPS module.
The module will now be listed in the PAMGuard File/Add Modules menu from where the user can create instances of the module.
The PAMGuard settings manager will be aware of the new module and will automatically create the module the next time PAMGuard is run. ### Add the module to a menu group
Due to the large number of PAMGuard modules now in existence, you will want to have your module listed in one of the sub menus of the File/Add Modules menu. You can add your module to one of the existing groups or you can create a new group of your own. For example, the following code adds the GPS module to the Map menu group
myModule.setModulesMenuGroup(mapsGroup);
Set module data dependencies
It is likely that your module will be dependent on data from some other PAMGuard module. For example, the click detector requires raw data from an acquisition module, the whistle detector required raw data from a FFT module and the GPS module requires data from an NMEA data source.
You can set module dependencies using
.addDependency(PamDependency dependancy) PamModuleInfo
for example
.addDependency(new PamDependency(NMEADataUnit.class, "NMEA.NMEAControl")); myModule
tells PAMGuard that myModule is dependent on some source of NMEADataUnit and that a possible source of this type of data is the NMEA.NMEAControl module.
Note that some types of data may be produced by many different modules, so here you should specify the most common source of the data your module will use.
Setting the minimum and maximum numbers of module instances
You can use two functions
.setMinNumber(int minNumber)
PamModuleInfo.setMaxNumber(int maxNumber) PamModuleInfo
to set the minimum and maximum numbers of a given module type.
If these are not set (which is generally the case), then the minimum number defaults to zero and there is no maximum number.
If you set a minimum number, then PAMGuard will automatically create that number of modules at start up.
If you set a maximum number then PAMGuard will prevent you from creating more than that number of modules.