This appendix describes adding a new LDAD data source. Files describing the data format (.desc) and station info (Station.txt) need to be created, and a preprocessor may be required. The rest of the work is accomplished using the LDAD monitor Admin interface.
A set of useful Perl functions is provided in LdadUtils.pl. See Appendix C for a description of these utility functions.
If you wish to store the message in the text database, you will need to put a file in $LDAD_DATA/Text to make it available to the text storage routine. The standard approach is to put the raw message into the text database. If no preprocessor is otherwise needed, you can write a very simple script, such as this (moveRaws.pl):
#!/usr/local/perl/bin/perl -w
unshift (@INC, $ENV{'LDAD_INTERNAL_BIN'});
require "LdadUtils.pl";
&LdadUtils::moveFile ("RAWS");
1;
moveFile puts a copy in both /Raw and /Text. Routines copyToText and
copyToRaw are also available in LdadUtils.pl to put the file in /Text
and /Raw only, respectively. You would use these, for example, to put
the original file in the text database, while sending the preprocessed
file to the decoder. In either case, you need to call pingLdadRouter
to alert the system that the file is in place. Here is an example:
my($textFile) = &LdadUtils::copyToText ($file); &LdadUtils::pingLdadRouter ($textFile);
If you are reformatting the data, it's best to write first to a scratch file, then move it to /Raw and /Text. Otherwise, since the decoder processes all files it finds, it's possible that it will see your file before you've finished working on it. So use a structure like this:
$tmpFile = "$ENV{'LDAD_INTERNAL_HOME'}/ldadtmp/tmp$$";
open(obout, ">$tmpFile");
# do your thing, writing to obout
&LdadUtils::LDADcopy($tmpFile,$ARGV[0]);
unlink ($tmpFile);
After LDADinfo is changed, you must restart listener to read it and set up the preprocessor accordingly. You'll also need to restart the decode/store suite to read the new patterns and text storage files.
![]() |
|