Commit PAMGuard code from SVN r6251 to GIT

This commit is contained in:
douggillespie 2022-01-07 10:41:38 +00:00
parent ab1c228730
commit 7d095c29b4
5696 changed files with 798552 additions and 0 deletions

21
.classpath Normal file
View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-16.0.1">
<attributes>
<attribute name="module" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

14
.fatjar Normal file
View File

@ -0,0 +1,14 @@
#Fat Jar Configuration File
#Tue May 17 19:32:27 BST 2011
onejar.license.required=true
manifest.classpath=
manifest.removesigners=true
onejar.checkbox=false
jarname=Pambuard_Core_1_10_01a.jar
manifest.mergeall=true
manifest.mainclass=pamguard.Pamguard
manifest.file=<createnew>
jarname.isextern=false
onejar.expand=
excludes=
includes=

29
.project Normal file
View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PamGuard NOAA</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>net.sourceforge.metrics.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>net.sourceforge.metrics.nature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
encoding//src/rawDeepLearningClassifer/segmenter/SegmenterProcess.java=UTF-8

View File

@ -0,0 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
org.eclipse.jdt.core.compiler.compliance=11
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
org.eclipse.jdt.core.compiler.release=enabled
org.eclipse.jdt.core.compiler.source=11

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

BIN
BlankAccess._accdb Normal file

Binary file not shown.

BIN
BlankOOo._odb Normal file

Binary file not shown.

706
License_GNU_GPL3.html Normal file
View File

@ -0,0 +1,706 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<p>PAMGUARD is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
</p>
<p>
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License Version 3 a copy of which is provided
below.
</p>
<title>GNU General Public License v3.0 - GNU Project - Free Software Foundation (FSF)</title>
<link rel="alternate" type="application/rdf+xml"
href="http://www.gnu.org/licenses/gpl-3.0.rdf" />
</head>
<body>
<h3 style="text-align: center;">GNU GENERAL PUBLIC LICENSE</h3>
<p style="text-align: center;">Version 3, 29 June 2007</p>
<p>Copyright &copy; 2007 Free Software Foundation, Inc.
&lt;<a href="http://fsf.org/">http://fsf.org/</a>&gt;</p><p>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.</p>
<h3><a name="preamble"></a>Preamble</h3>
<p>The GNU General Public License is a free, copyleft license for
software and other kinds of works.</p>
<p>The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.</p>
<p>When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.</p>
<p>To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.</p>
<p>For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.</p>
<p>Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.</p>
<p>For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.</p>
<p>Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.</p>
<p>Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.</p>
<p>The precise terms and conditions for copying, distribution and
modification follow.</p>
<h3><a name="terms"></a>TERMS AND CONDITIONS</h3>
<h4><a name="section0"></a>0. Definitions.</h4>
<p>&ldquo;This License&rdquo; refers to version 3 of the GNU General Public License.</p>
<p>&ldquo;Copyright&rdquo; also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.</p>
<p>&ldquo;The Program&rdquo; refers to any copyrightable work licensed under this
License. Each licensee is addressed as &ldquo;you&rdquo;. &ldquo;Licensees&rdquo; and
&ldquo;recipients&rdquo; may be individuals or organizations.</p>
<p>To &ldquo;modify&rdquo; a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a &ldquo;modified version&rdquo; of the
earlier work or a work &ldquo;based on&rdquo; the earlier work.</p>
<p>A &ldquo;covered work&rdquo; means either the unmodified Program or a work based
on the Program.</p>
<p>To &ldquo;propagate&rdquo; a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.</p>
<p>To &ldquo;convey&rdquo; a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.</p>
<p>An interactive user interface displays &ldquo;Appropriate Legal Notices&rdquo;
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.</p>
<h4><a name="section1"></a>1. Source Code.</h4>
<p>The &ldquo;source code&rdquo; for a work means the preferred form of the work
for making modifications to it. &ldquo;Object code&rdquo; means any non-source
form of a work.</p>
<p>A &ldquo;Standard Interface&rdquo; means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.</p>
<p>The &ldquo;System Libraries&rdquo; of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
&ldquo;Major Component&rdquo;, in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.</p>
<p>The &ldquo;Corresponding Source&rdquo; for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.</p>
<p>The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.</p>
<p>The Corresponding Source for a work in source code form is that
same work.</p>
<h4><a name="section2"></a>2. Basic Permissions.</h4>
<p>All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.</p>
<p>You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.</p>
<p>Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.</p>
<h4><a name="section3"></a>3. Protecting Users' Legal Rights From Anti-Circumvention Law.</h4>
<p>No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.</p>
<p>When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.</p>
<h4><a name="section4"></a>4. Conveying Verbatim Copies.</h4>
<p>You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.</p>
<p>You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.</p>
<h4><a name="section5"></a>5. Conveying Modified Source Versions.</h4>
<p>You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:</p>
<ul>
<li>a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.</li>
<li>b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
&ldquo;keep intact all notices&rdquo;.</li>
<li>c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.</li>
<li>d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.</li>
</ul>
<p>A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
&ldquo;aggregate&rdquo; if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.</p>
<h4><a name="section6"></a>6. Conveying Non-Source Forms.</h4>
<p>You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:</p>
<ul>
<li>a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.</li>
<li>b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.</li>
<li>c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.</li>
<li>d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.</li>
<li>e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.</li>
</ul>
<p>A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.</p>
<p>A &ldquo;User Product&rdquo; is either (1) a &ldquo;consumer product&rdquo;, which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, &ldquo;normally used&rdquo; refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.</p>
<p>&ldquo;Installation Information&rdquo; for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.</p>
<p>If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).</p>
<p>The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.</p>
<p>Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.</p>
<h4><a name="section7"></a>7. Additional Terms.</h4>
<p>&ldquo;Additional permissions&rdquo; are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.</p>
<p>When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.</p>
<p>Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:</p>
<ul>
<li>a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or</li>
<li>b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or</li>
<li>c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or</li>
<li>d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or</li>
<li>e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or</li>
<li>f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.</li>
</ul>
<p>All other non-permissive additional terms are considered &ldquo;further
restrictions&rdquo; within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.</p>
<p>If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.</p>
<p>Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.</p>
<h4><a name="section8"></a>8. Termination.</h4>
<p>You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).</p>
<p>However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.</p>
<p>Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.</p>
<p>Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.</p>
<h4><a name="section9"></a>9. Acceptance Not Required for Having Copies.</h4>
<p>You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.</p>
<h4><a name="section10"></a>10. Automatic Licensing of Downstream Recipients.</h4>
<p>Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.</p>
<p>An &ldquo;entity transaction&rdquo; is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.</p>
<p>You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.</p>
<h4><a name="section11"></a>11. Patents.</h4>
<p>A &ldquo;contributor&rdquo; is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's &ldquo;contributor version&rdquo;.</p>
<p>A contributor's &ldquo;essential patent claims&rdquo; are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, &ldquo;control&rdquo; includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.</p>
<p>Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.</p>
<p>In the following three paragraphs, a &ldquo;patent license&rdquo; is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To &ldquo;grant&rdquo; such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.</p>
<p>If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. &ldquo;Knowingly relying&rdquo; means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.</p>
<p>If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.</p>
<p>A patent license is &ldquo;discriminatory&rdquo; if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.</p>
<p>Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.</p>
<h4><a name="section12"></a>12. No Surrender of Others' Freedom.</h4>
<p>If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.</p>
<h4><a name="section13"></a>13. Use with the GNU Affero General Public License.</h4>
<p>Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.</p>
<h4><a name="section14"></a>14. Revised Versions of this License.</h4>
<p>The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.</p>
<p>Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License &ldquo;or any later version&rdquo; applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.</p>
<p>If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.</p>
<p>Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.</p>
<h4><a name="section15"></a>15. Disclaimer of Warranty.</h4>
<p>THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM &ldquo;AS IS&rdquo; WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</p>
<h4><a name="section16"></a>16. Limitation of Liability.</h4>
<p>IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.</p>
<h4><a name="section17"></a>17. Interpretation of Sections 15 and 16.</h4>
<p>If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.</p>
<p>END OF TERMS AND CONDITIONS</p>
<h3><a name="howto"></a>How to Apply These Terms to Your New Programs</h3>
<p>If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.</p>
<p>To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the &ldquo;copyright&rdquo; line and a pointer to where the full notice is found.</p>
<pre> &lt;one line to give the program's name and a brief idea of what it does.&gt;
Copyright (C) &lt;year&gt; &lt;name of author&gt;
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see &lt;http://www.gnu.org/licenses/&gt;.
</pre>
<p>Also add information on how to contact you by electronic and paper mail.</p>
<p>If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:</p>
<pre> &lt;program&gt; Copyright (C) &lt;year&gt; &lt;name of author&gt;
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
</pre>
<p>The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an &ldquo;about box&rdquo;.</p>
<p>You should also get your employer (if you work as a programmer) or school,
if any, to sign a &ldquo;copyright disclaimer&rdquo; for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
&lt;<a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>&gt;.</p>
<p>The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
&lt;<a href="http://www.gnu.org/philosophy/why-not-lgpl.html">http://www.gnu.org/philosophy/why-not-lgpl.html</a>&gt;.</p>
</body></html>

687
License_GNU_GPL3.txt Normal file
View File

@ -0,0 +1,687 @@
PAMGUARD is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License Version 3 a copy of which is provided
below.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

BIN
NetworkMonitor.exe Normal file

Binary file not shown.

BIN
PamSettingsFiles.psg Normal file

Binary file not shown.

7
PamguardBeta32.l4j.ini Normal file
View File

@ -0,0 +1,7 @@
-Xms384m
-Xmx912m
-Djava.library.path=lib
-XX:+HeapDumpOnOutOfMemoryError
-jar PamguardSMRU_1_12_54.jar
-sml
-smru

View File

@ -0,0 +1,7 @@
-Xms384m
-Xmx512m
-Djava.library.path=lib
-XX:+HeapDumpOnOutOfMemoryError
-jar PamguardSMRU_1_12_54.jar
-nr
-sml

View File

@ -0,0 +1,8 @@
-Xms384m
-Xmx512m
-Djava.library.path=lib
-XX:+HeapDumpOnOutOfMemoryError
-jar PamguardSMRU_1_12_54.jar
-v
-sml
-smru

BIN
PamguardSettings.psf Normal file

Binary file not shown.

4670
README.html Normal file

File diff suppressed because it is too large Load Diff

93
WMM.COF Normal file
View File

@ -0,0 +1,93 @@
2015.0 WMM-2015 12/15/2014
1 0 -29438.5 0.0 10.7 0.0
1 1 -1501.1 4796.2 17.9 -26.8
2 0 -2445.3 0.0 -8.6 0.0
2 1 3012.5 -2845.6 -3.3 -27.1
2 2 1676.6 -642.0 2.4 -13.3
3 0 1351.1 0.0 3.1 0.0
3 1 -2352.3 -115.3 -6.2 8.4
3 2 1225.6 245.0 -0.4 -0.4
3 3 581.9 -538.3 -10.4 2.3
4 0 907.2 0.0 -0.4 0.0
4 1 813.7 283.4 0.8 -0.6
4 2 120.3 -188.6 -9.2 5.3
4 3 -335.0 180.9 4.0 3.0
4 4 70.3 -329.5 -4.2 -5.3
5 0 -232.6 0.0 -0.2 0.0
5 1 360.1 47.4 0.1 0.4
5 2 192.4 196.9 -1.4 1.6
5 3 -141.0 -119.4 0.0 -1.1
5 4 -157.4 16.1 1.3 3.3
5 5 4.3 100.1 3.8 0.1
6 0 69.5 0.0 -0.5 0.0
6 1 67.4 -20.7 -0.2 0.0
6 2 72.8 33.2 -0.6 -2.2
6 3 -129.8 58.8 2.4 -0.7
6 4 -29.0 -66.5 -1.1 0.1
6 5 13.2 7.3 0.3 1.0
6 6 -70.9 62.5 1.5 1.3
7 0 81.6 0.0 0.2 0.0
7 1 -76.1 -54.1 -0.2 0.7
7 2 -6.8 -19.4 -0.4 0.5
7 3 51.9 5.6 1.3 -0.2
7 4 15.0 24.4 0.2 -0.1
7 5 9.3 3.3 -0.4 -0.7
7 6 -2.8 -27.5 -0.9 0.1
7 7 6.7 -2.3 0.3 0.1
8 0 24.0 0.0 0.0 0.0
8 1 8.6 10.2 0.1 -0.3
8 2 -16.9 -18.1 -0.5 0.3
8 3 -3.2 13.2 0.5 0.3
8 4 -20.6 -14.6 -0.2 0.6
8 5 13.3 16.2 0.4 -0.1
8 6 11.7 5.7 0.2 -0.2
8 7 -16.0 -9.1 -0.4 0.3
8 8 -2.0 2.2 0.3 0.0
9 0 5.4 0.0 0.0 0.0
9 1 8.8 -21.6 -0.1 -0.2
9 2 3.1 10.8 -0.1 -0.1
9 3 -3.1 11.7 0.4 -0.2
9 4 0.6 -6.8 -0.5 0.1
9 5 -13.3 -6.9 -0.2 0.1
9 6 -0.1 7.8 0.1 0.0
9 7 8.7 1.0 0.0 -0.2
9 8 -9.1 -3.9 -0.2 0.4
9 9 -10.5 8.5 -0.1 0.3
10 0 -1.9 0.0 0.0 0.0
10 1 -6.5 3.3 0.0 0.1
10 2 0.2 -0.3 -0.1 -0.1
10 3 0.6 4.6 0.3 0.0
10 4 -0.6 4.4 -0.1 0.0
10 5 1.7 -7.9 -0.1 -0.2
10 6 -0.7 -0.6 -0.1 0.1
10 7 2.1 -4.1 0.0 -0.1
10 8 2.3 -2.8 -0.2 -0.2
10 9 -1.8 -1.1 -0.1 0.1
10 10 -3.6 -8.7 -0.2 -0.1
11 0 3.1 0.0 0.0 0.0
11 1 -1.5 -0.1 0.0 0.0
11 2 -2.3 2.1 -0.1 0.1
11 3 2.1 -0.7 0.1 0.0
11 4 -0.9 -1.1 0.0 0.1
11 5 0.6 0.7 0.0 0.0
11 6 -0.7 -0.2 0.0 0.0
11 7 0.2 -2.1 0.0 0.1
11 8 1.7 -1.5 0.0 0.0
11 9 -0.2 -2.5 0.0 -0.1
11 10 0.4 -2.0 -0.1 0.0
11 11 3.5 -2.3 -0.1 -0.1
12 0 -2.0 0.0 0.1 0.0
12 1 -0.3 -1.0 0.0 0.0
12 2 0.4 0.5 0.0 0.0
12 3 1.3 1.8 0.1 -0.1
12 4 -0.9 -2.2 -0.1 0.0
12 5 0.9 0.3 0.0 0.0
12 6 0.1 0.7 0.1 0.0
12 7 0.5 -0.1 0.0 0.0
12 8 -0.4 0.3 0.0 0.0
12 9 -0.4 0.2 0.0 0.0
12 10 0.2 -0.9 0.0 0.0
12 11 -0.9 -0.2 0.0 0.0
12 12 0.0 0.7 0.0 0.0
999999999999999999999999999999999999999999999999
999999999999999999999999999999999999999999999999

BIN
buoynet.exe Normal file

Binary file not shown.

213
dependency-reduced-pom.xml Normal file
View File

@ -0,0 +1,213 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>PamguardBeta</artifactId>
<name>Pamguard Java12+</name>
<version>2.01.0601</version>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
<organization>
<name>Sea Mammal Research Unit, University of St. Andrews</name>
<url>http://www.smru.st-andrews.ac.uk</url>
</organization>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
<exclude>jars/*.*</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<versionRange>[3.1.1,)</versionRange>
<goals>
<goal>purge-local-repository</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore />
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<dependencies>
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
<configuration>
<release>11</release>
<compilerId>jdt</compilerId>
<compilerArguments>
<properties>.settings/org.eclipse.jdt.core.prefs</properties>
</compilerArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<configuration>
<source>16</source>
<target>16</target>
<release>16</release>
</configuration>
</plugin>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<manifestEntries>
<Main-Class>pamguard.Pamguard</Main-Class>
<Class-Path>.</Class-Path>
<SplashScreen-Image>Resources/pgBlankSplash.png</SplashScreen-Image>
</manifestEntries>
</transformer>
<transformer />
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
<configuration>
<transformers>
<transformer />
</transformers>
</configuration>
</plugin>
<plugin>
<groupId>com.github.marschall</groupId>
<artifactId>jdeps-maven-plugin</artifactId>
<version>0.5.1</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/tempDependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<releases>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>repo</id>
<url>file://${project.basedir}/repo</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>a0u0ltozdsehx-artifactory-primary-0-releases</name>
<url>https://jmachund.jfrog.io/artifactory/jpam2</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>unidata-all</id>
<name>Unidata netCDF</name>
<url>https://artifacts.unidata.ucar.edu/repository/unidata-all/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>geomajas</id>
<name>geomajas</name>
<url>http://maven.geomajas.org/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bedatadriven</id>
<name>bedatadriven_renjin</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>talan</id>
<name>talan</name>
<url>https://nexus.talanlabs.com/content/repositories/releases/</url>
</repository>
</repositories>
<reporting>
<plugins>
<plugin>
<groupId>com.github.marschall</groupId>
<artifactId>jdeps-maven-plugin</artifactId>
<version>0.5.1</version>
</plugin>
</plugins>
</reporting>
<properties>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>11</maven.compiler.source>
<javafx.version>16</javafx.version>
</properties>
</project>

BIN
javaOptions32.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
javaOptions64.PNG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

BIN
lib64/PamTiming.dll Normal file

Binary file not shown.

BIN
lib64/SailDaqJNI.dll Normal file

Binary file not shown.

BIN
lib64/SmruDaqJNI.dll Normal file

Binary file not shown.

BIN
lib64/j3dcore-ogl.dll Normal file

Binary file not shown.

BIN
lib64/jasiohost64.dll Normal file

Binary file not shown.

BIN
lib64/jninidaqmx.dll Normal file

Binary file not shown.

BIN
lib64/libj3dcore-ogl.so Normal file

Binary file not shown.

BIN
lib64/mccjniinterface.dll Normal file

Binary file not shown.

BIN
lib64/pamguardasio.dll Normal file

Binary file not shown.

BIN
libgcc_s_dw2-1.dll Normal file

Binary file not shown.

30
liblinux/Usage.txt Normal file
View File

@ -0,0 +1,30 @@
REQUIRED BY
14/03/2012 14:11 823,296 j3dcore-d3d.dll Java3d
14/03/2012 14:11 40,960 j3dcore-ogl-cg.dll Java3d
14/03/2012 14:11 49,152 j3dcore-ogl-chk.dll Java3d
14/03/2012 14:11 163,840 j3dcore-ogl.dll Java3d
jasiohost32.dll new for ASIO card usage
07/03/2012 11:53 61,723 jninidaqmx.dll NI card usage
libj3dcore-ogl-cg.so Java3d
libj3dcore-ogl.so Java3d
14/03/2012 14:11 14,615 libjniAlsaLibrary.so
14/03/2012 14:11 47,665 libjninidaqmx.so NI card usage
libPamguardJNI.so hfdaq card (x)
14/03/2012 14:11 45,271 librxtxParallel.so
14/03/2012 14:11 169,488 librxtxSerial.jnilib
14/03/2012 14:11 146,489 librxtxSerial.so serial port usage
14/03/2012 14:11 15,326 mccjniinterface.dll Measurement Computing-Depth Sensors
14/03/2012 14:11 216 pamguardasio.def
14/03/2012 14:11 537,932 pamguardasio.dll ASIO card usage
14/03/2012 14:11 46,592 PamTiming.dll
14/03/2012 14:11 77,759 rxtxSerial.dll serial port usage
ROOT
07/01/2011 21:35 107,520 libgcc_s_dw2-1.dll jninidaqmx.dll
07/01/2011 21:35 879,630 libstdc++-6.dll jninidaqmx.dll
libPamguardJNI.so hfdaq card (x)
Java 3d version 1.5.2!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

BIN
liblinux/libPamguardJNI.so Normal file

Binary file not shown.

Binary file not shown.

BIN
liblinux/libj3dcore-ogl.so Normal file

Binary file not shown.

Binary file not shown.

BIN
liblinux/libjninidaqmx.so Normal file

Binary file not shown.

BIN
liblinux/librxtxParallel.so Normal file

Binary file not shown.

BIN
liblinux/librxtxSerial.so Normal file

Binary file not shown.

BIN
libstdc++-6.dll Normal file

Binary file not shown.

334
missing_Java.html Normal file
View File

@ -0,0 +1,334 @@
<html>
<head>
<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
<meta name=Generator content="Microsoft Word 15 (filtered)">
<style>
<!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Cambria;
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin-top:0cm;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
h1
{mso-style-link:"Heading 1 Char";
margin-top:24.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria",serif;
color:#365F91;}
h2
{mso-style-link:"Heading 2 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:13.0pt;
font-family:"Cambria",serif;
color:#4F81BD;}
h3
{mso-style-link:"Heading 3 Char";
margin-top:10.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:11.0pt;
font-family:"Cambria",serif;
color:#4F81BD;}
p.MsoToc1, li.MsoToc1, div.MsoToc1
{margin-top:18.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Cambria",serif;
text-transform:uppercase;
font-weight:bold;}
p.MsoToc2, li.MsoToc2, div.MsoToc2
{margin-top:12.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;
font-weight:bold;}
p.MsoToc3, li.MsoToc3, div.MsoToc3
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:11.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc4, li.MsoToc4, div.MsoToc4
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:22.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc5, li.MsoToc5, div.MsoToc5
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:33.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc6, li.MsoToc6, div.MsoToc6
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:44.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc7, li.MsoToc7, div.MsoToc7
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:55.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc8, li.MsoToc8, div.MsoToc8
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:66.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoToc9, li.MsoToc9, div.MsoToc9
{margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:77.0pt;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}
p.MsoTitle, li.MsoTitle, div.MsoTitle
{mso-style-link:"Title Char";
margin-top:0cm;
margin-right:0cm;
margin-bottom:15.0pt;
margin-left:0cm;
font-size:26.0pt;
font-family:"Cambria",serif;
color:#17365D;
letter-spacing:.25pt;}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
{mso-style-link:"Balloon Text Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:8.0pt;
font-family:"Tahoma",sans-serif;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
{margin-top:0cm;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.MsoTocHeading, li.MsoTocHeading, div.MsoTocHeading
{margin-top:24.0pt;
margin-right:0cm;
margin-bottom:0cm;
margin-left:0cm;
margin-bottom:.0001pt;
page-break-after:avoid;
font-size:14.0pt;
font-family:"Cambria",serif;
color:#365F91;
font-weight:bold;}
span.Heading1Char
{mso-style-name:"Heading 1 Char";
mso-style-link:"Heading 1";
font-family:"Cambria",serif;
color:#365F91;
font-weight:bold;}
span.Heading2Char
{mso-style-name:"Heading 2 Char";
mso-style-link:"Heading 2";
font-family:"Cambria",serif;
color:#4F81BD;
font-weight:bold;}
span.Heading3Char
{mso-style-name:"Heading 3 Char";
mso-style-link:"Heading 3";
font-family:"Cambria",serif;
color:#4F81BD;
font-weight:bold;}
span.TitleChar
{mso-style-name:"Title Char";
mso-style-link:Title;
font-family:"Cambria",serif;
color:#17365D;
letter-spacing:.25pt;}
span.BalloonTextChar
{mso-style-name:"Balloon Text Char";
mso-style-link:"Balloon Text";
font-family:"Tahoma",sans-serif;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin-right:0cm;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.msotitlecxspfirst, li.msotitlecxspfirst, div.msotitlecxspfirst
{mso-style-name:msotitlecxspfirst;
margin:0cm;
margin-bottom:.0001pt;
font-size:26.0pt;
font-family:"Cambria",serif;
color:#17365D;
letter-spacing:.25pt;}
p.msotitlecxspmiddle, li.msotitlecxspmiddle, div.msotitlecxspmiddle
{mso-style-name:msotitlecxspmiddle;
margin:0cm;
margin-bottom:.0001pt;
font-size:26.0pt;
font-family:"Cambria",serif;
color:#17365D;
letter-spacing:.25pt;}
p.msotitlecxsplast, li.msotitlecxsplast, div.msotitlecxsplast
{mso-style-name:msotitlecxsplast;
margin-top:0cm;
margin-right:0cm;
margin-bottom:15.0pt;
margin-left:0cm;
font-size:26.0pt;
font-family:"Cambria",serif;
color:#17365D;
letter-spacing:.25pt;}
p.msolistparagraphcxspfirst, li.msolistparagraphcxspfirst, div.msolistparagraphcxspfirst
{mso-style-name:msolistparagraphcxspfirst;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msolistparagraphcxspmiddle, li.msolistparagraphcxspmiddle, div.msolistparagraphcxspmiddle
{mso-style-name:msolistparagraphcxspmiddle;
margin-top:0cm;
margin-right:0cm;
margin-bottom:0cm;
margin-left:36.0pt;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msolistparagraphcxsplast, li.msolistparagraphcxsplast, div.msolistparagraphcxsplast
{mso-style-name:msolistparagraphcxsplast;
margin-top:0cm;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:36.0pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msopapdefault, li.msopapdefault, div.msopapdefault
{mso-style-name:msopapdefault;
margin-right:0cm;
margin-bottom:4.0pt;
margin-left:0cm;
font-size:12.0pt;
font-family:"Times New Roman",serif;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
margin-right:0cm;
margin-left:0cm;
font-size:10.0pt;
font-family:"Times New Roman",serif;}
.MsoChpDefault
{font-size:10.0pt;}
@page WordSection1
{size:595.3pt 841.9pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
-->
</style>
</head>
<body lang=EN-GB link=blue vlink=purple>
<div class=WordSection1>
<p class=MsoTitle>PAMGuard Cannot Start</p>
<h1>What is the problem?</h1>
<p class=MsoNormal>Pamguard is unable to start because it cannot find a valid installation of Java on this computer. A 64-bit install of PAMGuard requries the 64-bit version of Java,
and a 32-bit install of PAMGuard requries the 32-bit version of Java. Typically on a Windows machine, Java will be installed in one of these default locations:
<ul>
<li class=MsoNormal>C:\Program Files\Java for the 64-bit version</li>
<li class=MsoNormal>C:\Program Files (x86)\Java for the 32-bit version</li>
</ul>
</p>
<h1>Where can I download Java from?</h1>
<p class=MsoNormal>Java can be downloaded from the official Oracle Java website: <a href="http://java.com/en/download/manual.jsp" target="_blank">http://java.com/en/download/manual.jsp</a>.
</p>
<h1>But I've already installed Java, why am I still seeing this message?</h1>
<p class=MsoNormal>If you have already installed Java but are still seeing this message, there is a good chance that you have installed the wrong version.
The Java website gives many options for downloading Java. If you have installed 64-bit PAMGuard, you must make sure you download the version of Java
specifically marked as 64-bit: </p>
<p><img src="javaOptions64.PNG"</p>
<p>&nbsp</p>
<p class=MsoNormal>If you have installed 32-bit PAMGuard, you need to download one of the other versions:</p>
<p><img src="javaOptions32.PNG"</p>
<p class=MsoNormal>(it would have been nice if Oracle had made this clearer...)</p>
<h1>Still no luck...</h1>
<p class=MsoNormal>When PAMGuard can't find Java, it's not necessarily looking in the folders listed above. Instead, PAMGuard refers to the Windows Registry which should contain links to the correct installation folders. If you have installed
the correct version of Java and still cannot start PAMGuard, it's possible that the registry settings are corrupted. Try uninstalling all versions of Java (there's a good chance
you have a number of them on your machine) and reinstalling the latest version. If you still have problems, contact us at <a href="mailto:support@pamguard.org">support@pamguard.org</a> and we'll help you to figure it out.</p>
</div>
</body>
</html>

BIN
msvcr100.dll Normal file

Binary file not shown.

823
pom.xml Normal file
View File

@ -0,0 +1,823 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.pamguard</groupId>
<artifactId>PamguardBeta</artifactId>
<version>2.02.02</version>
<name>Pamguard Java12+</name>
<description>Pamguard for Java 12+, using Maven to control dependcies</description>
<url>www.pamguard.org</url>
<organization>
<name>Sea Mammal Research Unit, University of St. Andrews</name>
<url>http://www.smru.st-andrews.ac.uk</url>
</organization>
<properties>
<javafx.version>16</javafx.version>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude> <!-- don't include any source files -->
<exclude>jars/*.*</exclude> <!-- don't include files in the jars folder -->
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<!-- original maven compiler definition - uses the JRE's javac compiler, not the one Eclipse uses
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<release>13</release>
</configuration>
-->
<!-- attempt to use the Eclipse JDT compiler, so that the errors match when building
https://stackoverflow.com/questions/38070326/java-generics-compiler-error-not-shown-in-eclipse
https://wiki.eclipse.org/JDT/FAQ#Can_I_use_JDT_outside_Eclipse_to_compile_Java_code.3F
https://wiki.eclipse.org/Tycho/FAQ#Can_I_use_the_Tycho_compiler_support_in_non-OSGi_projects.2C_too.3F
-->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<!-- set compiler to use Java version 11 API https://docs.oracle.com/javase/9/tools/javac.htm#JSWOR627 -->
<release>11</release>
<compilerId>jdt</compilerId>
<compilerArguments>
<properties>.settings/org.eclipse.jdt.core.prefs</properties> <!-- make sure to use same params as what Eclipse uses -->
</compilerArguments>
</configuration>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.eclipse.tycho/tycho-compiler-jdt -->
<dependency>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-jdt</artifactId>
<version>1.5.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.6</version>
<configuration>
<source>16</source>
<target>16</target>
<release>16</release>
</configuration>
</plugin>
<!-- Maven Shade plugin - for creating the uberjar / fatjar -->
<!-- see http://maven.apache.org/plugins/maven-shade-plugin/index.html for details -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>pamguard.Pamguard</Main-Class>
<Class-Path>.</Class-Path> <!-- this is from the orig ant build file -->
<SplashScreen-Image>Resources/pgBlankSplash.png</SplashScreen-Image> <!-- this is from the orig ant build file -->
</manifestEntries>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude> <!-- get rid of manifests from library jars - also done in orig ant build file -->
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<!-- The Maven-JDEPS plugin, to analyze necessary JDK dependencies. See
this site for details: https://maven.apache.org/plugins/maven-jdeps-plugin/index.html -->
<plugin>
<groupId>com.github.marschall</groupId>
<artifactId>jdeps-maven-plugin</artifactId>
<version>0.5.1</version>
</plugin>
<!-- The Maven dependency plugin, which can copy all dependencies into a temp folder for jdeps analysis -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/tempDependencies</outputDirectory>
<overWriteReleases>false</overWriteReleases>
<overWriteSnapshots>false</overWriteSnapshots>
<overWriteIfNewer>true</overWriteIfNewer>
</configuration>
</execution>
<!-- this deletes all the dependencies in the local repository and downloads them again.
Run a Maven > Update after doing this in order to properly reset the dependencies. Also, you
will need to add the 3 jar files (x3, JasioHost and jave) back into the local repository after
running this command -->
<!-- I'm not sure why, but every time I try to run the shade:shade build to create a
fatjar it first runs this, which deletes all of the dependencies and completely fails.
I think it has something to do with the lifecycle mapping, but that's beyond my Maven
abilities right now.
I can't even remember why I added this in the first place, so I'm going to comment
it out
<execution>
<id>purge-local-dependencies</id>
<phase>process-sources</phase>
<goals>
<goal>purge-local-repository</goal>
</goals>
<configuration>
</configuration>
</execution>
-->
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-dependency-plugin
</artifactId>
<versionRange>
[3.1.1,)
</versionRange>
<goals>
<goal>
purge-local-repository
</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<reporting>
<plugins>
<plugin>
<groupId>com.github.marschall</groupId>
<artifactId>jdeps-maven-plugin</artifactId>
<version>0.5.1</version>
</plugin>
</plugins>
</reporting>
<!-- ************************* Extra Repositories ************************************* -->
<repositories>
<!-- Project repo to hold the custom jar files that are not available in Maven. Do
this so that we don't have to do the extra step of manually installing jar files in the local repo -->
<repository>
<id>repo</id>
<releases>
<enabled>true</enabled>
<checksumPolicy>ignore</checksumPolicy>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
<url>file://${project.basedir}/repo</url>
</repository>
<!-- Repo for Jamie's code -->
<!-- IMPORTANT: SOMEHOW THIS REPO INTERFERES WITH THE
JAVAFX DEPENDENCIES. Don't understand how, but it
does. If Maven is not downloading the JavaFX dependencies
and is instead throwing errors, try commenting out this
repository. Let Maven download the JavaFX files, and
then uncomment this repo again.
Same thing seems to be occurring if I try to update the postgresql library. -->
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>a0u0ltozdsehx-artifactory-primary-0-releases</name>
<url>https://jmachund.jfrog.io/artifactory/jpam2</url>
</repository>
<!-- Repo for netCDF -->
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>unidata-all</id>
<name>Unidata netCDF</name>
<url>https://artifacts.unidata.ucar.edu/repository/unidata-all/</url>
</repository>
<!-- -->
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>geomajas</id>
<name>geomajas</name>
<url>http://maven.geomajas.org/</url>
</repository>
<!-- Repo for Renjin Script Engine -->
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>bedatadriven</id>
<name>bedatadriven_renjin</name>
<url>https://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>talan</id>
<name>talan</name>
<url>https://nexus.talanlabs.com/content/repositories/releases/</url>
</repository>
</repositories>
<!-- ************************* Dependencies ************************************* -->
<dependencies>
<!--jpam project - utilities -->
<dependency>
<groupId>org.jamdev</groupId>
<artifactId>jpamutils</artifactId>
<version>0.0.55</version>
</dependency>
<!--jpam project - Deep learning java library -->
<dependency>
<groupId>org.jamdev</groupId>
<artifactId>jdl4pam</artifactId>
<version>0.0.91</version>
</dependency>
<!-- https://mvnrepository.com/artifact/gov.nist.math/jama -->
<dependency>
<groupId>gov.nist.math</groupId>
<artifactId>jama</artifactId>
<version>1.0.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-controls -->
<!-- IMPORTANT - IF MAVEN IS NOT DOWNLOADING THE JAVAFX FILES AND
INSTEAD THROWING AN ERROR, IT MIGHT BE BECAUSE THERE IS AN
INTERFERENCE WITH JAMIE'S REPOSITORY. I'm not sure why this happens,
but it does. To fix, comment out the repository (in
the <repositories> section above, let Maven download the JavaFX
files, and then uncomment the repository again. -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-swing -->
<!-- IMPORTANT - IF MAVEN IS NOT DOWNLOADING THE JAVAFX FILES AND
INSTEAD THROWING AN ERROR, IT MIGHT BE BECAUSE THERE IS AN
INTERFERENCE WITH JAMIE'S REPOSITORY. I'm not sure why this happens,
but it does. To fix, comment out the repository (in
the <repositories> section above, let Maven download the JavaFX
files, and then uncomment the repository again. -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-swing</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-media -->
<!-- IMPORTANT - IF MAVEN IS NOT DOWNLOADING THE JAVAFX FILES AND
INSTEAD THROWING AN ERROR, IT MIGHT BE BECAUSE THERE IS AN
INTERFERENCE WITH JAMIE'S REPOSITORY. I'm not sure why this happens,
but it does. To fix, comment out the repository (in
the <repositories> section above, let Maven download the JavaFX
files, and then uncomment the repository again. -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.openjfx/javafx-web -->
<!-- IMPORTANT - IF MAVEN IS NOT DOWNLOADING THE JAVAFX FILES AND
INSTEAD THROWING AN ERROR, IT MIGHT BE BECAUSE THERE IS AN
INTERFERENCE WITH JAMIE'S REPOSITORY. I'm not sure why this happens,
but it does. To fix, comment out the repository (in
the <repositories> section above, let Maven download the JavaFX
files, and then uncomment the repository again. -->
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
<version>${javafx.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-compress -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
<version>1.19</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-csv -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.9</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.6.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-math -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math</artifactId>
<version>2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-net/commons-net -->
<dependency>
<groupId>commons-net</groupId>
<artifactId>commons-net</artifactId>
<version>3.6</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.controlsfx/controlsfx -->
<dependency>
<groupId>org.controlsfx</groupId>
<artifactId>controlsfx</artifactId>
<version>11.0.0</version>
<exclusions>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-base</artifactId>
</exclusion>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
</exclusion>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
</exclusion>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-media</artifactId>
</exclusion>
<exclusion>
<groupId>org.openjfx</groupId>
<artifactId>javafx-web</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://search.maven.org/artifact/org.kordamp.ikonli/ikonli-javafx/12.2.0/jar -->
<!-- Icon symbol pack to replace FontAwesome. This is the core library, and the
actual symbol packs need to be added separately (see below) -->
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-javafx</artifactId>
<version>12.2.0</version>
</dependency>
<!-- Ikonli FontAwesome5 font pack https://kordamp.org/ikonli/cheat-sheet-fontawesome5.html -->
<!--
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-fontawesome5-pack</artifactId>
<version>12.2.0</version>
</dependency>
-->
<!-- Ikonli MaterialDesign2 (Latest) font pack https://kordamp.org/ikonli/cheat-sheet-materialdesign2.html -->
<dependency>
<groupId>org.kordamp.ikonli</groupId>
<artifactId>ikonli-materialdesign2-pack</artifactId>
<version>12.2.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.geographiclib/GeographicLib-Java -->
<dependency>
<groupId>net.sf.geographiclib</groupId>
<artifactId>GeographicLib-Java</artifactId>
<version>1.50</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jogamp.gluegen/gluegen -->
<dependency>
<groupId>org.jogamp.gluegen</groupId>
<artifactId>gluegen-rt-main</artifactId>
<version>2.3.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/java3d/j3dutils -->
<!-- https://mvnrepository.com/artifact/java3d/j3dcore -->
<!-- https://mvnrepository.com/artifact/com.healthmarketscience.jackcess/jackcess -->
<dependency>
<groupId>com.healthmarketscience.jackcess</groupId>
<artifactId>jackcess</artifactId>
<version>3.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.jogamp.jogl/jogl-all-main -->
<dependency>
<groupId>org.jogamp.jogl</groupId>
<artifactId>jogl-all-main</artifactId>
<version>2.3.2</version>
</dependency>
<!-- NOT SURE IF WE NEED THE JAXB LIBRARIES HERE - NO ERRORS WHEN REMOVED
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>2.3.0.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.3.2</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/org.jflac/jflac-codec -->
<dependency>
<groupId>org.jflac</groupId>
<artifactId>jflac-codec</artifactId>
<version>1.5.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.help/javahelp -->
<dependency>
<groupId>javax.help</groupId>
<artifactId>javahelp</artifactId>
<version>2.0.05</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.java.dev.jna/jna-platform -->
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.jcraft/jsch -->
<dependency>
<groupId>com.jcraft</groupId>
<artifactId>jsch</artifactId>
<version>0.1.55</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fazecast/jSerialComm -->
<dependency>
<groupId>com.fazecast</groupId>
<artifactId>jSerialComm</artifactId>
<version>2.5.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/edu.emory.mathcs/JTransforms -->
<dependency>
<groupId>edu.emory.mathcs</groupId>
<artifactId>JTransforms</artifactId>
<version>2.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.mail/javax.mail -->
<dependency>
<groupId>com.sun.mail</groupId>
<artifactId>javax.mail</artifactId>
<version>1.6.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.diffplug.matsim/matfilerw -->
<dependency>
<groupId>com.diffplug.matsim</groupId>
<artifactId>matfilerw</artifactId>
<version>3.1.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.drewnoakes/metadata-extractor -->
<dependency>
<groupId>com.drewnoakes</groupId>
<artifactId>metadata-extractor</artifactId>
<version>2.12.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/mysql/mysql-connector-java -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java -->
<!-- this is needed so that tensorflow models run properly (used in Deep Learning plugin) -->
<!-- NOTE it is important this is included before edu.ucar.netcdfAll so
that this version is used instead of the internal version - exclusions do
not seem to work otherwise -->
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.17.0</version>
</dependency>
<!-- https://docs.unidata.ucar.edu/netcdf-java/5.2/userguide/using_netcdf_java_artifacts.html -->
<!-- exclusions have been added here to fix problem with Deep Learning plugin - see above -->
<dependency>
<groupId>edu.ucar</groupId>
<artifactId>netcdfAll</artifactId>
<version>4.6.14</version>
<exclusions>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java-util</artifactId>
</exclusion>
</exclusions>
<scope>compile</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.opencsv/opencsv -->
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework/org.springframework.core -->
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>42.2.24</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.renjin/renjin-script-engine -->
<dependency>
<groupId>org.renjin</groupId>
<artifactId>renjin-script-engine</artifactId>
<version>0.9.2725</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api
this one is only needed to get rid of an annoying warning that shows up during startup -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-nop
this one is only needed to get rid of an annoying warning that shows up during startup -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.8.0-beta4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.docx4j/docx4j-JAXB-ReferenceImpl -->
<!-- note that we are excluding slf4j-api here, because if we don't then one of the
transitive dependencies of docx4j (jcl-over-slf4j) will try to load an older
version of slf4j-api, resulting in a weird warning/error that shows up every time that
PAMGuard start up -->
<!-- DONT BOTHER WITH EXCLUSION, DOESN'T MAKE THE ERROR GO AWAY. Leaving code here
just in case the older version does cause a conflict at some point -->
<dependency>
<groupId>org.docx4j</groupId>
<artifactId>docx4j-JAXB-ReferenceImpl</artifactId>
<version>11.1.3</version>
<!--
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
-->
</dependency>
<!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.28.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/net.sf.ucanaccess/ucanaccess -->
<dependency>
<groupId>net.sf.ucanaccess</groupId>
<artifactId>ucanaccess</artifactId>
<version>4.0.4</version>
</dependency>
<!-- https://mvnrepository.com/artifact/nz.ac.waikato.cms.weka/weka-dev -->
<dependency>
<groupId>nz.ac.waikato.cms.weka</groupId>
<artifactId>weka-dev</artifactId>
<version>3.7.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.vecmath/vecmath -->
<dependency>
<groupId>javax.vecmath</groupId>
<artifactId>vecmath</artifactId>
<version>1.5.2</version>
</dependency>
<!-- Jave2 (https://github.com/a-schild/jave2) - fork of original jave from sauronsoft. A LOT bigger; the win64 files alone are > 60Mb compared
to 14Mb originally. Since the old one worked fine, let's stick with it for now and save the space
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-core</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>ws.schild</groupId>
<artifactId>jave-nativebin-win64</artifactId>
<version>2.7.1</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave
DOESN'T WORK - NOT IN THE ICM REPOSITORY ANYMORE. STICK WITH ORIG JAR FILE
<dependency>
<groupId>it.sauronsoftware</groupId>
<artifactId>jave</artifactId>
<version>1.0.2</version>
</dependency>
-->
<!-- not in Maven repository -->
<dependency>
<groupId>pamguard.org</groupId>
<artifactId>x3</artifactId>
<version>2.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/it.sauronsoftware/jave -->
<dependency>
<groupId>it.sauronsoftware</groupId>
<artifactId>jave</artifactId>
<version>1.0.2</version>
</dependency>
<!-- not in Maven repository -->
<dependency>
<groupId>com.synthbot</groupId>
<artifactId>jasiohost</artifactId>
<version>1.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-xml -->
<!--
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.10.1</version>
</dependency>
-->
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.2.3.RELEASE</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.1stleg/jnativehook -->
<!-- For global hotkeys, especially in Logger -->
<dependency>
<groupId>com.1stleg</groupId>
<artifactId>jnativehook</artifactId>
<version>2.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.swinglabs.swingx/swingx-all -->
<!-- For new Network Receive Module -->
<dependency>
<groupId>org.swinglabs.swingx</groupId>
<artifactId>swingx-all</artifactId>
<version>1.6.5-1</version>
</dependency>
</dependencies>
</project>

BIN
recentDatabase.psg Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
80894a24611dd094833240c7cd79d9b2

View File

@ -0,0 +1 @@
4505e6f9a4eb378c4829dcb86f1931aee0c1bfc3

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.synthbot</groupId>
<artifactId>jasiohost</artifactId>
<version>1.0.0</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1 @@
5e2106e147ef45f77b3e91c384def6af

View File

@ -0,0 +1 @@
5e6857b53b411340c93282ae52be6b2aa15d47ef

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>com.synthbot</groupId>
<artifactId>jasiohost</artifactId>
<versioning>
<release>1.0.0</release>
<versions>
<version>1.0.0</version>
</versions>
<lastUpdated>20200929205508</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1 @@
c9fb2c83191533b3307ace34ed293dd5

View File

@ -0,0 +1 @@
e49078970a9e78fede176bf1ac95f76d418a5051

View File

@ -0,0 +1 @@
206c1f473f5e8488e7a870480a3ba1b9

View File

@ -0,0 +1 @@
646f6c25b8f62d5634f7eed3f4a634edc9b50475

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>it.sauronsoftware</groupId>
<artifactId>jave</artifactId>
<version>1.0.2</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1 @@
a3a91fdfa2977ab77a7d5d08f4959315

View File

@ -0,0 +1 @@
4b4b53b2defc51412c1fa3edce409cef864a13c4

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>it.sauronsoftware</groupId>
<artifactId>jave</artifactId>
<versioning>
<release>1.0.2</release>
<versions>
<version>1.0.2</version>
</versions>
<lastUpdated>20200929205624</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1 @@
abee0beae3c372bcd364b12d05c309a3

View File

@ -0,0 +1 @@
ff35af0488868108b89b3ef6c50479db8076e8de

View File

@ -0,0 +1 @@
851e2c9b153f1686858523e69d78da20

View File

@ -0,0 +1 @@
4d89dd98cf0188bb3bfe4afd74dc427ce23d3a41

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>pamguard.org</groupId>
<artifactId>x3</artifactId>
<version>2.0.0</version>
<description>POM was created from install:install-file</description>
</project>

View File

@ -0,0 +1 @@
e09a0e45701b683f485aedf1349cab24

View File

@ -0,0 +1 @@
45129eae7b4f9c502cceffe8358fdc7e19ceaa39

View File

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<metadata>
<groupId>pamguard.org</groupId>
<artifactId>x3</artifactId>
<versioning>
<release>2.0.0</release>
<versions>
<version>2.0.0</version>
</versions>
<lastUpdated>20200929205724</lastUpdated>
</versioning>
</metadata>

View File

@ -0,0 +1 @@
47ffb77b88155d037480604e508371ff

View File

@ -0,0 +1 @@
9c238e70383b552aaaf3161eaeee8ed238d90ff8

View File

@ -0,0 +1,149 @@
package AIS;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.File;
import java.io.IOException;
import PamguardMVC.PamDataUnit;
import binaryFileStorage.BinaryDataSource;
import binaryFileStorage.BinaryHeader;
import binaryFileStorage.BinaryObjectData;
import binaryFileStorage.ModuleFooter;
import binaryFileStorage.ModuleHeader;
import binaryFileStorage.PackedBinaryObject;
public class AISBinaryDataSource extends BinaryDataSource {
private AISDataBlock aisDataBlock;
private AISControl aisControl;
public AISBinaryDataSource(AISControl aisControl, AISDataBlock sisterDataBlock) {
super(sisterDataBlock);
this.aisControl = aisControl;
this.aisDataBlock = sisterDataBlock;
}
@Override
public int getModuleVersion() {
return 1;
}
@Override
public byte[] getModuleHeaderData() {
// TODO Auto-generated method stub
return null;
}
@Override
public String getStreamName() {
return aisControl.getUnitName();
}
@Override
public int getStreamVersion() {
return 0;
}
@Override
public void newFileOpened(File outputFile) {
// TODO Auto-generated method stub
}
private ByteArrayOutputStream bos;
private DataOutputStream dos;
@Override
public BinaryObjectData getPackedData(PamDataUnit pamDataUnit) {
AISDataUnit aisDataUnit = (AISDataUnit) pamDataUnit;
// make a byte array output stream and write the data to that,
// then dump that down to the main storage stream
if (dos == null || bos == null) {
dos = new DataOutputStream(bos = new ByteArrayOutputStream());
}
else {
bos.reset();
}
try {
dos.writeInt(aisDataUnit.mmsiNumber);
dos.writeShort(aisDataUnit.fillBits);
dos.writeUTF(aisDataUnit.charData);
dos.writeUTF(aisDataUnit.aisChannel);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BinaryObjectData pbo = new BinaryObjectData(0, bos.toByteArray());
try {
dos.close();
} catch (IOException e) {
e.printStackTrace();
}
return pbo;
}
@Override
public PamDataUnit sinkData(BinaryObjectData binaryObjectData,
BinaryHeader bh, int moduleVersion) {
int mmsiNumber = 0;
int fillBits = 0;
String charData;
String aisChannel;
// if (true) return null;
ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(),
0, binaryObjectData.getDataLength());
DataInputStream dis = new DataInputStream(bis);
int writtenVersion = binaryObjectData.getVersionNumber();
try {
mmsiNumber = dis.readInt();
fillBits = dis.readShort();
charData = dis.readUTF();
if (writtenVersion >= 1) {
aisChannel = dis.readUTF();
}
dis.close();
} catch (IOException e) {
e.printStackTrace();
return null;
}
AISDataUnit aisDataUnit = new AISDataUnit(binaryObjectData.getTimeMilliseconds(),
charData, fillBits);
if (aisDataUnit.decodeMessage()) {
aisDataBlock.addAISData(aisDataUnit);
return null; // stop PAMGUARD from adding the same data again
/**
* A consequence of this is that the data unit will not have any file information
* attached to it - but OK since these data will never be resaved.
*/
}
else {
return null;
}
}
@Override
public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData,
BinaryHeader bh, ModuleHeader moduleHeader) {
// TODO Auto-generated method stub
return null;
}
@Override
public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData,
BinaryHeader bh) {
// TODO Auto-generated method stub
return null;
}
}

50
src/AIS/AISBugSearch.java Normal file
View File

@ -0,0 +1,50 @@
package AIS;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import NMEA.NMEADataUnit;
/**
* Read in some AIS data which caused AIS to crash on certain strings.
* @author Doug
*
*/
public class AISBugSearch {
public void runTestData(AISControl aisControl) {
String fn = "C:\\PamguardTest\\AISErrors\\NMEA_20150828.asc";
FileReader fr = null;
try {
fr = new FileReader(fn);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
BufferedReader reader = new BufferedReader(fr);
String line;
try {
while((line = reader.readLine())!=null){
// first comma separates date and NMEA data
int chPos = line.indexOf(",");
String nmeaData = line.substring(chPos+1);
if (nmeaData.contains("AIVDM") == false) {
continue;
}
System.out.println(nmeaData);
StringBuffer sb = new StringBuffer(nmeaData);
NMEADataUnit nmeaDataUnit = new NMEADataUnit(System.currentTimeMillis(), sb);
aisControl.aisProcess.newData(null, nmeaDataUnit);
}
} catch (IOException e) {
e.printStackTrace();
}
}
}

132
src/AIS/AISControl.java Normal file
View File

@ -0,0 +1,132 @@
package AIS;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import NMEA.NMEADataBlock;
import PamController.PamControlledUnit;
import PamController.PamControlledUnitSettings;
import PamController.PamSettingManager;
import PamController.PamSettings;
public class AISControl extends PamControlledUnit implements PamSettings {
ProcessAISData aisProcess;
AISControl aisControl;
NMEADataBlock nmeaDataBlock;
AISParameters aisParameters = new AISParameters();
public AISControl(String unitName) {
super("AIS Processing", unitName);
aisControl = this;
addPamProcess(aisProcess = new ProcessAISData(this));
PamSettingManager.getInstance().registerSettings(this);
aisProcess.findNMEADataBlock();
// REad in some AIS data which caused a crash to debug.
// AISBugSearch bs = new AISBugSearch();
// bs.runTestData(this);
}
class AISShipData implements ActionListener {
Frame parentFrame;
public AISShipData(Frame parentFrame) {
super();
this.parentFrame = parentFrame;
}
public void actionPerformed(ActionEvent e) {
AISStringsTable.show(aisControl);
}
}
class AISDisplayOptions implements ActionListener {
Frame parentFrame;
public AISDisplayOptions(Frame parentFrame) {
super();
this.parentFrame = parentFrame;
}
public void actionPerformed(ActionEvent e) {
AISParameters newParams = AISDisplayDialog.showDialog(parentFrame, aisParameters);
if (newParams != null) {
aisParameters = newParams.clone();
}
}
}
class AISSettings implements ActionListener {
Frame parentFrame;
public AISSettings(Frame parentFrame) {
super();
this.parentFrame = parentFrame;
}
public void actionPerformed(ActionEvent e) {
AISParameters newParams = AISSettingsDialog.showDialog(parentFrame, aisParameters);
if (newParams != null) {
aisParameters = newParams.clone();
aisProcess.findNMEADataBlock();
}
}
}
public JMenuItem createAISMenu(Frame parentFrame) {
JMenuItem menuItem;
JMenu subMenu = new JMenu("AIS Ship Reporting");
menuItem = new JMenuItem("AIS Options ...");
menuItem.addActionListener(new AISSettings(parentFrame));
subMenu.add(menuItem);
menuItem = new JMenuItem("Show Data ...");
menuItem.addActionListener(new AISShipData(parentFrame));
subMenu.add(menuItem);
return subMenu;
}
@Override
public JMenuItem createDetectionMenu(Frame parentFrame) {
return createAISMenu(parentFrame);
}
@Override
public JMenuItem createDisplayMenu(Frame parentFrame) {
JMenuItem menuItem;
JMenu subMenu = new JMenu("AIS Ship Reporting");
menuItem = new JMenuItem("Display Options ...");
menuItem.addActionListener(new AISDisplayOptions(parentFrame));
subMenu.add(menuItem);
menuItem = new JMenuItem("Show All Ship Data ...");
menuItem.addActionListener(new AISShipData(parentFrame));
subMenu.add(menuItem);
return subMenu;
}
@Override
public void notifyModelChanged(int changeType) {
super.notifyModelChanged(changeType);
aisProcess.noteNewSettings();
}
public Serializable getSettingsReference() {
return aisParameters;
}
public long getSettingsVersion() {
return AISParameters.serialVersionUID;
}
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
this.aisParameters = ((AISParameters) pamControlledUnitSettings.getSettings()).clone();
return true;
}
}

163
src/AIS/AISDataBlock.java Normal file
View File

@ -0,0 +1,163 @@
package AIS;
import generalDatabase.DBControlUnit;
import generalDatabase.SQLTypes;
import java.util.ListIterator;
import pamScrollSystem.ViewLoadObserver;
import nmeaEmulator.EmulatedData;
import nmeaEmulator.NMEAEmulator;
import NMEA.AcquireNmeaData;
import PamController.masterReference.MasterReferencePoint;
import PamUtils.LatLong;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamProcess;
public class AISDataBlock extends PamDataBlock<AISDataUnit> implements NMEAEmulator {
private AISControl aisControl;
public AISDataBlock(AISControl aisControl, PamProcess parentProcess) {
super(AISDataUnit.class, "AIS Data", parentProcess, 0);
this.aisControl = aisControl;
setNaturalLifetime(600);
}
/**
* aisDataUnit is always a new unit extracted from a
* group of AIS strings, but with a single lot of data.
* Depending on what type of data it was, it will contain
* either static or position data. If the transponder
* has already sent data, then update it. Otherwise,
* create a new unit.
* <p>
* Whether or not we actually want this data is a complicated question.
* <p>If there is no limitation to range, we want it.
* <p>If range is limited and the new data is a position report
* we want it if it's in range.
* <p>If it's static data and does not match an existing set of
* data we don't want it since we don't know if it's in range or not.
* <p>If it's static data and matches existing data, then we want it.
* <p>
* If a new unit is created, notifications are sent out automatically.
* otherwise, generate one to notify observers.
* @param newAISUnit new AIS data unit
* @return true if it's updating an old unit, false if it's a new one.
*/
synchronized public boolean addAISData(AISDataUnit newAISUnit) {
boolean newUnit = true;
AISDataUnit aisDataUnit = findAISDataUnit(newAISUnit.mmsiNumber);
boolean want = wantData(aisDataUnit, newAISUnit);
if (aisDataUnit != null) {
aisDataUnit.isInRange = want;
}
if (!want) {
return false;
}
if (aisDataUnit != null) {
aisDataUnit.update(newAISUnit);
newUnit = false;
// long t = PamCalendar.getTimeInMillis();
long t = newAISUnit.getTimeMilliseconds();
// if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) {
// t = newAISUnit.getTimeMilliseconds();
// }
aisDataUnit.setTimeMilliseconds(t);
aisDataUnit.updateDataUnit(t);
if (shouldNotify()) {
notifyObservers(aisDataUnit);
}
updatePamData(aisDataUnit, t); // need this to get it to save.
}
else {
addPamData(newAISUnit);
}
return newUnit;
}
private boolean wantData(AISDataUnit existingUnit, AISDataUnit newUnit) {
if (aisControl.aisParameters.limitRange == false) {
return true;
}
double range = 0;
AISPositionReport positionReport = newUnit.getPositionReport();
if (positionReport != null) {
LatLong refPos = MasterReferencePoint.getLatLong();
range = refPos.distanceToMetres(positionReport.latLong);
// System.out.println(String.format("Range to %d is %3.1fkm",
// newUnit.mmsiNumber, range/1000));
if (range / 1000. > aisControl.aisParameters.maxRange_km) {
return false;
}
else {
return true;
}
}
/*
* If the position report was null, then it must be static data.
*
*/
if (existingUnit == null) {
return false;
}
return existingUnit.isInRange;
}
/**
* Find and AIS unit based on it's MMSI Number.
* Returns the PamDataUnit rather than the AISData since
* that's needed in a wee while.
* @param mmsiNumber
* @return An existing AIS dataunit with the same mmsi number
*/
synchronized public AISDataUnit findAISDataUnit(int mmsiNumber) {
// speed up March 09 to do faster search using correct iterator.
AISDataUnit aisDataUnit;
ListIterator<AISDataUnit> listIterator = getListIterator(ITERATOR_END);
while (listIterator.hasPrevious()) {
aisDataUnit = listIterator.previous();
if (aisDataUnit.mmsiNumber == mmsiNumber) {
return aisDataUnit;
}
}
// for (int i = 0; i < pamDataUnits.size(); i++) {
// aisDataUnit = pamDataUnits.get(i);
// if (aisDataUnit.mmsiNumber == mmsiNumber) {
// return pamDataUnits.get(i);
// }
// }
return null;
}
private long emulatorTimeOffset;
@Override
public EmulatedData getNextData() {
SQLTypes sqlTypes = DBControlUnit.findConnection().getSqlTypes();
if (getLogging().readNextEmulation(sqlTypes) == false) {
return null;
}
// now all data should be in the loggers table definition.
AISLogger aisLogger = (AISLogger) getLogging();
String dataString = aisLogger.dataString.getDeblankedStringValue();
int nBits = dataString.length() * 6;
int fillBits = nBits % 8;
// int fillBits = 0;
// if (dataString.length() > 28) {
// fillBits = 2;
// }
long dataTime = aisLogger.getLastTime();
String aivdm = String.format("!AIVDM,1,1,,A,%s,%d", dataString, fillBits);
int checkSum = AcquireNmeaData.createStringChecksum(new StringBuffer(aivdm));
aivdm += String.format("*%02X", checkSum);
return new EmulatedData(dataTime, dataTime+emulatorTimeOffset, aivdm);
}
@Override
public boolean prepareDataSource(long[] timeLimits, long timeOffset) {
emulatorTimeOffset = timeOffset;
return getLogging().prepareEmulation(timeLimits);
}
}

334
src/AIS/AISDataUnit.java Normal file
View File

@ -0,0 +1,334 @@
package AIS;
import java.io.Serializable;
import java.util.ArrayList;
import NMEA.NMEABitArray;
import NMEA.NMEADataBlock;
import PamDetection.AbstractLocalisation;
import PamDetection.LocContents;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataUnit;
import warnings.PamWarning;
import warnings.WarningSystem;
public class AISDataUnit extends PamDataUnit implements Serializable, Cloneable {
AISLocalisation aisLocalisation;
private static PamWarning aisWarning = new PamWarning("AIS Decoder", "", 1);
// String latestString;
/**
* Constructor used in data collection - doesn't do much
*/
public AISDataUnit(long timeMilliseconds) {
super(timeMilliseconds);
setLocalisation(aisLocalisation = new AISLocalisation(this));
positionReports = new ArrayList<AISPositionReport>();
}
/**
* Constructor used when reading back from binary files.
* @param timeMillis time millis
* @param charData 6 bit character data string
* @param fillBits fill bits to ignore at end of string
*/
public AISDataUnit(long timeMillis, String charData, int fillBits) {
super(timeMillis);
this.charData = charData;
this.fillBits = fillBits;
setLocalisation(aisLocalisation = new AISLocalisation(this));
positionReports = new ArrayList<AISPositionReport>();
}
static final long serialVersionUID = 1;
/**
* Flag used when a limit is placed on range. If it's clearly
* out of range, then this flag is set and no more updates
* are made from static data.
* <p>
* the flag can be set false again if new position data come
* within range.
*/
protected boolean isInRange = true;
protected boolean newUnit = true;
/**
* AIVDM, etc.
*/
protected String dataType;
protected StationType stationType;
/**
* Pulled out from the start of the AIVDM string.
*/
protected int messageId;
/**
* Total number of sentences needed to transfer the message
*/
protected int totalSentences;
/**
* Message sentence number
*/
protected int sentenceNumber;
public String getStationtypeString() {
if (stationType == null) {
return null;
}
return stationType.toString();
}
/**
* The "message sequential identifier" is a number from 0 to 9 that is sequentially assigned as needed. This
identifier is incremented for each new multi-sentence message. The count resets to 0, after 9 is used. For radio
broadcast messages requiring multiple sentences, each sentence of the message contains the same sequential
identification number. The purpose of this number is to link the separate sentences containing portions of the same
radio message. This allows for the possibility that other sentences might be interleaved with the message
sentences that contain the complete message contents. This number also links an ABK-sentence
acknowledgement to the appropriate BBM-sentence.
*/
protected int sequentialIdentifier = -1;
/**
*When provided, the AIS channel is indicated as either "1" or "2." This channel indication is relative to the
operating conditions of the transponder when the packet is received. This field shall be null when the channel
identification is not provided.
*/
protected String aisChannel;
/**
* Contents of the M.1371 radio message using the six-bit field type
* <p>
* The maximum string length of encapsulation is limited such that the total number of sentence characters
does not exceed 82. This field supports a maximum of 62 valid characters for messages transferred using multiple
sentences, and 63 valid characters for messages using a single sentence.
*/
protected String charData;
/**
* Number of "fill-bits" added to complete the last six-bit character
* <p>
* Each character in the preceding six-bit coded character string represents six binary bits. This parameter
indicates the number of bits that were added to the end of the binary packet as a result of creating the last
character of the string. When the coding of the last six-bit character of the message packet does not create
additional "fill-bits," this value shall be set to zero. The value "0" indicates that no "fill-bits" were added. This field
may not be null.
*/
protected int fillBits;
public int mmsiNumber;
// // data extracted from the 6bit binary data
private ArrayList<AISPositionReport> positionReports;
private AISStaticData staticData;
transient NMEABitArray bitData;
static private final int MINIMUMBITS = 37;
static private final int POSITIONREPORTBITS = 167;
static private final int STATICDATABITS = 421;
/**
* Decode the binary data which are currently in a
* character string
* @return true if the message was decoded successfully
*/
public boolean decodeMessage() {
// time to process the string ...
// More updated useful information at http://gpsd.berlios.de/AIVDM.html
try {
if (bitData == null){
bitData = NMEADataBlock.six2eight(charData, fillBits);
}
if (bitData == null || bitData.size() < MINIMUMBITS) {
return false;
}
messageId = bitData.getUnsignedInteger(0, 5);
mmsiNumber = bitData.getUnsignedInteger(8, 37);
AISPositionReport positionReport = null;
switch (messageId) {
case 1:
case 2:
case 3:
if (bitData.size() < POSITIONREPORTBITS) {
return false;
}
positionReports.add(new AISPositionReport(messageId, getTimeMilliseconds(), bitData));
stationType = StationType.A;
return true;
case 4:
case 11:
// System.out.println(String.format("AIS Base station report id %d", messageId));
stationType = StationType.BASESTATION;
return unpackBaseStationReport(messageId, bitData);
case 5:
if (bitData.size() < STATICDATABITS) {
return false;
}
staticData = new AISStaticData(messageId, bitData);
stationType = StationType.A;
return true;
case 7:
// binary acknowledge - boring
return true;
case 8:
// binary broadcast message - can't really use this !
return true;
case 18:
stationType = StationType.B;
positionReport = new AISPositionReport(messageId, getTimeMilliseconds(), bitData);
if (positionReport.reportOk) {
positionReports.add(positionReport);
return true;
}
return false;
case 19:
stationType = StationType.B;
positionReport = new AISPositionReport(messageId, getTimeMilliseconds(), bitData);
if (positionReport.reportOk) {
staticData = new AISStaticData(messageId, bitData);
positionReports.add(positionReport);
return true;
}
return false;
case 20:
// data link management message = boring
return true;
case 21: // aid to navigation
stationType = StationType.NAVAID;
positionReport = new AISPositionReport(messageId, getTimeMilliseconds(), bitData);
if (positionReport.reportOk) {
staticData = new AISStaticData(messageId, bitData);
positionReports.add(positionReport);
return true;
}
return false;
case 24:
stationType = StationType.B;
staticData = new AISStaticData(messageId, bitData);
return true;
}
}
catch (Exception e) {
String msg = "Error unpacking AIS Data: " + e.getMessage();
System.out.println(msg);
aisWarning.setEndOfLife(PamCalendar.getTimeInMillis() + 5000);
aisWarning.setWarningMessage(msg);
WarningSystem.getWarningSystem().addWarning(aisWarning);
}
return false;
}
private boolean unpackBaseStationReport(int messageId2,
NMEABitArray bitData2) {
// staticData = new AISStaticData("", "Base Station", 0, 0, 0, null);
positionReports.add(new AISPositionReport(messageId2, getTimeMilliseconds(), bitData2));
return true;
}
public boolean isComplete() {
return (positionReports.size() > 0 && staticData != null);
}
/**
* Update an existing AIS data unit with new data.
* @param newAISUnit
*/
public void update(AISDataUnit newAISUnit) {
newUnit = false;
if (newAISUnit.positionReports.size() != 0) {
this.positionReports.add(newAISUnit.getPositionReport());
aisLocalisation.getLocContents().setLocContent(LocContents.HAS_BEARING | LocContents.HAS_DEPTH |
LocContents.HAS_LATLONG | LocContents.HAS_RANGE);
}
if (newAISUnit.staticData != null) {
if (this.staticData == null) {
this.staticData = newAISUnit.staticData;
}
else {
mergeStaticData(newAISUnit.staticData);
}
}
this.charData = newAISUnit.charData;
this.bitData = newAISUnit.bitData;
this.fillBits = newAISUnit.fillBits;
}
private void mergeStaticData(AISStaticData newStatic) {
if (newStatic.classBPart < 0) {
this.staticData = newStatic;
}
else if (newStatic.classBPart == 0) {
this.staticData.shipName = newStatic.shipName;
}
else if (newStatic.classBPart == 1) {
this.staticData.callSign = newStatic.callSign;
this.staticData.shipType = newStatic.shipType;
this.staticData.dimA = newStatic.dimA;
this.staticData.dimB = newStatic.dimB;
this.staticData.dimC = newStatic.dimC;
this.staticData.dimD = newStatic.dimD;
}
}
@Override
protected AISDataUnit clone() {
try {
AISDataUnit newUnit = (AISDataUnit) super.clone();
newUnit.aisLocalisation = new AISLocalisation(newUnit);
// if (latestString != null) {
// newUnit.latestString = new String(latestString);
// }
return newUnit;
}
catch (CloneNotSupportedException Ex) {
Ex.printStackTrace();
return null;
}
}
public AISPositionReport getPositionReport() {
if (positionReports.size() == 0) {
return null;
}
return positionReports.get(positionReports.size()-1);
}
public AISPositionReport findPositionReport(long timeMillis) {
if (positionReports.size() == 0) {
return null;
}
long bestT = Math.abs(positionReports.get(0).timeMilliseconds - timeMillis);
long newT;
int bestInd = 0;
for (int i = 1; i < positionReports.size(); i++) {
newT = Math.abs(positionReports.get(i).timeMilliseconds - timeMillis);
if (newT < bestT) {
bestT = newT;
bestInd = i;
}
}
return positionReports.get(bestInd);
}
public AISStaticData getStaticData() {
return staticData;
}
public ArrayList<AISPositionReport> getPositionReports() {
return positionReports;
}
public void addPositionReport(AISPositionReport positionReport) {
if (positionReports == null) {
positionReports = new ArrayList<AISPositionReport>();
}
positionReports.add(positionReport);
}
public void setStaticData(AISStaticData staticData) {
this.staticData = staticData;
}
}

View File

@ -0,0 +1,118 @@
package AIS;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
public class AISDisplayDialog extends PamDialog implements ActionListener {
private static AISDisplayDialog aisDisplayDialog;
private AISParameters aisParameters;
private JCheckBox showTail;
private JTextField tailLength;
private JCheckBox predictionArrow;
private JTextField predictionTime;
private AISDisplayDialog(Frame parentFrame) {
super(parentFrame, "AIS Display", true);
JPanel p = new JPanel();
p.setBorder(new TitledBorder("Options"));
p.setLayout(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
c.gridwidth = 3;
addComponent(p, showTail = new JCheckBox("Show vessel track"), c);
c.gridwidth = 1;
c.gridy++;
addComponent(p, new JLabel("Tail Length "), c);
c.gridx++;
addComponent(p, tailLength = new JTextField(6), c);
c.gridx++;
addComponent(p, new JLabel(" minutes"), c);
c.gridy++;
c.gridx = 0;
c.gridwidth = 3;
addComponent(p, predictionArrow = new JCheckBox("Show prediction arrow"), c);
c.gridwidth = 1;
c.gridy++;
addComponent(p, new JLabel("Arrow Length "), c);
c.gridx++;
addComponent(p, predictionTime = new JTextField(6), c);
c.gridx++;
addComponent(p, new JLabel(" seconds"), c);
c.gridy++;
c.gridx = 0;
showTail.addActionListener(this);
predictionArrow.addActionListener(this);
setDialogComponent(p);
}
static public AISParameters showDialog(Frame parentFrame, AISParameters aisParameters) {
if (aisDisplayDialog == null || aisDisplayDialog.getParent() != parentFrame) {
aisDisplayDialog = new AISDisplayDialog(parentFrame);
}
aisDisplayDialog.aisParameters = aisParameters.clone();
aisDisplayDialog.setParams();
aisDisplayDialog.setVisible(true);
return aisDisplayDialog.aisParameters;
}
@Override
public void cancelButtonPressed() {
aisParameters = null;
}
private void setParams() {
showTail.setSelected(aisParameters.showTail);
tailLength.setText(String.format("%d", aisParameters.tailLength));
predictionArrow.setSelected(aisParameters.showPredictionArrow);
predictionTime.setText(String.format("%d", aisParameters.predictionLength));
enableControls();
}
@Override
public boolean getParams() {
aisParameters.showTail = showTail.isSelected();
aisParameters.showPredictionArrow = predictionArrow.isSelected();
try {
aisParameters.tailLength = Integer.valueOf(tailLength.getText());
aisParameters.predictionLength = Integer.valueOf(predictionTime.getText());
}
catch (NumberFormatException e) {
return false;
}
return true;
}
@Override
public void actionPerformed(ActionEvent arg0) {
enableControls();
}
private void enableControls() {
tailLength.setEnabled(showTail.isSelected());
predictionTime.setEnabled(predictionArrow.isSelected());
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
}

314
src/AIS/AISGraphics.java Normal file
View File

@ -0,0 +1,314 @@
package AIS;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.ArrayList;
import radardisplay.RadarProjector;
import GPS.GpsData;
import GPS.GpsDataUnit;
import Map.MapRectProjector;
import Map.Vessel;
import PamController.PamController;
import PamDetection.AbstractLocalisation;
import PamDetection.LocContents;
import PamUtils.Coordinate3d;
import PamUtils.LatLong;
import PamUtils.PamCalendar;
import PamView.GeneralProjector;
import PamView.PamDetectionOverlayGraphics;
import PamView.PamKeyItem;
import PamView.PamSymbol;
import PamView.PamSymbolType;
import PamView.GeneralProjector.ParameterType;
import PamView.symbol.SymbolData;
import PamguardMVC.PamDataUnit;
import PamguardMVC.debug.Debug;
public class AISGraphics extends PamDetectionOverlayGraphics {
// PamSymbol aisSymbol = new PamSymbol(PamSymbol.SYMBOL_CIRCLE, 4, 4, true,
// Color.CYAN, Color.BLUE);
private Vessel aisVessel;
private GpsData aisGPSPosition;
private AISControl aisControl;
public static final SymbolData defaultSymbol = new SymbolData(PamSymbolType.SYMBOL_NONE, 2, 2, 1, true, Color.green, Color.blue);
private PamSymbol navAidSymbol = new PamSymbol(PamSymbolType.SYMBOL_CIRCLE, 10, 10, true, Color.yellow, Color.yellow);
// AISControl aisControl;
public AISGraphics(AISControl aisControl, AISDataBlock aisDataBlock) {
super(aisDataBlock, new PamSymbol(defaultSymbol));
this.aisControl = aisControl;
aisVessel = new Vessel(Color.BLUE);
//
// setPamSymbol(aisVessel);
aisGPSPosition = new GpsData();
}
@Override
protected boolean canDrawOnRadar(ParameterType radialParameter) {
// TODO Auto-generated method stub
return super.canDrawOnRadar(radialParameter);
}
@Override
protected Rectangle drawRangeOnRadar(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) {
// TODO Auto-generated method stub
AISDataUnit aisDataUnit = (AISDataUnit) pamDataUnit;
AISStaticData staticData = aisDataUnit.getStaticData();
AISPositionReport positionReport = aisDataUnit.getPositionReport();
if (aisDataUnit.isComplete() == false) {
return null;
}
AbstractLocalisation localisation = pamDataUnit.getLocalisation();
if (localisation == null || localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE) == false) return null;
double bearing = localisation.getBearing(0) * 180 / Math.PI;
double range = localisation.getRange(0);
Coordinate3d c3d = generalProjector.getCoord3d(bearing, range, 0);
if (c3d == null) return null;
generalProjector.addHoverData(c3d, pamDataUnit);
// PamSymbol symbol = ClickBTDisplay.getClickSymbol(clickDetector.getClickIdentifier(), click);
RadarProjector radarProjector = (RadarProjector) generalProjector;
double ppm = radarProjector.getPixelsPerMetre();
// aisVessel.drawShip(g, c3d.getXYPoint(), ppm, 0);
// getPamSymbol(pamDataUnit).draw(g, c3d.getXYPoint());
// heading must be given relative to our own.
aisVessel.setVesselDimension(staticData.dimA, staticData.dimB, staticData.dimC, staticData.dimD);
GpsDataUnit gpsDataUnit = radarProjector.getRadarDisplay().getLastGpsDataUnit();
return aisVessel.drawShip(g, c3d.getXYPoint(), ppm, positionReport.courseOverGround -
gpsDataUnit.getGpsData().getCourseOverGround());
}
@Override
protected Rectangle drawOnMap(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) {
Rectangle r = null;
AISDataUnit aisDataUnit = (AISDataUnit) pamDataUnit;
AISParameters aisParameters = aisControl.aisParameters;
AISStaticData staticData = aisDataUnit.getStaticData();
AISPositionReport positionReport = aisDataUnit.getPositionReport();
if (positionReport == null) {
return r;
}
long now = PamCalendar.getTimeInMillis();
int staticType = 0;
if (staticData != null) staticType = staticData.shipType;
PamSymbol plotSymbol = getSymbol(aisDataUnit.stationType, staticType);
// need to bodge things a little to make a gps object in the right place,
// then set the ship dimensions, then draw it.
int runMode = PamController.getInstance().getRunMode();
if (runMode == PamController.RUN_PAMVIEW) {
positionReport = aisDataUnit.findPositionReport(now);
}
if (positionReport.timeMilliseconds < now - aisParameters.tailLength * 60 * 1000) {
return null;
}
aisGPSPosition.setLatitude(positionReport.getLatitude());
aisGPSPosition.setLongitude(positionReport.getLongitude());
aisGPSPosition.setCourseOverGround(positionReport.courseOverGround);
aisGPSPosition.setTrueHeading(positionReport.trueHeading);
aisGPSPosition.setSpeed(positionReport.speedOverGround);
aisGPSPosition.setTimeInMillis(positionReport.timeMilliseconds);
// aisGPSPosition.setSpeed(aisDataUnit.positionReport.)
// aisVessel.setShipGps(aisGPSPosition.getPredictedGPSData(PamCalendar.getTime()));
if (aisVessel != null) {
aisVessel.setFillColor(Color.BLUE);
aisVessel.setLineColor(Color.BLUE);
aisVessel.setShipGps(aisGPSPosition);
if (staticData != null) {
aisVessel.setVesselDimension(staticData.dimA, staticData.dimB,
staticData.dimC,staticData.dimD);
}
else {
aisVessel.setVesselDimension(0, 0, 0, 0);
}
if (positionReport.hasTrueHeading() && aisParameters.showPredictionArrow) {
aisVessel.setPredictionArrow(aisParameters.predictionLength);
}
else {
aisVessel.setPredictionArrow(0);
}
}
Coordinate3d c3d;
// draw the track.
Point p1 = null, p2;
if (aisParameters.showTail) {
long startTime = positionReport.timeMilliseconds - aisParameters.tailLength * 60 * 1000;
g.setColor(new Color(192,255,192));
ArrayList<AISPositionReport> pr = aisDataUnit.getPositionReports();
if (pr.size() > 0) {
for (int i = 0; i < pr.size(); i++) {
positionReport = pr.get(i);
if (positionReport.timeMilliseconds < startTime) {
continue;
}
if (positionReport.timeMilliseconds > now) {
break;
}
// c3d = generalProjector.getCoord3d(positionReport.getLatitude(), positionReport.getLongitude(), 0);
// p1 = c3d.getXYPoint();
// positionReport = pr.get(i);
c3d = generalProjector.getCoord3d(positionReport.getLatitude(), positionReport.getLongitude(), 0);
p2 = c3d.getXYPoint();
if (p1 != null) {
g.drawLine(p1.x, p1.y, p2.x, p2.y);
}
p1 = p2;
}
}
}
GpsData shipGps = aisVessel.getShipGps(false);
if (Math.abs(shipGps.getTimeInMillis()-PamCalendar.getTimeInMillis()) > 300*1000) {
return r;
}
if (plotSymbol == aisVessel) {
c3d = aisVessel.drawShip((Graphics2D) g, (MapRectProjector) generalProjector);
}
else {
if (plotSymbol.getHeight() > 10) {
plotSymbol.setHeight(10);
}
c3d = generalProjector.getCoord3d(positionReport.latLong.getLatitude(),
positionReport.latLong.getLongitude(), 0);
plotSymbol.draw(g, c3d.getXYPoint());
}
p2 = c3d.getXYPoint();
// finally draw the extraploation
if (p1 != null && PamController.getInstance().getRunMode() != PamController.RUN_PAMVIEW) {
g.drawLine(p1.x, p1.y, p2.x, p2.y);
}
generalProjector.addHoverData(c3d, aisDataUnit);
return r;
}
private PamSymbol getSymbol(StationType stationType, int staticType) {
if (stationType == null) {
return getNavaidSymbol(0);
}
switch(stationType) {
case A:
case B:
return aisVessel;
case NAVAID:
return getNavaidSymbol(staticType);
case BASESTATION:
case UNKNOWN:
return aisVessel;
}
return getDefaultSymbol();
}
private PamSymbol getNavaidSymbol(int staticType) {
PamSymbol mainSymbol = getDefaultSymbol();
navAidSymbol.setHeight(mainSymbol.getHeight());
navAidSymbol.setWidth(mainSymbol.getWidth());
Color col = Color.yellow;
switch(staticType) {
case 13:
case 15:
case 24:
case 26:
col = Color.RED;
break;
case 14:
case 16:
case 25:
case 27:
col = Color.GREEN;
break;
}
navAidSymbol.setFillColor(col);
navAidSymbol.setLineColor(col);
return navAidSymbol;
}
@Override
public void setDefaultSymbol(PamSymbol pamSymbol) {
// keep the same symbol, but reset it's colour and size
// otherwise we'll end up drawing blobs.
if (aisVessel == null) {
aisVessel = new Vessel(Color.BLUE);
}
aisVessel.setFillColor(pamSymbol.getFillColor());
aisVessel.setLineColor(pamSymbol.getLineColor());
aisVessel.setHeight(pamSymbol.getHeight());
aisVessel.setWidth(pamSymbol.getWidth());
aisVessel.setLineThickness(pamSymbol.getLineThickness());
super.setDefaultSymbol(pamSymbol);
}
@Override
public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) {
// TODO Auto-generated method stub
return super.createKeyItem(generalProjector, keyType);
}
@Override
public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int side) {
AISDataUnit aisDataUnit = (AISDataUnit) dataUnit;
AISStaticData staticData = aisDataUnit.getStaticData();
AISPositionReport positionReport = aisDataUnit.getPositionReport();
if (positionReport == null) {
return null;
}
String str = new String("<html>");
if (staticData == null) {
str += aisDataUnit.getStationtypeString() + " (unknown)";
}
else {
str += aisDataUnit.getStationtypeString() + ": " + staticData.shipName;
str += "<br>Destination: " + staticData.destination;
str += "<br>Call Sign : " + staticData.callSign;
if (staticData.imoNumber > 0) {
str += "<br>imo : " + staticData.imoNumber;
}
else {
str += "<br>imo unknown";
}
}
str += "<br>Last position : " +PamCalendar.formatTime(positionReport.timeMilliseconds) + " UTC";
str += "<br>mmsi : " + aisDataUnit.mmsiNumber;
//str += "<br>ETA : " + PamCalendar.formatDateTime(aisDataUnit.staticData.etaMilliseconds);
str += String.format("<br>%s %s", LatLong.formatLatitude(positionReport.getLatitude()),
LatLong.formatLongitude(positionReport.getLongitude()));
str += String.format("<br>Speed : %3.1f", positionReport.speedOverGround);
str += String.format("<br>Course : %d\u00B0", (int) positionReport.courseOverGround);
str += String.format("<br>Head : %d\u00B0", (int) positionReport.trueHeading);
if (staticData != null) {
str += String.format("<br>LOA %dm, Beam %dm", (int)staticData.getLength(), (int) staticData.getWidth());
str += String.format("<br>%s", staticData.getStationTypeString(aisDataUnit.stationType, staticData.shipType));
}
str += "</html>";
return str;
}
}

View File

@ -0,0 +1,73 @@
package AIS;
import GPS.GpsData;
import GPS.GpsDataUnit;
import PamController.PamController;
import PamDetection.AbstractLocalisation;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataBlock;
public class AISLocalisation extends AbstractLocalisation {
AISDataUnit aisDataUnit;
public AISLocalisation(AISDataUnit aisDataUnit) {
super(aisDataUnit, 0, 0);
this.aisDataUnit = aisDataUnit;
aisDataUnit.setLocalisation(this);
}
@Override
public boolean hasLocContent(int requiredContent) {
if (aisDataUnit.getPositionReport() != null) {
return true;
}
return false;
}
@Override
public double getBearing(int side) {
GpsData gpsData = findGpsData();
if (gpsData == null) return super.getBearing(side);
AISPositionReport aisPositionReport = aisDataUnit.getPositionReport();
if (aisPositionReport == null) return super.getBearing(side);
double ang = gpsData.bearingTo(aisPositionReport.latLong) - gpsData.getCourseOverGround();
return ang * Math.PI/180.;
}
@Override
public double getDepth() {
return 0;
}
@Override
public double getRange(int iSide) {
GpsData gpsData = findGpsData();
if (gpsData == null) return super.getRange(iSide);
AISPositionReport aisPositionReport = aisDataUnit.getPositionReport();
if (aisPositionReport == null) return super.getRange(iSide);
return gpsData.distanceToMetres(aisPositionReport.latLong);
}
// need a slightly fast way of getting appropriate GPS data.
GpsData findGpsData() {
return findGpsData(PamCalendar.getTimeInMillis());
}
GpsData lastFoundGpsData = null;
long lastGpsFindTime = 0;
GpsData findGpsData(long timeMillisecods) {
if (timeMillisecods == lastGpsFindTime && lastFoundGpsData != null) {
return lastFoundGpsData;
}
PamDataBlock<GpsDataUnit> gpsDataBlock = PamController.getInstance().getDataBlock(GpsDataUnit.class, 0);
if (gpsDataBlock == null) return null;
GpsDataUnit gpsDataUnit = gpsDataBlock.getClosestUnitMillis(timeMillisecods);
if (gpsDataUnit == null) return null;
lastGpsFindTime = timeMillisecods;
return (lastFoundGpsData = gpsDataUnit.getGpsData());
}
}

267
src/AIS/AISLogger.java Normal file
View File

@ -0,0 +1,267 @@
package AIS;
import generalDatabase.DBProcess;
import generalDatabase.PamConnection;
import generalDatabase.PamTableDefinition;
import generalDatabase.PamTableItem;
import generalDatabase.SQLLogging;
import generalDatabase.SQLTypes;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import javax.naming.ldap.HasControls;
import PamController.PamController;
import PamView.dialog.warn.WarnOnce;
import PamguardMVC.PamDataUnit;
public class AISLogger extends SQLLogging {
private ProcessAISData aisProcess;
private PamTableDefinition tableDef;
private AISDataBlock aisDataBlock;
protected PamTableItem mmsiNumber, imoNumber,callSign,shipName,shipType, //messageID,
eta, draft, destination, //dataTerminalReady, //dataIndicator,
navigationStatus, rateOfTurn, speedOverGround, //positionAccuracy,
longitude, latitude, courseOverGround, trueHeading;
protected PamTableItem dataString;
static private final int AISRAWLENGTH = 128;
//utcSeconds, //utcMinutes, //utcHours,
//repeatIndicator,
//commsState;
public AISLogger(AISDataBlock aisDataBlock, ProcessAISData aisProcess) {
super(aisDataBlock);
this.aisProcess = aisProcess;
this.aisDataBlock = aisDataBlock;
setCanView(true);
PamTableItem tableItem;
tableDef = new PamTableDefinition("AISData", UPDATE_POLICY_WRITENEW);
tableDef.addTableItem(imoNumber = new PamTableItem("imoNumber", Types.INTEGER));
tableDef.addTableItem(mmsiNumber = new PamTableItem("mmsiNumber", Types.INTEGER));
tableDef.addTableItem(callSign = new PamTableItem("callSign", Types.CHAR, 7));
tableDef.addTableItem(shipName = new PamTableItem("shipName", Types.CHAR, 20));
tableDef.addTableItem(shipType = new PamTableItem("shipType", Types.CHAR, 20));
tableDef.addTableItem(eta = new PamTableItem("eta", Types.TIMESTAMP));
tableDef.addTableItem(draft = new PamTableItem("draft", Types.DOUBLE));
tableDef.addTableItem(destination = new PamTableItem("destination", Types.CHAR, 20));
tableDef.addTableItem(navigationStatus = new PamTableItem("navigationStatus", Types.INTEGER));
tableDef.addTableItem(rateOfTurn = new PamTableItem("rateOfTurn", Types.DOUBLE));
tableDef.addTableItem(speedOverGround = new PamTableItem("speedOverGround", Types.DOUBLE));
tableDef.addTableItem(latitude = new PamTableItem("latitude", Types.DOUBLE));
tableDef.addTableItem(longitude = new PamTableItem("longitude", Types.DOUBLE));
tableDef.addTableItem(courseOverGround = new PamTableItem("courseOverGround", Types.DOUBLE));
tableDef.addTableItem(trueHeading = new PamTableItem("trueHeading", Types.DOUBLE));
tableDef.addTableItem(dataString = new PamTableItem("Data String", Types.CHAR, AISRAWLENGTH));
tableDef.setUseCheatIndexing(true);
setTableDefinition(tableDef);
}
// @Override
// public PamTableDefinition getTableDefinition() {
// return tableDef;
// }
@Override
public void setTableData(SQLTypes sqlTypes, PamDataUnit pamDataUnit) {
AISDataUnit aisData = (AISDataUnit) pamDataUnit;
// dateTime.setValue(PamCalendar.getTimeStamp(aisData.getTimeMilliseconds()));
mmsiNumber.setValue(aisData.mmsiNumber);
AISStaticData staticData = aisData.getStaticData();
AISPositionReport positionReport = aisData.getPositionReport();
if (staticData != null) {
imoNumber.setValue(staticData.imoNumber);
callSign.setValue(staticData.callSign);
shipName.setValue(staticData.shipName);
shipType.setValue(staticData.getStationTypeString(aisData.stationType, staticData.shipType));
eta.setValue(sqlTypes.getTimeStamp(staticData.etaMilliseconds));
draft.setValue(staticData.staticDraught);
destination.setValue(staticData.destination);
}
else {
imoNumber.setValue(null);
callSign.setValue(null);
shipName.setValue(null);
shipType.setValue(aisData.getStationtypeString());
eta.setValue(null);
draft.setValue(null);
destination.setValue(null);
}
if (positionReport != null) {
navigationStatus.setValue(positionReport.navigationStatus);
rateOfTurn.setValue(positionReport.rateOfTurn);
speedOverGround.setValue(positionReport.speedOverGround);
latitude.setValue(positionReport.getLatitude());
longitude.setValue(positionReport.getLongitude());
courseOverGround.setValue(positionReport.courseOverGround);
trueHeading.setValue(positionReport.trueHeading);
}
else {
navigationStatus.setValue(null);
rateOfTurn.setValue(null);
speedOverGround.setValue(null);
latitude.setValue(null);
longitude.setValue(null);
courseOverGround.setValue(null);
trueHeading.setValue(null);
}
dataString.setValue(aisData.charData);
}
private int lastMMSINumber = 0;
private long lastTime = 0;
@Override
protected PamDataUnit createDataUnit(SQLTypes sqlTypes, long timeMilliseconds, int databaseIndex) {
AISStaticData aisStaticData = null;
AISPositionReport aisPositionReport = null;
// Timestamp ts = (Timestamp) tableDef.getTimeStampItem().getValue();
// long t = PamCalendar.millisFromTimeStamp(ts);
int ammsiNumber;
// static data
String acallSign = null;
String ashipName;
String ashipType;
long aetaMillis;
double adraught;
String adestination;
// position report
int anavStatus;
double arateOfTurn;
double aspeedOverGround;
double alatitude;
double alongitude;
double acourseOverGround;
double atrueHeading;
String aisString;
ammsiNumber = (Integer) mmsiNumber.getValue();
/*
* Problem in some 2008 data where all records are repeated
* So check for identical consecutive records.
*/
if (lastMMSINumber == ammsiNumber && lastTime == timeMilliseconds) {
return null;
}
else {
lastMMSINumber = ammsiNumber;
lastTime = timeMilliseconds;
}
if (callSign.getValue() != null) {
// assume all static data are OK
acallSign = (String) callSign.getValue();
ashipName = (String) shipName.getValue();
ashipType = (String) shipType.getValue();
aetaMillis = sqlTypes.millisFromTimeStamp(eta.getValue());
// aetaMillis = (Long) eta.getValue();
adraught = (Double) draft.getValue();
adestination = (String) destination.getValue();
aisStaticData = new AISStaticData(acallSign, ashipName, 0,
aetaMillis, adraught, adestination);
Integer imoNum = imoNumber.getIntegerObject();
if (imoNum != null) {
aisStaticData.imoNumber = imoNum;
}
}
if (navigationStatus.getValue() != null) {
anavStatus = (Integer) navigationStatus.getValue();
arateOfTurn = (Double) rateOfTurn.getValue();
aspeedOverGround = (Double) speedOverGround.getValue();
alatitude = (Double) latitude.getValue();
alongitude = (Double) longitude.getValue();
acourseOverGround = (Double) courseOverGround.getValue();
atrueHeading = (Double) trueHeading.getValue();
aisPositionReport = new AISPositionReport(lastTime, anavStatus, arateOfTurn,
aspeedOverGround, alatitude, alongitude, acourseOverGround, atrueHeading);
aisPositionReport.timeMilliseconds = timeMilliseconds;
}
AISDataUnit aisDataUnit = new AISDataUnit(timeMilliseconds);
aisDataUnit.setDatabaseIndex(databaseIndex);
aisDataUnit.mmsiNumber = ammsiNumber;
if (aisStaticData != null) {
aisDataUnit.setStaticData(aisStaticData);
}
if (aisPositionReport != null) {
aisDataUnit.addPositionReport(aisPositionReport);
}
aisString = (String) dataString.getValue();
if (aisString != null) {
int nBytes = (int) Math.floor(aisString.length() * 6 / 8);
int nBits = nBytes * 8;
int fillBits = aisString.length() * 6 - nBits;
aisDataUnit.charData = aisString.trim();
}
aisDataBlock.addAISData(aisDataUnit);
return aisDataUnit;
}
@Override
public boolean doExtraChecks(DBProcess dbProcess, PamConnection connection) {
/*
* Swap around some column names if the table has an ""imoNumber"" number column, but not an mmmsi column.
* by the time this gets called the mmsi column will have been created, so need to see if it's empty and copy
* the data over from the imo columns.
*/
// dbProcess.columnExists(getTableDefinition(), tableItem)
Integer nIMO = countColData(connection, "imoNumber");
Integer nMMSI = countColData(connection, "mmsiNumber");
if (nIMO > 0 && nMMSI == 0) {
String msg = "Updating AIS tabe column names";
WarnOnce.showWarning(PamController.getMainFrame(), "AIS Database", msg, WarnOnce.OK_OPTION);
try {
Statement stmt = connection.getConnection().createStatement();
stmt.executeUpdate(String.format("UPDATE %s SET mmsiNumber = imoNumber WHERE imoNumber IS NOT NULL", getTableDefinition().getTableName()));
stmt.close();
stmt = connection.getConnection().createStatement();
stmt.executeUpdate(String.format("UPDATE %s SET imoNumber = NULL", getTableDefinition().getTableName()));
stmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
}
return true;
}
private Integer countColData(PamConnection connection, String colName) {
if (connection == null || connection.getConnection() == null) {
return null;
}
Integer n = null;
String qStr = String.format("SELECT COUNT(*) FROM %s WHERE %s IS NOT NULL",
getTableDefinition().getTableName(), connection.getSqlTypes().formatColumnName(colName));
// System.out.println(qStr);
try {
Statement stmt = connection.getConnection().createStatement();
ResultSet res = stmt.executeQuery(qStr);
// res.next();
n = res.getInt(1);
stmt.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return n;
}
}

View File

@ -0,0 +1,69 @@
package AIS;
import java.io.Serializable;
import java.lang.reflect.Field;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData;
public class AISParameters implements Serializable, Cloneable, ManagedParameters {
public static final long serialVersionUID = 0;
protected String nmeaSource;
/**
* Only record AIS data within
* maxRange_kn of the vessel
*/
public boolean limitRange = false;
/**
* Maximum range for AIS data. Data further off than
* this will be ignored.
*/
public double maxRange_km = 10.;
public boolean showTail;
/**
* Tail length in minutes.
*/
public int tailLength = 30;
public boolean showPredictionArrow;
/**
* Prediction length in seconds
*/
public int predictionLength = 600;
@Override
protected AISParameters clone() {
try {
return (AISParameters) super.clone();
}
catch (CloneNotSupportedException ex) {
ex.printStackTrace();
return null;
}
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
try {
Field field = this.getClass().getDeclaredField("nmeaSource");
ps.put(new PrivatePamParameterData(this, field) {
@Override
public Object getData() throws IllegalArgumentException, IllegalAccessException {
return nmeaSource;
}
});
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
return ps;
}
}

View File

@ -0,0 +1,167 @@
package AIS;
import java.io.Serializable;
import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamUtils.LatLong;
/**
* AIS Position report data
* @author Doug Gillespie
*
*/
public class AISPositionReport extends AISReport implements Serializable, ManagedParameters {
public static final long serialVersionUID = 0;
public int messageId;
public int dataTerminalReady;
public int dataIndicator;
public int navigationStatus;
public double rateOfTurn;
public double speedOverGround;
public int positionAccuracy;
public LatLong latLong;
public double courseOverGround;
public double trueHeading;
public int utcSeconds;
public int utcMinutes;
public int utcHours;
public int repeatIndicator;
public int commsState;
public long timeMilliseconds;
public boolean reportOk = false;
AISPositionReport (int messageId, long timeMillis, NMEABitArray bitData) {
this.messageId = messageId;
this.timeMilliseconds = timeMillis;
switch(messageId) {
case 1:
case 2:
case 3:
reportOk = unpackStandardPositionReport(bitData);
break;
case 4:
reportOk = unpackBaseStationReport(bitData);
break;
case 18:
reportOk = unpackClassBPositionReport(bitData);
break;
case 19:
reportOk = unpackExtendedClassBPositionReport(bitData);
break;
case 21:
reportOk = unpackAidToNavigationReport(bitData);
break;
}
}
private boolean unpackAidToNavigationReport(NMEABitArray bitData) {
double longitude = bitData.getSignedInteger(164, 191) / 600000.;
double latitude = bitData.getSignedInteger(192, 218) / 600000.;
latLong = new LatLong(latitude, longitude);
return true;
}
private boolean unpackBaseStationReport(NMEABitArray bitData) {
double longitude = bitData.getSignedInteger(79, 106) / 600000.;
double latitude = bitData.getSignedInteger(107, 133) / 600000.;
latLong = new LatLong(latitude, longitude);
return true;
}
private boolean unpackClassBPositionReport(NMEABitArray bitData) {
speedOverGround = bitData.getUnsignedInteger(46, 55)/10.;
positionAccuracy = bitData.getUnsignedInteger(56, 56);
double longitude = bitData.getSignedInteger(57, 84) / 600000.;
double latitude = bitData.getSignedInteger(85, 111) / 600000.;
latLong = new LatLong(latitude, longitude);
courseOverGround = bitData.getUnsignedInteger(112,123)/10.;
trueHeading = bitData.getUnsignedInteger(124,132);
utcSeconds = bitData.getUnsignedInteger(133, 138);
return true;
}
private boolean unpackExtendedClassBPositionReport(NMEABitArray bitData) {
if (!unpackClassBPositionReport(bitData)) {
return false;
}
return true;
}
private boolean unpackStandardPositionReport(NMEABitArray bitData) {
dataTerminalReady = bitData.getSignedInteger(6, 6);
navigationStatus = bitData.getUnsignedInteger(38, 41);
/*
*
±127. (-128 (80 hex) indicates not available, which shall be the default). Coded by
ROTAIS=4.733 SQRT(ROTIND) degrees/min
ROTIND is the Rate of Turn ( 720 degrees per minute), as indicated by an external
sensor.
+ 127 = turning right at 720 degrees per minute or higher;
- 127 = turning left at 720 degrees per minute or higher
*/
rateOfTurn = bitData.getSignedInteger(42, 49);
speedOverGround = bitData.getUnsignedInteger(50, 59)/10.;
positionAccuracy = bitData.getUnsignedInteger(60, 60);
double latitude = bitData.getSignedInteger(89,115) / 600000.;
double longitude = bitData.getSignedInteger(61, 88) / 600000.;
latLong = new LatLong(latitude, longitude);
courseOverGround = bitData.getUnsignedInteger(116, 127)/10.;
trueHeading = bitData.getUnsignedInteger(128, 136);
utcSeconds = bitData.getUnsignedInteger(137, 142);
repeatIndicator = bitData.getUnsignedInteger(143, 144);
commsState = bitData.getUnsignedInteger(150, 167);
// timeMilliseconds = PamCalendar.getTimeInMillis();
// System.out.println(this);
return true;
}
/**
* Constructor to use when reading back from database.
* @param navStatus navStatus
* @param rateOfTurn rateOfTurn
* @param speedOverGround speedOverGround
* @param latitude latitude
* @param longitude longitude
* @param courseOverGround courseOverGround
* @param trueHeading trueHeading
*/
public AISPositionReport(long timeMillis, int navStatus, double rateOfTurn, double speedOverGround,
double latitude, double longitude, double courseOverGround, double trueHeading) {
this.timeMilliseconds = timeMillis;
this.navigationStatus = navStatus;
this.rateOfTurn = rateOfTurn;
this.speedOverGround = speedOverGround;
this.latLong = new LatLong(latitude, longitude);
this.courseOverGround = courseOverGround;
this.trueHeading = trueHeading;
}
@Override
public String toString() {
return String.format("Position %.6f,%.6f; COG %f; SOG %f; ROT %.3f",
latLong.getLatitude(), latLong.getLongitude(), courseOverGround, speedOverGround, rateOfTurn);
}
public double getLatitude() {
return latLong.getLatitude();
}
public double getLongitude() {
return latLong.getLongitude();
}
public boolean hasTrueHeading() {
return trueHeading < 500;
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
return ps;
}
}

7
src/AIS/AISReport.java Normal file
View File

@ -0,0 +1,7 @@
package AIS;
import java.io.Serializable;
public class AISReport implements Serializable{
public static final long serialVersionUID = 0;
}

View File

@ -0,0 +1,118 @@
package AIS;
import java.awt.BorderLayout;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JCheckBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import NMEA.NMEADataUnit;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
import PamView.dialog.SourcePanel;
public class AISSettingsDialog extends PamDialog {
private AISParameters aisParameters;
private static AISSettingsDialog singleInstance;
private SourcePanel sourcePanel;
private JCheckBox limitRange;
private JTextField maxRange;
private AISSettingsDialog(Frame parentFrame) {
super(parentFrame, "AIS Options", false);
sourcePanel = new SourcePanel(this, "Select NMEA Source", NMEADataUnit.class, false, false);
JPanel rangePanel = new JPanel(new GridBagLayout());
GridBagConstraints c = new PamGridBagContraints();
rangePanel.setBorder(new TitledBorder("Distant vessels"));
c.gridwidth = 3;
addComponent(rangePanel, limitRange = new JCheckBox("Ignore distant vessels"), c);
limitRange.addActionListener(new LimitRange());
c.gridx = 0;
c.gridwidth = 1;
c.gridy++;
addComponent(rangePanel, new JLabel("Max range "), c);
c.gridx++;
addComponent(rangePanel, maxRange = new JTextField(3), c);
c.gridx++;
addComponent(rangePanel, new JLabel(" km"), c);
JPanel p = new JPanel(new BorderLayout());
p.add(BorderLayout.NORTH, sourcePanel.getPanel());
p.add(BorderLayout.CENTER, rangePanel);
setHelpPoint("mapping.AIS.docs.AISConfiguration");
setDialogComponent(p);
}
public static AISParameters showDialog(Frame parentFrame, AISParameters aisParameters) {
if (singleInstance == null || parentFrame != singleInstance.getOwner()) {
singleInstance = new AISSettingsDialog(parentFrame);
}
singleInstance.aisParameters = aisParameters;
singleInstance.setParams();
singleInstance.setVisible(true);
return aisParameters;
}
@Override
public void cancelButtonPressed() {
// TODO Auto-generated method stub
aisParameters = null;
}
private void setParams() {
sourcePanel.setSource(aisParameters.nmeaSource);
limitRange.setSelected(aisParameters.limitRange);
maxRange.setText(formatDouble(aisParameters.maxRange_km));
enableControls();
}
@Override
public boolean getParams() {
aisParameters.nmeaSource = sourcePanel.getSource().getDataName();
aisParameters.limitRange = limitRange.isSelected();
if (aisParameters.limitRange) {
try {
aisParameters.maxRange_km = Double.valueOf(maxRange.getText());
}
catch (NumberFormatException e) {
return showWarning("Invalid maximum range");
}
}
return (aisParameters.nmeaSource != null);
}
class LimitRange implements ActionListener {
@Override
public void actionPerformed(ActionEvent arg0) {
enableControls();
}
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
public void enableControls() {
maxRange.setEnabled(limitRange.isSelected());
}
}

400
src/AIS/AISStaticData.java Normal file
View File

@ -0,0 +1,400 @@
package AIS;
import java.io.Serializable;
import java.util.Calendar;
import NMEA.NMEABitArray;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamUtils.PamCalendar;
public class AISStaticData extends AISReport implements Serializable, ManagedParameters{
public static final long serialVersionUID = 0;
public int imoNumber;
public String callSign;
public String shipName;
public int shipType;
public int etaMonth;
public int etaDay;
public int etaHour;
public int etaMinute;
public double staticDraught;
public String destination;
public String dataClass = "A";
/*
* Although these are int in the AIS data, use double so they are compatible with
* hydrophone location information in rest of Pamguard
*/
public double dimA, dimB, dimC, dimD;
public long etaMilliseconds;
// some extras for aids to navigation data
boolean offPosition;
boolean virtualAidFlag;
public int classBPart = -1;
AISStaticData(int messageId, NMEABitArray bitData) {
switch(messageId) {
case 5: // standard static data
unpackStandardStaticData(bitData);
break;
case 19:
unpackClassBStaticData(bitData);
break;
case 21:
unpackAidtoNavigationData(bitData);
break;
case 24:
unpackClassBStaticData24(bitData);
break;
}
}
boolean unpackStandardStaticData(NMEABitArray bitData) {
//07/08/2017 - this sometimes causes a comple PG freeze. Have used try catch to solve for now.
try {
int dataSetIndicator = bitData.getUnsignedInteger(38, 39);
switch (dataSetIndicator) {
case 0:
return unpackStandardStaticShipData(bitData);
case 1:
break;
case 2:
break;
case 3:
break;
}
return false;
}
catch (Exception e) {
e.printStackTrace();
return false;
}
}
/**
* Constructor for use when reading back from database.
* @param callSign callSign
* @param shipName shipName
* @param shipType shipType
* @param etaMillis eta Milliseconds
* @param draught draught
* @param destination destination
*/
public AISStaticData(String callSign, String shipName, int shipType,
long etaMillis, double draught, String destination) {
dataClass = "";
this.callSign = callSign;
this.shipName = shipName;
this.shipType = shipType;
this.etaMilliseconds = etaMillis;
this.staticDraught = draught;
this.destination = destination;
}
private void unpackClassBStaticData(NMEABitArray bitData) {
dataClass = "B";
shipName = bitData.getString(143, 262);
shipType = bitData.getUnsignedInteger(263, 270);
dimA = bitData.getUnsignedInteger(271, 279);
dimB = bitData.getUnsignedInteger(280, 288);
dimC = bitData.getUnsignedInteger(289, 294);
dimD = bitData.getUnsignedInteger(295, 300);
}
private void unpackClassBStaticData24(NMEABitArray bitData) {
dataClass = "B";
classBPart = bitData.getUnsignedInteger(38, 39);
switch(classBPart) {
case 0:
shipName = bitData.getString(40, 159);
break;
case 1:
shipType = bitData.getUnsignedInteger(40, 47);
callSign = bitData.getString(90, 131);
dimA = bitData.getUnsignedInteger(132, 140);
dimB = bitData.getUnsignedInteger(141, 149);
dimC = bitData.getUnsignedInteger(150, 155);
dimD = bitData.getUnsignedInteger(156, 161);
break;
}
}
private void unpackAidtoNavigationData(NMEABitArray bitData) {
shipName = bitData.getString(43, 162);
shipType = bitData.getUnsignedInteger(38, 42);
dimA = bitData.getUnsignedInteger(219, 227);
dimB = bitData.getUnsignedInteger(228, 236);
dimC = bitData.getUnsignedInteger(237, 242);
dimD = bitData.getUnsignedInteger(243, 248);
offPosition = bitData.getUnsignedInteger(259, 259) == 1;
virtualAidFlag = bitData.getUnsignedInteger(269, 269) == 1;
int extensionLength = bitData.size() - 272;
if (extensionLength > 0) {
shipName += bitData.getString(272, bitData.size());
}
}
public boolean unpackStandardStaticShipData(NMEABitArray bitData) {
// mmsiNumber = bitData.getUnsignedInteger(8, 37);
dataClass = "A";
imoNumber = bitData.getUnsignedInteger(40, 69);
callSign = bitData.getString(70, 111);
shipName = bitData.getString(112, 231);
shipType = bitData.getUnsignedInteger(232, 239);
dimA = bitData.getUnsignedInteger(240, 248);
dimB = bitData.getUnsignedInteger(249, 257);
dimC = bitData.getUnsignedInteger(258, 263);
dimD = bitData.getUnsignedInteger(264, 269);
etaMonth = bitData.getUnsignedInteger(274, 277);
etaDay = bitData.getUnsignedInteger(278, 282) - 1; // convert immediately to Java standard (base 0)
etaHour = bitData.getUnsignedInteger(283, 287);
etaMinute = bitData.getUnsignedInteger(288, 293);
staticDraught = bitData.getUnsignedInteger(294, 301)/10.;
destination = bitData.getString(302, 421);
destination = destination.replace("@", " ");
shipName = shipName.replace("@", " ");
callSign = callSign.replace("@", " ");
/*
* Now set the eta in milliseconds - will be needed
*/
Calendar c = Calendar.getInstance();
long now = PamCalendar.getTimeInMillis();
int month = c.get(Calendar.MONTH); // Jan is 0, Dec is 11
int year = c.get(Calendar.YEAR);
// int day = c.get(Calendar.DATE);
if (etaMonth < month) year++; // it must be arriving next year
c.set(year, etaMonth, etaDay, etaHour, etaMinute, 0);
etaMilliseconds = c.getTimeInMillis();
// System.out.println(this);
return true;
}
@Override
public String toString() {
return new String("; Ship : " + imoNumber + " ; call sign: " + callSign +
"; type: " + getVesselTypeAndCargo(shipType) + " ; name: " + shipName +
" ; dest - " + destination + "; draught - " + staticDraught +
"; ETA: " + String.format("%2d-%2d %2d:%2d",etaMonth, etaDay, etaHour, etaMinute) +
String.format("; Dimension ABCD %d:%d:%d:%d", dimA, dimB, dimC, dimD));
}
public String shipTypeAndCargo() {
return getVesselTypeAndCargo(shipType);
}
public String getStationTypeString(StationType stationType, int type) {
if (stationType == null) {
return null;
}
switch(stationType) {
case BASESTATION:
return stationType.BASESTATION.toString();
case A:
case B:
return getVesselTypeAndCargo(type);
case NAVAID:
return getNavAidType(type);
case UNKNOWN:
return null;
}
return null;
}
private String getNavAidType(int type) {
switch (type) {
case 0:
return "Default, Type of Aid to Navigation not specified";
case 2:
return "RACON (radar transponder marking a navigation hazard)";
case 3:
return "Fixed structure off shore (oil, wind, etc)";
case 4:
return "Spare, Reserved for future use.";
case 5:
return "Light, without sectors";
case 6:
return "Light, with sectors";
case 7:
return "Leading Light Front";
case 8:
return "Leading Light Rear";
case 9:
return "Beacon, Cardinal N";
case 10:
return "Beacon, Cardinal E";
case 11:
return "Beacon, Cardinal S";
case 12:
return "Beacon, Cardinal W";
case 13:
return "Beacon, Port hand";
case 14:
return "Beacon, Starboard hand";
case 15:
return "Beacon, Preferred Channel port hand";
case 16:
return "Beacon, Preferred Channel starboard hand";
case 17:
return "Beacon, Isolated danger";
case 18:
return "Beacon, Safe water";
case 19:
return "Beacon, Special mark";
case 20:
return "Cardinal Mark N";
case 21:
return "Cardinal Mark E";
case 22:
return "Cardinal Mark S";
case 23:
return "Cardinal Mark W";
case 24:
return "Port hand Mark";
case 25:
return "Starboard hand Mark";
case 26:
return "Preferred Channel Port hand";
case 27:
return "Preferred Channel Starboard hand";
case 28:
return "Isolated danger";
case 29:
return "Safe Water";
case 30:
return "Special Mark";
case 31:
return "Light Vessel / LANBY / Rigs";
}
return "Navaid type " + type;
}
public String getVesselTypeAndCargo(int type) {
// first and second digits are interpreted differently
// so best to combine these in single string in one go.
int dig1 = (int) Math.floor(type / 10);
int dig2 = type % 10;
String string = null;
switch (dig1) {
case 1:
return "Unknown vessel type";
case 2:
string = new String("WIG");
break;
case 3:
string = new String("Vessel");
switch (dig2) {
case 0:
string = new String("Fishing Vessel");
break;
case 1:
string += " - towing";
break;
case 2:
string += " - towing (L>200m or W>25m)";
break;
case 3:
string += " - dredging / uw ops";
break;
case 4:
string += " - diving";
break;
case 5:
string = new String("Military Vessel");
break;
case 6:
string = new String("Sailing Vessel");
break;
case 7:
string = new String("Pleaseure craft");
break;
}
return string;
case 4:
string = new String("HSC");
break;
case 5:
switch (dig2) {
case 0:
return new String("Pilot Vessel");
case 1:
return new String("Search and Rescue Vessel");
case 2:
return new String("Tug");
case 3:
return new String("Port Tender");
case 4:
return new String("Pollution Control Vessel");
case 5:
return new String("Law Enforcement Vessel");
case 6:
return new String("Unknown Vessel");
case 7:
return new String("Unknown Vessel");
case 8:
return new String("Medical Transport Vessel");
case 9:
return new String("Resolution 18 Vessel");
}
case 6:
string = new String("Passenger Ship");
break;
case 7:
string = new String("Cargo Ship");
break;
case 8:
string = new String("Tanker");
break;
case 9:
string = new String("Ship");
break;
}
// then append the cargo type (types 5 and 3 have already retured)
switch (dig2) {
case 1:
string += " carrying hazardous material category A";
break;
case 2:
string += " carrying hazardous material category B";
break;
case 3:
string += " carrying hazardous material category C";
break;
case 4:
string += " carrying hazardous material category D";
break;
case 5:
case 6:
case 7:
case 8:
string += " carrying unknown materials";
break;
}
return string;
}
public double getLength() {
return dimA + dimB;
}
public double getWidth() {
return dimC + dimD;
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
return ps;
}
}

View File

@ -0,0 +1,197 @@
package AIS;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;
import javax.swing.Timer;
import javax.swing.table.AbstractTableModel;
import PamUtils.LatLong;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataBlock;
public class AISStringsTable {
static AISStringsTable singleInstance;
AISDataBlock aisDataBlock;
private int[] colWidths = {250, 100, 250, 200, 80, 200, 120, 120};
private String[] tableColumns = {"Last update", "mmsi", "Name", "Type",
"LOA", "Destination", "Lat", "Long", "CSE", "SPD"};
JFrame frame;
JPanel mainPanel;
JTable nmeaTable;
Timer timer;
AISTableData aisTableData;
private AISStringsTable() {
frame = new AISFrame("AIS Vessel List");
// frame.setSize(800, 200);
frame.setLocation(100, 300);
frame.setAlwaysOnTop(true);
// frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
// frame.addWindowListener(this);
mainPanel = new JPanel(new GridLayout(1, 0));
mainPanel.setOpaque(true);
aisTableData = new AISTableData();
nmeaTable = new JTable(aisTableData);
nmeaTable.setAutoResizeMode(JTable.AUTO_RESIZE_LAST_COLUMN);
int nCol = Math.min(aisTableData.getColumnCount(), colWidths.length);
for (int i = 0; i < nCol; i++) {
nmeaTable.getColumnModel().getColumn(i).setPreferredWidth(colWidths[i]);
}
// nmeaTable.getColumnModel().getColumn(0).setPreferredWidth(250);
// nmeaTable.getColumnModel().getColumn(1).setPreferredWidth(100);
// nmeaTable.getColumnModel().getColumn(2).setPreferredWidth(250);
// nmeaTable.getColumnModel().getColumn(3).setPreferredWidth(200);
// nmeaTable.getColumnModel().getColumn(4).setPreferredWidth(80);
// nmeaTable.getColumnModel().getColumn(5).setPreferredWidth(200);
// nmeaTable.getColumnModel().getColumn(6).setPreferredWidth(120);
// nmeaTable.getColumnModel().getColumn(7).setPreferredWidth(120);
JScrollPane scrollPanel = new JScrollPane(nmeaTable);
mainPanel.add(scrollPanel);
mainPanel.setPreferredSize(new Dimension(900, 200));
frame.setContentPane(mainPanel);
frame.pack();
timer = new Timer(500, new TimerListener());
timer.setInitialDelay(10);
}
class AISFrame extends JFrame {
// so I can override set visible !
public AISFrame(String title) throws HeadlessException {
super(title);
}
/* (non-Javadoc)
* @see java.awt.Component#setVisible(boolean)
*/
@Override
public void setVisible(boolean b) {
if (b) timer.start();
else timer.stop();
super.setVisible(b);
}
}
static public void show(AISControl aisControl) {
if (singleInstance == null) {
singleInstance = new AISStringsTable();
}
singleInstance.aisDataBlock = aisControl.aisProcess.getOutputDataBlock();
singleInstance.frame.setVisible(true);
}
class TimerListener implements ActionListener {
boolean doneLayout;
public void actionPerformed(ActionEvent ev) {
// table.
// nmeaTableData.fireTableRowsUpdated(0, 10);
aisTableData.fireTableDataChanged();
if (doneLayout == false && aisTableData.getRowCount() > 0) {
doneLayout = true;
}
}
}
class AISTableData extends AbstractTableModel {
/* (non-Javadoc)
* @see javax.swing.table.AbstractTableModel#getColumnName(int)
*/
@Override
public String getColumnName(int column) {
// TODO Auto-generated method stub
return tableColumns[column];
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getColumnCount()
*/
public int getColumnCount() {
return tableColumns.length;
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getRowCount()
*/
public int getRowCount() {
if (aisDataBlock == null) return 0;
//System.out.println(aisDataBlock.getUnitsCount() + " rows in AIS data");
return aisDataBlock.getUnitsCount();
}
/* (non-Javadoc)
* @see javax.swing.table.TableModel#getValueAt(int, int)
*/
public Object getValueAt(int rowIndex, int columnIndex) {
AISDataUnit aisDataUnit = aisDataBlock.getDataUnit(rowIndex, PamDataBlock.REFERENCE_CURRENT);
AISStaticData staticData = aisDataUnit.getStaticData();
AISPositionReport positionReport = aisDataUnit.getPositionReport();
String str = null;
switch(columnIndex) {
case 0: // time
return PamCalendar.formatDateTime(aisDataUnit.getTimeMilliseconds());
case 1:
return aisDataUnit.mmsiNumber;
//return ((StringBuffer) pamDataUnit.data).substring(1,6);
case 2:
if (staticData != null) return staticData.shipName;
break;
case 3:
if (staticData != null) str = staticData.getStationTypeString(aisDataUnit.stationType, staticData.shipType);
if (str == null) str = aisDataUnit.stationType.toString();
return str;
case 4:
if (staticData != null) return staticData.dimA + staticData.dimB + "m";
break;
case 5:
if (staticData != null) return staticData.destination;
break;
case 6:
if (positionReport != null) return LatLong.formatLatitude(positionReport.getLatitude());
break;
case 7:
if (positionReport != null) return LatLong.formatLongitude(positionReport.getLongitude());
break;
case 8:
if (positionReport != null) return String.format("%.1f", positionReport.courseOverGround);
break;
case 9:
if (positionReport != null) return String.format("%.1f", positionReport.speedOverGround);
break;
}
return null;
}
}
}

198
src/AIS/ProcessAISData.java Normal file
View File

@ -0,0 +1,198 @@
package AIS;
import NMEA.NMEADataBlock;
import NMEA.NMEADataUnit;
import PamController.PamController;
import PamDetection.AbstractLocalisation;
import PamDetection.LocContents;
import PamUtils.PamCalendar;
import PamView.symbol.StandardSymbolManager;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamObservable;
import PamguardMVC.PamProcess;
import autecPhones.AutecGraphics;
/**
* Process NMEA data to extract AIS information
* @author Doug Gillespie
*
*/
public class ProcessAISData extends PamProcess {
AISControl aisControl;
AISDataUnit aivdm = new AISDataUnit(PamCalendar.getTimeInMillis());
AISDataBlock aisDataBlock;
ProcessAISData(AISControl aisController) {
super(aisController, null);
aisControl = aisController;
setProcessName("AIS Processing");
// allNmeaData.addObserver(this);
addOutputDataBlock(aisDataBlock = new AISDataBlock(aisControl, this));
aisDataBlock.setOverlayDraw(new AISGraphics(aisController, aisDataBlock));
aisDataBlock.setPamSymbolManager(new StandardSymbolManager(aisDataBlock, AISGraphics.defaultSymbol, true));
aisDataBlock.setLocalisationContents(LocContents.HAS_BEARING | LocContents.HAS_DEPTH |
LocContents.HAS_LATLONG | LocContents.HAS_RANGE);
aisDataBlock.SetLogging(new AISLogger(aisDataBlock, this));
aisDataBlock.setBinaryDataSource(new AISBinaryDataSource(aisController, aisDataBlock));
}
public AISDataBlock getOutputDataBlock() {
return aisDataBlock;
}
boolean findNMEADataBlock() {
PamDataBlock newDataBlock = null;
newDataBlock = PamController.getInstance().getDataBlock(NMEADataUnit.class, aisControl.aisParameters.nmeaSource);
if (newDataBlock == null) {
newDataBlock = PamController.getInstance().getDataBlock(NMEADataUnit.class, 0);
}
if (newDataBlock == null)
return false;
aisControl.nmeaDataBlock = (NMEADataBlock) newDataBlock;
setParentDataBlock(newDataBlock);
return true;
}
@Override
public void noteNewSettings() {
findNMEADataBlock();
}
@Override
public void newData(PamObservable o, PamDataUnit pamDataUnit) {
NMEADataUnit nmeaDataUnit = (NMEADataUnit) pamDataUnit;
StringBuffer nmeaString = nmeaDataUnit.getCharData();
String stringId = NMEADataBlock.getSubString(nmeaString, 0);
if (stringId.equals("!AIVDM")) {
unpackAIVDM(nmeaDataUnit);
}
}
private void unpackAIVDM(NMEADataUnit dataUnit) {
StringBuffer dataString = dataUnit.getCharData();
// System.out.println("Unpack AIVDM " + dataString);
aivdm.dataType = NMEADataBlock.getSubString(dataString, 0);
String subString;
AISDataUnit newVDM = new AISDataUnit(dataUnit.getTimeMilliseconds());
// newVDM.latestString = new String(dataString);
//ByteBuffer byteBuffer;
try {
subString = NMEADataBlock.getSubString(dataString, 1);
if (subString == null) return;
newVDM.totalSentences = Integer.valueOf(subString);
subString = NMEADataBlock.getSubString(dataString, 2);
if (subString == null) return;
newVDM.sentenceNumber = Integer.valueOf(subString);
subString = NMEADataBlock.getSubString(dataString, 3);
if (subString == null) return;
if (subString.length() > 0) {
newVDM.sequentialIdentifier = Integer.valueOf(subString);
}
subString = NMEADataBlock.getSubString(dataString, 4);
if (subString == null) return;
if (subString.length() > 0) {
newVDM.aisChannel = new String(subString);
}
subString = NMEADataBlock.getSubString(dataString, 5);
if (subString == null) return;
newVDM.charData = new String(subString);
subString = NMEADataBlock.getSubString(dataString, 6);
if (subString == null) return;
newVDM.fillBits = Integer.valueOf(subString);
}
catch (Exception Ex) {
Ex.printStackTrace();
return;
}
// see where we are in a sequence - if it's the first string, start
// a new AIVDM, if it's the last string, process it - most will
// be both, but not all !. Stirngs may also be a bit out of synch
// if we start up in the middle of a sequence. so cross check against
// existing data in multi part data.
if (newVDM.sentenceNumber == 1) {
// start a new VDM
aivdm = newVDM.clone();
}
else if (newVDM.sentenceNumber == aivdm.sentenceNumber + 1) {
// update the VDM
aivdm.sentenceNumber ++;
aivdm.charData += newVDM.charData;
aivdm.fillBits = newVDM.fillBits;
}
if (newVDM.sentenceNumber == newVDM.totalSentences) {
/*
* Look in the AISDataBlock and see if it's an existing
* ship (from it's MMSI number) and either update
* the existing unit, or create a new one.
* This is done by the AISDataBlock
* the first thing to do though is to get the MMSI number
* from the string's header.
*/
boolean ok = aivdm.decodeMessage();
aivdm.setTimeMilliseconds(PamCalendar.getTimeInMillis());
// only add the data to the list if it's a useful type
// (i.e. not base station data)
if (ok) {
switch(aivdm.messageId){
case 1:
case 2:
case 3:
case 4:
case 5:
case 18:
case 19:
case 21:
case 24:
aisDataBlock.addAISData(aivdm);
break;
default:
// System.out.println(String.format("Bad AIVDM message type %d: %s", aivdm.messageId, aivdm.charData));
}
}
// else {
// System.out.println(String.format("Can't decode AIVDM message type %d: %s", aivdm.messageId, aivdm.charData));
// }
}
}
@Override
public void pamStart() {
// TODO Auto-generated method stub
}
@Override
public void pamStop() {
// TODO Auto-generated method stub
}
@Override
public void clearOldData() {
//super.clearOldData();
}
}

23
src/AIS/StationType.java Normal file
View File

@ -0,0 +1,23 @@
package AIS;
public enum StationType {
UNKNOWN, A, B, BASESTATION, NAVAID;
@Override
public String toString() {
switch(this) {
case UNKNOWN:
return "Unknown";
case A:
return "Class A";
case B:
return "Class B";
case BASESTATION:
return "Base Station";
case NAVAID:
return "Aid to Navigation";
}
return null;
}
}

View File

@ -0,0 +1,41 @@
package Acquisition;
/**
* Very simplified version of the Acquisition parameters
* to be passed over the JNI to the C backend.
* @author Doug
*
*/
public class AcquisitionCParameters {
public static final int MAXCHAN = 4;
public static final int SOUNDCARD = 1;
public static final int WAVFILE = 2;
public static final int DAQCARD = 3;
public int deviceType;
public int deviceNumber;
public int sampleRate;
public int nChan;
public int spareInt1=0;
public int spareInt2=0;
public String spareString1 = null;
public String spareString2 = null;
public int[] channelList = new int[MAXCHAN];
public String soundFile;
public int setDaqType(String daqType) {
deviceType = -1;
if (daqType.equalsIgnoreCase("Sound Card")) {
deviceType = SOUNDCARD;
}
else if (daqType.equalsIgnoreCase("Audio File")) {
deviceType = WAVFILE;
}
else if (daqType.equalsIgnoreCase("National Instruments DAQ Cards")) {
deviceType = DAQCARD;
}
return deviceType;
}
}

View File

@ -0,0 +1,802 @@
/* PAMGUARD - Passive Acoustic Monitoring GUARDianship.
* To assist in the Detection Classification and Localisation
* of marine mammals (cetaceans).
*
* Copyright (C) 2006
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
package Acquisition;
import hfDaqCard.SmruDaqSystem;
//import mcc.mccacquisition.MCCDaqSystem;
import mcc.mccacquisition.MCCDaqSystem;
import java.awt.Component;
import java.awt.Frame;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.SwingConstants;
import dataGram.DatagramManager;
import dataMap.OfflineDataMapPoint;
import dataMap.filemaps.OfflineFileServer;
import dataPlotsFX.data.TDDataProviderRegisterFX;
import dataPlotsFX.rawDataPlotFX.RawSoundProviderFX;
import pamScrollSystem.ViewLoadObserver;
import simulatedAcquisition.SimProcess;
//import xarraydaq.XArrayDaq;
import asiojni.ASIOSoundSystem;
import asiojni.NewAsioSoundSystem;
import nidaqdev.NIDAQProcess;
import nidaqdev.networkdaq.NINetworkDaq;
import Acquisition.filedate.FileDate;
import Acquisition.filedate.StandardFileDate;
import Acquisition.layoutFX.AquisitionGUIFX;
import Acquisition.offlineFuncs.OfflineWavFileServer;
import Acquisition.rona.RonaOfflineFileServer;
import Array.ArrayManager;
import Array.PamArray;
import Array.Preamplifier;
import PamController.OfflineFileDataStore;
import PamController.PamControlledUnit;
import PamController.PamControlledUnitGUI;
import PamController.PamControlledUnitSettings;
import PamController.PamController;
import PamController.PamControllerInterface;
import PamController.PamGUIManager;
import PamController.PamSettingManager;
import PamController.PamSettings;
import PamModel.PamModel;
import PamModel.SMRUEnable;
import PamUtils.FrequencyFormat;
import PamUtils.PlatformInfo;
import PamUtils.PlatformInfo.OSType;
import PamView.MenuItemEnabler;
import PamView.PamStatusBar;
import PamView.dialog.PamLabel;
import PamView.panel.PamPanel;
import PamView.panel.PamProgressBar;
import PamguardMVC.PamConstants;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamProcess;
import PamguardMVC.PamRawDataBlock;
import PamguardMVC.dataOffline.OfflineDataLoadInfo;
/**
* Main data acquisition control to get audio data from sound cards,
* NI cards (via UDP), files, directories of files, etc.
* <p>
* Uses a plug in architecture to allow new types to be added. This
* is done through RegisterDaqType()
*
* @author Doug Gillespie
*
* @see Acquisition.DaqSystem
*
*/
public class AcquisitionControl extends PamControlledUnit implements PamSettings, OfflineFileDataStore {
protected ArrayList<DaqSystem> systemList;
public AcquisitionParameters acquisitionParameters = new AcquisitionParameters();
protected AcquisitionProcess acquisitionProcess;
protected MenuItemEnabler daqMenuEnabler;
protected OfflineFileServer offlineFileServer;
private PamLabel statusBarText;
private PamProgressBar levelBar;
public static final String unitType = "Data Acquisition";
protected AcquisitionControl acquisitionControl;
protected Component statusBarComponent;
protected PamController pamController;
protected DAQChannelListManager daqChannelListManager;
protected FolderInputSystem folderSystem;
private DCL5System dclSystem;
protected FileDate fileDate;
/**
* The JavaFX GUI for the sound acquisition module.
*/
private AquisitionGUIFX aquisitionGUIFX;
/**
* Main control unit for audio data acquisition.
* <p>
* It is possible to instantiate several instances of this, preferably
* with different names to simultaneously acquire sound from a number of
* sources such as multiple sound cards, fast ADC boards, etc.
* <p>
* Each different acquisition device must implement the DaqSystem interface
* and register with each AcquisitionControl.
* @param name name of the Acquisition control that will appear in menus. These should be
* different for each instance of AcquistionControl since the names are used by PamProcesses
* to find the correct data blocks.
* @see DaqSystem
*/
public AcquisitionControl(String name) {
super(unitType, name);
acquisitionControl = this;
fileDate = new StandardFileDate(this);
pamController = PamController.getInstance();
registerDaqSystem(new SoundCardSystem(this));
if (PlatformInfo.calculateOS() == OSType.WINDOWS) {
registerDaqSystem(new ASIOSoundSystem(this));
registerDaqSystem(new NewAsioSoundSystem(this));
}
registerDaqSystem(new FileInputSystem(this));
registerDaqSystem(folderSystem = new FolderInputSystem(this));
// registerDaqSystem(dclSystem = new DCL5System());
registerDaqSystem(new NIDAQProcess(this));
registerDaqSystem(new SmruDaqSystem(this));
registerDaqSystem(new SimProcess(this));
// registerDaqSystem(new XArrayDaq(this));
if (SMRUEnable.isEnable()) {
// registerDaqSystem(new icListenSystem());
// registerDaqSystem(new NINetworkDaq(this));
registerDaqSystem(new MCCDaqSystem(this));
// registerDaqSystem(new RonaInputSystem(this));
}
// load the DAQ Systems found in the plugins folder
loadExternalDaqSystems();
daqChannelListManager = new DAQChannelListManager(this);
PamSettingManager.getInstance().registerSettings(this);
addPamProcess(acquisitionProcess = new AcquisitionProcess(this));
daqMenuEnabler = new MenuItemEnabler();
statusBarComponent = getStatusBarComponent();
if (isViewer) {
if (this.acquisitionParameters.daqSystemType.equals(RonaInputSystem.systemType)) {
offlineFileServer = new RonaOfflineFileServer(this, fileDate);
}
else {
offlineFileServer = new OfflineWavFileServer(this, fileDate);
}
}
else {
PamStatusBar statusBar = PamStatusBar.getStatusBar();
if (statusBar != null) {
// statusBar.getToolBar().add(statusBarText = new JLabel());
// fillStatusBarText();
// statusBar.getToolBar().add(levelBar = new JProgressBar(-60, 0));
// levelBar.setValue(-60);
// levelBar.setOrientation(JProgressBar.HORIZONTAL);
statusBar.add(statusBarComponent);
// statusBar.getToolBar().addSeparator();
setupStatusBar();
}
}
setSelectedSystem();
TDDataProviderRegisterFX.getInstance().registerDataInfo(new RawSoundProviderFX(this));
}
public AcquisitionControl(String name, boolean isSimulator) {
super(unitType, name);
acquisitionControl = this;
}
/**
* Overloaded constructor - used by the STAcquisitionControl class as a way to call
* the PamController.PamControlledUnit constructor without all of the AcquisitionControl
* code above
*
* @param type the type of unit
* @param name the name of the unit
*/
public AcquisitionControl(String type, String name) {
super(type, name);
}
private PamPanel systemPanel;
protected Component getStatusBarComponent() {
PamPanel p = new PamPanel();
p.add(statusBarText = new PamLabel());
p.add(levelBar = new PamProgressBar(-60, 0));
p.add(systemPanel = new PamPanel());
levelBar.setOrientation(SwingConstants.HORIZONTAL);
fillStatusBarText();
levelBar.setValue(-60);
return p;
}
/**
* Registered new DAQ systems and makes them available via the AcquisitionCialog
* @param daqSystem
*/
public void registerDaqSystem(DaqSystem daqSystem){
if (systemList == null) {
systemList = new ArrayList<DaqSystem>();
}
systemList.add(daqSystem);
//daqSystem.getItemsList();
fillStatusBarText();
}
public static ArrayList<AcquisitionControl> getControllers() {
ArrayList<AcquisitionControl> daqControllers = new ArrayList<AcquisitionControl>();
PamControlledUnit pcu;
for (int i = 0; i < PamController.getInstance().getNumControlledUnits(); i++) {
pcu = PamController.getInstance().getControlledUnit(i);
if (pcu.getUnitType().equals(unitType)) {
daqControllers.add((AcquisitionControl) pcu);
}
}
return daqControllers;
}
public AcquisitionProcess getDaqProcess() {
return acquisitionProcess;
}
public void setDaqProcess(AcquisitionProcess acquisitionProcess) {
this.acquisitionProcess = acquisitionProcess;
}
/**
* Finds a reference to a given DAQ system based on it's type (e.g. sound card, file, etc.
* @param systemType
* @return reference to a DaqSystem object
*/
public DaqSystem findDaqSystem(String systemType) {
if (systemList == null) return null;
if (systemType == null) systemType = acquisitionParameters.daqSystemType;
for (int i = 0; i < systemList.size(); i++) {
if (systemList.get(i).getSystemType().equals(systemType)) return systemList.get(i);
}
return null;
}
@Override
public JMenuItem createDetectionMenu(Frame parentFrame) {
JMenuItem daqMenu;
daqMenu = new JMenuItem(getUnitName() + " ...");
daqMenu.addActionListener(new acquisitionSettings(parentFrame));
daqMenuEnabler.addMenuItem(daqMenu);
return daqMenu;
}
class acquisitionSettings implements ActionListener {
Frame parentFrame;
public acquisitionSettings(Frame parentFrame) {
this.parentFrame = parentFrame;
}
public void actionPerformed(ActionEvent e) {
AcquisitionParameters newParameters = AcquisitionDialog.showDialog(parentFrame, acquisitionControl, acquisitionParameters);
if (newParameters != null) {
acquisitionParameters = newParameters.clone();
setSelectedSystem();
checkArrayChannels(parentFrame);
acquisitionProcess.setupDataBlock();
setupStatusBar();
fillStatusBarText();
PamController.getInstance().notifyModelChanged(PamControllerInterface.CHANGED_PROCESS_SETTINGS);
if (isViewer) {
offlineFileServer.createOfflineDataMap(parentFrame);
}
}
}
}
private DaqSystem lastSelSystem = null;
public void setSelectedSystem() {
DaqSystem selSystem = findDaqSystem(null);
if (selSystem == lastSelSystem) {
return;
}
if (lastSelSystem != null) {
lastSelSystem.setSelected(false);
}
if (selSystem != null) {
selSystem.setSelected(true);
}
lastSelSystem = selSystem;
}
/**
* Check array channels have corresponding hydrophones in the array manager. Does
* not open a dialog to warn or fix.
* @return check array channel. False if array manager
*/
public boolean checkArrayChannels() {
int error = arrayChannelsOK();
if (error == ARRAY_ERROR_OK) {
return true;
}
else return false;
}
/**
* Run a check to see that all read out channels are connected to
* a hydrophone and if not, do something about it.
* @return true if OK, or problem resolved.
*/
public boolean checkArrayChannels(Frame parentFrame) {
int error = arrayChannelsOK();
if (error == ARRAY_ERROR_OK) {
return true;
}
String message = new String("Do you want to go to the array manager now to rectify this problem ?");
message += "\n\nFailure to do so may result in PAMGUARD crashing or features not working correctly";
int ans = JOptionPane.showConfirmDialog(parentFrame, message, getArrayErrorMessage(error), JOptionPane.YES_NO_OPTION);
if (ans == JOptionPane.YES_OPTION) {
ArrayManager.getArrayManager().showArrayDialog(getPamView().getGuiFrame());
return checkArrayChannels(parentFrame);
}
return false;
}
private final int ARRAY_ERROR_OK = 0;
private final int ARRAY_ERROR_NO_ARRAYMANAGER = 1;
private final int ARRAY_ERROR_NO_ARRAY = 2;
private final int ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES = 3;
private int arrayChannelsOK() {
ArrayManager am = ArrayManager.getArrayManager();
if (am == null) {
return ARRAY_ERROR_NO_ARRAY;
}
PamArray pamArray = am.getCurrentArray();
if (pamArray == null) {
return ARRAY_ERROR_NO_ARRAYMANAGER;
}
int nChannels = acquisitionParameters.nChannels;
int[] hydrophoneList = acquisitionParameters.getHydrophoneList();
if (hydrophoneList == null || hydrophoneList.length < nChannels) {
return ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES;
}
for (int iChan = 0; iChan < nChannels; iChan++) {
if (hydrophoneList[iChan] >= pamArray.getHydrophoneCount()) {
return ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES;
}
}
return ARRAY_ERROR_OK;
}
String getArrayErrorMessage(int error) {
switch(error) {
case ARRAY_ERROR_OK:
return "Array Ok";
case ARRAY_ERROR_NO_ARRAYMANAGER:
return "There is no array manager within the system";
case ARRAY_ERROR_NO_ARRAY:
return "No PAMGUARD array has been found in the system";
case ARRAY_ERROR_NOT_ENOUGH_HYDROPHONES:
return "There are not enough hydrophones in the PAMGUARD array to support this number of channels";
}
return null;
}
void fillStatusBarText() {
if (statusBarText != null){
statusBarText.setText(getStatusBarText());
}
}
@Override
public String toString() {
// write current status into the status bar
String string;
DaqSystem daqSystem = findDaqSystem(null);
if (daqSystem == null) {
string = new String("No Data Acquisition Configured");
return string;
}
String daqName = daqSystem.getSystemName();
if (daqName == null) daqName = new String("");
string = String.format("%s %s %.1fkHz, %d channels, %d bit", daqSystem.getSystemType(), daqName,
acquisitionParameters.sampleRate / 1000., acquisitionParameters.nChannels, daqSystem.getSampleBits());
// System.out.println("Set status text to " + string);
return string;
}
/**
* Sets a level meter on the status bar
* @param peakValue Maximum amplitude fom AcquisitionProcess
*/
public void setStatusBarLevel(double peakValue) {
// convert to dB, status bar is set on a scale of -60 to 0
double dB = 20. * Math.log10(peakValue);
levelBar.setValue((int) dB);
}
protected void setupStatusBar() {
if (systemPanel == null) return;
systemPanel.removeAll();
DaqSystem daqSys = findDaqSystem(null);
if (daqSys == null) return;
Component specialComponent = daqSys.getStatusBarComponent();
if (specialComponent != null) {
systemPanel.add(specialComponent);
}
}
/**
* Prepares text for the status bar
* @return text in the status bar
*/
private String getStatusBarText() {
String statusString = toString();
if (acquisitionProcess.getRunningSystem() == null) {
statusString += " : Idle";
}
else {
statusString += String.format(" : Running, buffer %3.1fs", acquisitionProcess.getBufferSeconds());
}
return statusString;
}
/*
* (non-Javadoc)
* @see PamController.PamSettings#GetSettingsReference()
*/
public Serializable getSettingsReference() {
return acquisitionParameters;
}
public long getSettingsVersion() {
return AcquisitionParameters.serialVersionUID;
}
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) {
// if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) {
try {
acquisitionParameters = ((AcquisitionParameters) pamControlledUnitSettings.getSettings()).clone();
if (acquisitionProcess != null) {
acquisitionProcess.setSampleRate(acquisitionParameters.sampleRate, true);
}
setupStatusBar();
fillStatusBarText();
return true;
}
catch (ClassCastException e) {
e.printStackTrace();
}
return false;
}
/* (non-Javadoc)
* @see PamguardMVC.PamControlledUnit#SetupControlledUnit()
*/
@Override
public void setupControlledUnit() {
super.setupControlledUnit();
fillStatusBarText();
}
// converts a list of ADC channels to a list of hydrophones
public int ChannelsToHydrophones(int channels) {
int[] hydrophoneList = getHydrophoneList();
if (hydrophoneList == null) return channels; // they are the same by default
//In viewer mode sometimes the number of channels in sound aquisition can be lost i.e.
//there are 0 channels. This causes bugs so if occurs return standard list.
if (acquisitionParameters.nChannels==0) return channels;
int hydrophones = 0;
int channelListIndex;
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) {
channelListIndex = acquisitionParameters.getChannelListIndexes(i);
if ((1<<i & channels) != 0 && channelListIndex >= 0) {
hydrophones |= 1<<hydrophoneList[channelListIndex];
}
}
return hydrophones;
}
/**
* Return a list of which channels are connected to which hydrophones in
* the currentarray.
* @return List of hydrophone numbers.
*/
public int[] getHydrophoneList() {
return acquisitionParameters.getHydrophoneList();
}
/**
* Sets the list of hydrophone numbers.
* @param hydrophoneList List of hydrophone numbers in channel order
*/
public void setHydrophoneList(int[] hydrophoneList) {
acquisitionParameters.setHydrophoneList(hydrophoneList);
}
/**
*
* finds the ADC channel for a given hydrophone.
* Will return -1 if no ADC channel uses this hydrophone
*
* @param hydrophoneId Number of a hydrophone in a PamArray
* @return the ADC channel for the given hydrophone
*/
public int findHydrophoneChannel(int hydrophoneId) {
// finds the ADC channel for a given hydrophone.
// will return -1 if no ADC channel uses this hydrophone
// if no list, assume 1-1 mapping
int channelList[] = acquisitionControl.acquisitionParameters.getHardwareChannelList();
if (acquisitionParameters.getHydrophoneList() == null){
if (hydrophoneId < acquisitionParameters.nChannels) {
return hydrophoneId;
}
else return -1;
}
int channelNumber;
for (int i = 0; i < acquisitionParameters.getHydrophoneList().length; i++){
channelNumber = acquisitionParameters.getChannelList(i);
if (acquisitionParameters.getHydrophone(channelNumber) == hydrophoneId){
return channelNumber;
}
}
return -1;
}
// Dajo, PR,
// Method: find the phone connected to a given channel
public int getChannelHydrophone(int channel) {
// int channelIndex = this.acquisitionParameters.getChannelListIndexes(channel);
int phone = acquisitionParameters.getHydrophone(channel);
return phone;
}
public double getPeak2PeakVoltage(int swChannel) {
return acquisitionProcess.getPeak2PeakVoltage(swChannel);
}
/* (non-Javadoc)
* @see PamController.PamControlledUnit#removeUnit()
*/
@Override
public boolean removeUnit() {
boolean ans = super.removeUnit();
PamStatusBar statusBar = PamStatusBar.getStatusBar();
if (statusBar != null) {
statusBar.remove(statusBarComponent);
// statusBar.getToolBar().invalidate();
statusBar.getToolBar().repaint();
}
return ans;
}
/**
* Getter for acquisition parameters.
* @return data acquisition parameters.
*/
public AcquisitionParameters getAcquisitionParameters() {
return acquisitionParameters;
}
public AcquisitionProcess getAcquisitionProcess() {
return acquisitionProcess;
}
public DAQChannelListManager getDaqChannelListManager() {
return daqChannelListManager;
}
/**
* @return the offlineFileServer
*/
public OfflineFileServer getOfflineFileServer() {
return offlineFileServer;
}
@Override
public void notifyModelChanged(int changeType) {
super.notifyModelChanged(changeType);
switch(changeType) {
case PamControllerInterface.INITIALIZATION_COMPLETE:
if (isViewer) {
offlineFileServer.createOfflineDataMap(PamController.getMainFrame());
}
}
if (lastSelSystem != null) {
lastSelSystem.notifyModelChanged(changeType);
}
}
// /**
// * @return the folderSystem
// */
// public FolderInputSystem getFolderSystem() {
// if (findDaqSystem(null) == dclSystem) {
// return dclSystem;
// }
// else {
// return folderSystem;
// }
// }
public FolderInputSystem getFolderSystem() {
return folderSystem;
}
@Override
public void createOfflineDataMap(Window parentFrame) {
offlineFileServer.createOfflineDataMap(parentFrame);
}
@Override
public String getDataSourceName() {
if (offlineFileServer == null) {
return null;
}
return offlineFileServer.getDataSourceName();
}
@Override
public boolean loadData(PamDataBlock dataBlock, OfflineDataLoadInfo offlineLoadDataInfo, ViewLoadObserver loadObserver) {
return offlineFileServer.loadData(dataBlock, offlineLoadDataInfo, loadObserver);
}
@Override
public boolean saveData(PamDataBlock dataBlock) {
return offlineFileServer.saveData(dataBlock);
}
@Override
public PamRawDataBlock getRawDataBlock() {
return acquisitionProcess.getRawDataBlock();
}
@Override
public PamProcess getParentProcess() {
return acquisitionProcess;
}
public boolean isStalled() {
return acquisitionProcess.isStalled();
}
@Override
public boolean rewriteIndexFile(PamDataBlock dataBlock,
OfflineDataMapPoint dmp) {
return false;
}
@Override
public DatagramManager getDatagramManager() {
// TODO Auto-generated method stub
return null;
}
public FileDate getFileDate() {
return fileDate;
}
/**
* Load any classes that were found in the plugins folder and implement the DaqSystemInterface interface
*/
public void loadExternalDaqSystems() {
// get a list of plugins
List<DaqSystemInterface> daqList = ((PamModel) PamController.getInstance().getModelInterface()).getDaqList();
// if there are no plugins, return
if (daqList.isEmpty()) {
return;
}
for (DaqSystemInterface dsi : daqList ) {
registerDaqSystem(dsi.createDAQControl(this));
}
}
/**
* Get the available DAQ systems
* @return
*/
public ArrayList<DaqSystem> getSystemList() {
return this.systemList;
}
/**
* Set the acquisition parameters.
* @param params - the acquisition params to set.
*/
public void setAquisitionParams(AcquisitionParameters params) {
this.acquisitionParameters=params;
}
@Override
public PamControlledUnitGUI getGUI(int flag) {
if (flag==PamGUIManager.FX) {
if (aquisitionGUIFX ==null) {
aquisitionGUIFX= new AquisitionGUIFX(this);
}
return aquisitionGUIFX;
}
//TODO swing
return null;
}
@Override
public String getModuleSummary() {
DaqSystem daqSys = findDaqSystem(null);
if (daqSys == null) {
return String.format("%s - currently unavailable", acquisitionParameters.daqSystemType);
}
String str = String.format("%s - %s, %3.1fVp-p",
acquisitionParameters.daqSystemType, daqSys.getDeviceName(),
acquisitionParameters.voltsPeak2Peak);
Preamplifier preamp = acquisitionParameters.getPreamplifier();
if (preamp != null) {
str += String.format(", %3.1fdB gain", preamp.getGain());
}
str += ", Sample Rate " + FrequencyFormat.formatFrequency(acquisitionParameters.sampleRate, true);
return str;
}
@Override
public void pamHasStopped() {
acquisitionProcess.pamHasStopped();
}
}

View File

@ -0,0 +1,686 @@
package Acquisition;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JComponent;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.border.TitledBorder;
import Acquisition.gpstiming.PPSDialogPanel;
import PamController.PamController;
import PamModel.SMRUEnable;
import PamView.dialog.PamDialog;
import PamView.dialog.PamGridBagContraints;
import PamView.panel.PamAlignmentPanel;
import dataMap.filemaps.OfflineFileDialogPanel;
import dataMap.filemaps.OfflineFileParameters;
/**
* Main dialog for acquisition control. Takes plug in panels from
* the various sound systems to give more device specific controls where
* necessary.
*
* @author Doug Gillespie
*
*/
public class AcquisitionDialog extends PamDialog {
private static AcquisitionParameters acquisitionParameters;
private static AcquisitionDialog singleInstance;
private static AcquisitionControl acquisitionControl;
private OfflineFileDialogPanel offlineDAQDialogPanel;
private PPSDialogPanel ppsDialogPanel;
private DaqSystem currentDaqSystem;
private JComboBox deviceType;
private JPanel mainPanel;
private JComponent deviceSpecificPanel;
private JTextField sampleRate, nChannels, vPeak2Peak;
private JTextField preampGain;
// bandwidth0, bandwidth1;
private JCheckBox subtractDC;
private JTextField dcTimeconstant;
// public int channelList[] = new int[PamConstants.MAX_CHANNELS];
//
// private JLabel panelChannelLabel[] = new JLabel[PamConstants.MAX_CHANNELS];
// private JComboBox panelChannelList[] = new JComboBox[PamConstants.MAX_CHANNELS];
private ChannelListPanel standardChannelListPanel = new StandardChannelListPanel();
private ChannelListPanel currentChannelListPanel;
private JPanel channelListPanelArea = new JPanel();
//private static AcquisitionParameters acquisitionParameters; //Xiao Yan Deng
/**
* Main dialog for data acquisition control
* <p>
* When shown, the dialog contains three main panels.
* <p>The top one shows
* a list of available DaqSystems (e.g. sound cards, NI cards, etc.
* >p>
* The middle panel selected based on the type of DaqSytem and is implemented differently
* within each DaqSystem. For instance, the sound card DaqSystem displays a list
* of available sound cards. The file system displays a list of recent files,
* systems for other ADC cards mght display a channel selector and gain settings
* specific for a particular device.
* <p>
* The bottom panel shows the number of channels, sample rate, and device sensitivity.
* The selected DaqSystem is queried to see if these are fixed, unknown or user entered
* and enables the controls accordingly. If they are set by the DaqSystem, the
* DaqSystem should set them explicity using setSampleRate(), setChannels, and
* setVPeak2Peak
*
*/
private AcquisitionDialog (Frame parentFrame) {
super(parentFrame, "Audio Data Acquisition", false);
mainPanel = new JPanel();
mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
mainPanel.add(DeviceTypePanel());
mainPanel.add(SamplingPanel());
mainPanel.add(CalibrationPanel());
nChannels.addActionListener(new NumChannels());
setHelpPoint("sound_processing.AcquisitionHelp.docs.AcquisitionConfiguration");
if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) {
JTabbedPane tabbedPane = new JTabbedPane();
offlineDAQDialogPanel = new OfflineFileDialogPanel(acquisitionControl, this);
tabbedPane.add("Offline Files", offlineDAQDialogPanel.getComponent());
tabbedPane.add("DAQ Settings", mainPanel);
setDialogComponent(tabbedPane);
}
else if (SMRUEnable.isEnable()) {
JTabbedPane tabbedPane = new JTabbedPane();
ppsDialogPanel = new PPSDialogPanel(acquisitionControl, this);
tabbedPane.add("DAQ Settings", mainPanel);
tabbedPane.add("GPS Timing", ppsDialogPanel.getDialogComponent());
setDialogComponent(tabbedPane);
}
else {
setDialogComponent(mainPanel);
}
setParams(); //Xiao Yan Deng
sortChannelLists(); // Xiao Yan Deng
}
/**
* Clear the static instance so that the dialog is
* totally rebuilt next time it's launched.
*/
static public void clearInstance() {
singleInstance = null;
}
/**
* Shows the data acquisition dialog.
* @param daqControl the calling AcquisitionControl
* @param oldParams current parameters from the AcquisitionControl
* @return new parameters selected in the dialog
* @see AcquisitionControl
*/
static public AcquisitionParameters showDialog(Frame parentFrame, AcquisitionControl daqControl, AcquisitionParameters oldParams) {
acquisitionParameters = oldParams.clone();
acquisitionControl = daqControl;
if (singleInstance == null || singleInstance.getOwner() != parentFrame) {
singleInstance = new AcquisitionDialog(parentFrame);
}
singleInstance.setParams();
singleInstance.sortChannelLists();
singleInstance.setVisible(true);
singleInstance.sortChannelLists(); // Xiao Yan Deng
return acquisitionParameters;
}
private void setParams() {
// fill in the different device types.
deviceType.removeAllItems();
int ind = 0;
for (int i = 0; i < acquisitionControl.systemList.size(); i++) {
deviceType.addItem(acquisitionControl.systemList.get(i).getSystemType());
if (acquisitionControl.systemList.get(i).getSystemType().equals(acquisitionParameters.daqSystemType)) {
ind = i;
}
}
deviceType.setSelectedIndex(ind);
newDeviceType();
setSampleRate(acquisitionParameters.sampleRate);
setChannels(acquisitionParameters.nChannels);
setVPeak2Peak(acquisitionParameters.voltsPeak2Peak);
// preampGain.setText(String.format("%.1f", acquisitionParameters.preamplifier.getGain()));
setPreampGain(acquisitionParameters.preamplifier.getGain());
// bandwidth0.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[0]));
// bandwidth1.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[1]));
subtractDC.setSelected(acquisitionParameters.subtractDC);
dcTimeconstant.setText(String.format("%3.1f", acquisitionParameters.dcTimeConstant));
if (currentDaqSystem != null) currentDaqSystem.dialogSetParams();
if (currentChannelListPanel != null) {
currentChannelListPanel.setParams(acquisitionParameters.getHardwareChannelList());
}
if (offlineDAQDialogPanel != null) {
offlineDAQDialogPanel.setParams();
}
if (ppsDialogPanel != null) {
ppsDialogPanel.setParams(acquisitionParameters.getPpsParameters());
}
enableControls();
}
/**
* Called by the specific DaqSystem to set sample rate when it is set by
* the DaqSystem (for instance FileInputSystem will set sample rate to the
* sample rate of data in the current file.
* @param sampleRate Current sample rate
*/
public void setSampleRate(float sampleRate) {
this.sampleRate.setText(String.format("%.0f", sampleRate));
}
/**
* Get the sample rate, or null if sample rate is not a valid number
* @return sample rate or null
*/
public Double getSampleRate() {
try {
return Double.valueOf(sampleRate.getText());
}
catch (NumberFormatException e) {
return null;
}
}
/**
* Called by the specific DaqSystem to set the number of channels when it is set by
* the DaqSystem (for instance FileInputSystem will set it to the
* number of channels in the current file.
* @param nChannels Number of channels
*/
public void setChannels(int nChannels) {
this.nChannels.setText(String.format("%d", nChannels));
}
/**
* @return the number of channels or null if invalid number
*/
public Integer getChannels() {
try {
return Integer.valueOf(nChannels.getText());
}
catch (NumberFormatException e) {
return null;
}
}
public void setPreampGain(double gain) {
preampGain.setText(String.format("%.1f", gain));
}
/**
* Called by the specific DaqSystem to set the peak to peak voltage range.
* This is used for calculating absolute SPL's in various detectors
* the DaqSystem
* @param vPeak2Peak Peak to Peak input voltage
*/
public void setVPeak2Peak(double vPeak2Peak) {
this.vPeak2Peak.setText(String.format("%4.3f", vPeak2Peak));
}
// read parameters back from the dialog
@Override
public boolean getParams() {
try {
acquisitionParameters.daqSystemType = (String) deviceType.getSelectedItem();
acquisitionParameters.sampleRate = Float.valueOf(sampleRate.getText());
//
acquisitionParameters.nChannels = Integer.valueOf(nChannels.getText());
acquisitionParameters.voltsPeak2Peak = Double.valueOf(vPeak2Peak.getText());
acquisitionParameters.preamplifier.setGain(Double.valueOf(preampGain.getText()));
// double[] bw = new double[2];
// bw[0] = Double.valueOf(bandwidth0.getText());
// bw[1] = Double.valueOf(bandwidth1.getText());
// acquisitionParameters.preamplifier.setBandwidth(bw);
if(!currentDaqSystem.areSampleSettingsOk(acquisitionParameters.nChannels, acquisitionParameters.sampleRate)){
currentDaqSystem.showSampleSettingsDialog(this);
return false;
}
int nP = getNumChannels();
if (getCurrentDaqSystem().supportsChannelLists() && currentChannelListPanel != null) {
if (currentChannelListPanel.isDataOk() == false) {
return false;
}
int[] chL = currentChannelListPanel.getChannelList();
for (int i = 0; i < chL.length; i++) {
acquisitionParameters.setChannelList(i, chL[i]);
}
}
else {
acquisitionParameters.setDefaultChannelList();
}
}
catch (Exception Ex) {
Ex.printStackTrace();
return false;
}
acquisitionParameters.subtractDC = subtractDC.isSelected();
if (acquisitionParameters.subtractDC) {
try {
acquisitionParameters.dcTimeConstant = Double.valueOf(dcTimeconstant.getText());
}
catch (NumberFormatException e) {
return showWarning("Invalid number for DC background time constant");
}
if (acquisitionParameters.dcTimeConstant <= 0) {
return showWarning("The DC bacround subtractino time constant must be greater than zero");
}
}
if (offlineDAQDialogPanel != null) {
OfflineFileParameters ofp = offlineDAQDialogPanel.getParams();
if (ofp == null) {
return false;
}
acquisitionControl.getOfflineFileServer().setOfflineFileParameters(ofp);
}
if (currentDaqSystem != null){
if (!currentDaqSystem.dialogGetParams()) {
return false;
}
}
if (ppsDialogPanel != null) {
if (!ppsDialogPanel.getParams(acquisitionParameters)) {
return false;
}
}
return true;
}
/**
* Read the latest sample rate value.
* @return sample rate Hz.
*/
public double readSampleRate() {
double sr = 0;
try {
sr = Double.valueOf(sampleRate.getText());
}
catch(NumberFormatException e) {
return -1;
}
return sr;
}
@Override
public void cancelButtonPressed() {
acquisitionParameters = null;
}
@Override
public void restoreDefaultSettings() {
}
private class NewDeviceType implements ActionListener {
public void actionPerformed(ActionEvent e) {
newDeviceType();
}
}
private class NumChannels implements ActionListener {
public void actionPerformed(ActionEvent e) {
sortChannelLists();
}
}
private JPanel DeviceTypePanel () {
JPanel p = new JPanel();
p.setBorder(new TitledBorder("Data Source Type"));
p.setLayout(new BorderLayout());
p.add(BorderLayout.CENTER, deviceType = new JComboBox());
deviceType.setMinimumSize(new Dimension(30,5));
deviceType.addActionListener(new NewDeviceType());
return p;
}
/**
* Only need to show the channel panel for certain device types,
*
*/
private void showHideChannelPanel() {
DaqSystem currentSystem = getCurrentDaqSystem();
if (currentSystem == null) return;
channelListPanelArea.removeAll();
currentChannelListPanel = null;
ChannelListPanel specialChannelListPanel = currentSystem.getDaqSpecificChannelListPanel(this);
if (specialChannelListPanel != null) {
currentChannelListPanel = specialChannelListPanel;
channelListPanelArea.add(specialChannelListPanel.getComponent());
}
else if (currentSystem.supportsChannelLists()) {
currentChannelListPanel = standardChannelListPanel;
channelListPanelArea.add(standardChannelListPanel.getComponent());
// channelListPanel.setVisible(currentSystem.supportsChannelLists());
}
}
private JPanel SamplingPanel () {
JPanel sP = new PamAlignmentPanel(new BorderLayout(), BorderLayout.WEST);
JPanel p = new JPanel();
sP.setBorder(new TitledBorder("Sampling"));
GridBagLayout layout;
p.setLayout(layout = new GridBagLayout());
GridBagConstraints constraints = new PamGridBagContraints();
constraints.anchor = GridBagConstraints.EAST;
constraints.insets = new Insets(2,2,2,2);
constraints.fill = GridBagConstraints.NONE;
constraints.gridx = 0;
constraints.gridy = 0;
addComponent(p, new JLabel("Sample Rate ", SwingConstants.RIGHT), constraints);
constraints.gridx ++;
constraints.gridwidth = 2;
constraints.anchor = GridBagConstraints.WEST;
addComponent(p, sampleRate = new JTextField(8), constraints);
constraints.gridx +=2;
constraints.gridwidth = 1;
addComponent(p, new JLabel(" Hz"), constraints);
constraints.gridx = 0;
constraints.gridy = 1;
addComponent(p, new JLabel("Number of Channels "), constraints);
constraints.gridx ++;
addComponent(p, nChannels = new JTextField(3), constraints);
constraints.gridx ++;
constraints.gridwidth = 2;
addComponent(p, new JLabel(" (hit enter)"), constraints);
sP.add(BorderLayout.NORTH, p);
// constraints.gridy++;
// constraints.gridx = 0;
// constraints.gridwidth = 4;
standardChannelListPanel = new StandardChannelListPanel();
// addComponent(p, channelListPanel, constraints);
constraints.insets = new Insets(2,2,2,2);
sP.add(BorderLayout.CENTER, channelListPanelArea);
return sP;
}
//
// private JPanel createStandardChannelListPanel() {
//
// /* code for select channel */
// /*
// * put this in a separate panel so it can be hidden if
// * it's not possible to change these parameters.
// *
// * Text information updated DG & JG 12/8/08
// */
// JPanel cP;
// cP = new JPanel();
// cP.setLayout(new GridBagLayout());
// GridBagConstraints c2 = new GridBagConstraints();
// c2.gridx = 0;
// c2.gridy = 0;
// c2.gridwidth = 4;
// c2.anchor = GridBagConstraints.WEST;
//// addComponent(channelListPanel, new JLabel("Select Hardware (HW) Channels"), c2);
// addComponent(cP, new JLabel("Map Hardware (HW) to Software (SW) Channels"), c2);
//
// c2.gridwidth = 1;
// String spaceStr;
// String s = "<html>PAMGUARD channel numbering starts at 0.<br>Your hardware channel numbering may start at 1.";
// s += "<br>So be aware. If you've put a plug into socket 1, <br>you probably want to select channel 0, etc.</html>";
// for (int i = 0; i < PamConstants.MAX_CHANNELS; i++){ //Xiao Yan Deng
// //for (int i = 0; i < getNumChannels(); i++){
//
// if (i%2 ==0){
// c2.gridx = 0;
// c2.gridy ++;
// }
// else {
// c2.gridx++;
// }
// //constraints.gridwidth = 2;
// if (i%2 == 1) {
// spaceStr = " ";
// }
// else {
// spaceStr = "";
// }
// addComponent(cP, panelChannelLabel[i] =
// new JLabel(spaceStr + " SW Ch " + i + " = HW Ch "), c2);
// c2.gridx ++;
// //constraints.gridwidth = 2;
// addComponent(cP, panelChannelList[i] = new JComboBox(), c2);
// panelChannelLabel[i].setToolTipText(s);
// panelChannelList[i].setToolTipText(s);
//
// }
// return cP;
// }
//
private JPanel CalibrationPanel() {
JPanel p = new PamAlignmentPanel(BorderLayout.WEST) ;
p.setBorder(new TitledBorder("Calibration"));
GridBagLayout layout;
p.setLayout(layout = new GridBagLayout());
GridBagConstraints constraints = new PamGridBagContraints();
constraints.anchor = GridBagConstraints.WEST;
constraints.insets = new Insets(2,2,2,2);
constraints.gridx = 0;
constraints.gridy = 0;
constraints.gridx = 0;
//constraints.gridy = 2;
// constraints.gridy++;
// constraints.gridwidth = 3;
// addComponent(p, new JLabel("Calibration data ... "), constraints);
// constraints.gridy++;
constraints.gridwidth = 1;
addComponent(p, new JLabel("Peak-Peak voltage range "), constraints);
constraints.gridx ++;
addComponent(p, vPeak2Peak = new JTextField(5), constraints);
constraints.gridx ++;
addComponent(p, new JLabel(" V "), constraints);
constraints.gridwidth = 1;
constraints.gridx = 0;
//constraints.gridy = 3;
constraints.gridy++;
constraints.anchor = GridBagConstraints.EAST;
addComponent(p, new JLabel("Preamplifier gain "), constraints);
constraints.gridx++;
constraints.anchor = GridBagConstraints.WEST;
addComponent(p, preampGain = new JTextField(5), constraints);
constraints.gridx++;
constraints.gridwidth = 2;
addComponent(p, new JLabel(" dB"), constraints);
constraints.gridwidth = 1;
constraints.gridx = 0;
//constraints.gridy = 4;
constraints.gridy++;
constraints.anchor = GridBagConstraints.EAST;
// addComponent(p, new JLabel("Bandwidth "), constraints);
// constraints.gridx++;
// constraints.anchor = GridBagConstraints.WEST;
// addComponent(p, bandwidth0 = new JTextField(7), constraints);
// constraints.gridx++;
// addComponent(p, new JLabel(" to "), constraints);
// constraints.gridx++;
// addComponent(p, bandwidth1 = new JTextField(7), constraints);
// constraints.gridx++;
// addComponent(p, new JLabel(" Hz "), constraints);
p.add(subtractDC = new JCheckBox("Subtract DC with "), constraints);
constraints.gridx++;
p.add(dcTimeconstant = new JTextField(4), constraints);
constraints.gridx++;
p.add(new JLabel("s time constant"), constraints);
subtractDC.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent arg0) {
enableControls();
}
});
String t = "Some input devices have a fixed (DC) offset in their voltage measurement.\n" +
"Subtracting this off can lead to improved PAMGuard performance.";
dcTimeconstant.setToolTipText(t);
subtractDC.setToolTipText(t);
return p;
}
protected void enableControls() {
dcTimeconstant.setEnabled(subtractDC.isSelected());
}
/**
*
* @return the number of channels
*/
int getNumChannels() {
try {
return Integer.valueOf(nChannels.getText());
}
catch (Exception Ex) {
return 0;
}
}
private void sortChannelLists() {
// first of all, only show the ones in range of nPanels
if (currentChannelListPanel != null) {
currentChannelListPanel.setNumChannels(getNumChannels());
}
pack();
}
/**
* Called when the device type changes. Loads the appropriate panel for
* the newly selected DaqSystem into the dialog
*
*/
private void newDeviceType() {
int devNumber = deviceType.getSelectedIndex();
if (devNumber < 0) return;
// remove the old type specific panel and replace it with a new one.
if (deviceSpecificPanel != null) {
mainPanel.remove(deviceSpecificPanel);
}
currentDaqSystem = acquisitionControl.systemList.get(devNumber);
deviceSpecificPanel = currentDaqSystem.getDaqSpecificDialogComponent(this);
if (deviceSpecificPanel != null) {
mainPanel.add(deviceSpecificPanel, 1);
currentDaqSystem.dialogSetParams();
}
sampleRate.setEnabled(currentDaqSystem.getMaxSampleRate() != DaqSystem.PARAMETER_FIXED);
nChannels.setEnabled(currentDaqSystem.getMaxChannels() != DaqSystem.PARAMETER_FIXED);
vPeak2Peak.setEnabled(currentDaqSystem.getPeak2PeakVoltage(0) == DaqSystem.PARAMETER_UNKNOWN);
showHideChannelPanel();
if (currentChannelListPanel != null) {
currentChannelListPanel.setNumChannels(getNumChannels());
currentChannelListPanel.setParams(acquisitionParameters.getHardwareChannelList());
}
pack();
}
public DaqSystem getCurrentDaqSystem() {
return currentDaqSystem;
}
/**
*
* @return the sample rate component
*/
public JTextField getSampleRateComponent() {
return sampleRate;
}
/**
*
* @return the nChannels component.
*/
public JTextField getnChanComponent() {
return nChannels;
}
}

View File

@ -0,0 +1,149 @@
package Acquisition;
import generalDatabase.PamTableDefinition;
import generalDatabase.PamTableItem;
import generalDatabase.SQLLogging;
import generalDatabase.SQLTypes;
import java.sql.Types;
import PamUtils.PamCalendar;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.debug.Debug;
import clickTrainDetector.CTDataUnit;
/**
* Very simple concrete implementation of SQLLogging to log the starts
* and stops of PAMGUARD in the database.
* @author Doug Gillespie
*
*/
public class AcquisitionLogging extends SQLLogging {
AcquisitionControl acquisitionControl;
PamTableDefinition tableDef;
PamTableItem adcClockTime, adcClockMillis, rawADCTime, status, reason, daqSystemType, sampleRate, nChannels, voltsPeak2Peak,
gain, duration, clockError, samples, gSamples, GPSPPSTime, serverTime, daqSystemName;
public AcquisitionLogging(PamDataBlock pamDataBlock, AcquisitionControl acquisitionControl) {
super(pamDataBlock);
this.acquisitionControl = acquisitionControl;
tableDef = new PamTableDefinition(pamDataBlock.getDataName(), UPDATE_POLICY_OVERWRITE);
tableDef.addTableItem(adcClockTime = new PamTableItem("ADC Clock", Types.TIMESTAMP));
tableDef.addTableItem(adcClockMillis = new PamTableItem("ADC Clock millis", Types.INTEGER));
tableDef.addTableItem(rawADCTime = new PamTableItem("RAW ADC Clock", Types.TIMESTAMP));
tableDef.addTableItem(gSamples = new PamTableItem("GigaSamples", Types.INTEGER));
tableDef.addTableItem(samples = new PamTableItem("Samples", Types.INTEGER));
tableDef.addTableItem(GPSPPSTime = new PamTableItem("GPSPPSTime", Types.TIMESTAMP));
tableDef.addTableItem(status = new PamTableItem("Status", Types.CHAR, 20));
tableDef.addTableItem(reason = new PamTableItem("Reason", Types.CHAR, 50));
tableDef.addTableItem(daqSystemType = new PamTableItem("SystemType", Types.CHAR, 50));
tableDef.addTableItem(daqSystemName = new PamTableItem("SystemName", Types.CHAR, 50));
tableDef.addTableItem(sampleRate = new PamTableItem("sampleRate", Types.INTEGER));
tableDef.addTableItem(nChannels = new PamTableItem("nChannels", Types.INTEGER));
tableDef.addTableItem(voltsPeak2Peak = new PamTableItem("voltsPeak2Peak", Types.DOUBLE));
tableDef.addTableItem(gain = new PamTableItem("gain", Types.REAL));
tableDef.addTableItem(duration = new PamTableItem("duration", Types.DOUBLE));
tableDef.addTableItem(clockError = new PamTableItem("clockError", Types.DOUBLE));
tableDef.addTableItem(serverTime = new PamTableItem("Server Time", Types.TIMESTAMP));
setTableDefinition(tableDef);
}
// @Override
// public PamTableDefinition getTableDefinition() {
// return tableDef;
// }
@Override
public void setTableData(SQLTypes sqlTypes, PamDataUnit pamDataUnit) {
DaqStatusDataUnit ds = (DaqStatusDataUnit) pamDataUnit;
AcquisitionParameters daqParameters = ds.getDaqParameters();
adcClockTime.setValue(sqlTypes.getTimeStamp(ds.getAdcMilliseconds()));
adcClockMillis.setValue((int)(ds.getAdcMilliseconds()%1000));
rawADCTime.setValue(sqlTypes.getTimeStamp(ds.getRawADCMillis()));
long s = ds.getSamples();
gSamples.setValue((long)(s/1000000000));
samples.setValue((long) (s%1000000000));
Long gT = ds.getGpsPPSMilliseconds();
if (gT == null) {
GPSPPSTime.setValue(null);
}
else {
GPSPPSTime.setValue(sqlTypes.getTimeStamp(gT));
}
status.setValue(ds.getStatus());
reason.setValue(ds.getReason());
daqSystemType.setValue(ds.getDaqSystemType());
daqSystemName.setValue(ds.getSystemName());
sampleRate.setValue(ds.getSampleRate());
nChannels.setValue(ds.getNChannels());
voltsPeak2Peak.setValue(ds.getVoltsPeak2Peak());
gain.setValue((float) daqParameters.getPreamplifier().getGain());
duration.setValue(ds.getSampleDuration());
clockError.setValue(ds.clockError);
Long sTime = ds.getServerTime();
if (sTime == null){
serverTime.setValue(null);
}
else {
serverTime.setValue(sqlTypes.getTimeStamp(sTime));
}
}
@Override
protected DaqStatusDataUnit createDataUnit(SQLTypes sqlTypes, long timeMilliseconds, int databaseIndex) {
// Debug.out.println("DaqStatusDataUnit sql Logging: " + PamCalendar.formatDateTime(timeMilliseconds) + " ADC: " +adcClockTime.getDeblankedStringValue() + " Samples: " + samples.getLongValue());
long adcClock ;
if (adcClockTime.getDeblankedStringValue()!=null) {
adcClock = SQLTypes.millisFromTimeStamp(adcClockTime.getValue());
}
else {
adcClock =-1;
}
Long adcRawClock = SQLTypes.millisFromTimeStamp(rawADCTime.getValue());
if (adcRawClock == null) {
adcRawClock = 0L;
}
//long adcClockMillisVal = adcClockMillis.getLongValue();
long gpsPPSClock ;
if (GPSPPSTime.getDeblankedStringValue()!=null) {
gpsPPSClock = SQLTypes.millisFromTimeStamp(GPSPPSTime.getValue());
}
else {
gpsPPSClock=1;
}
Long samplesVal = samples.getLongValue();
String reasonVal = reason.getDeblankedStringValue();
String statusVal = status.getDeblankedStringValue();
double clockErrVal = clockError.getDoubleValue();
double durationValue = duration.getDoubleValue();
String systemName = daqSystemName.getStringValue();
// DaqStatusDataUnit(long timeMilliseconds, long adcMilliseconds, long samples, Long gpsPPSMillis,
// String status, String reason,
// AcquisitionParameters daqParameters, double duration, double clockError)
// Debug.out.println("DaqStatusDataUnit sql Logging: " + samplesVal);
DaqStatusDataUnit dataUnit = new DaqStatusDataUnit(timeMilliseconds, adcClock, adcRawClock, samplesVal, gpsPPSClock,
statusVal, reasonVal, null, systemName, durationValue, clockErrVal) ;
return dataUnit;
}
}

View File

@ -0,0 +1,338 @@
package Acquisition;
import hfDaqCard.SmruDaqSystem;
import java.io.Serializable;
import java.lang.reflect.Field;
import Acquisition.gpstiming.PPSParameters;
import Array.Preamplifier;
import PamController.PamController;
import PamModel.parametermanager.ManagedParameters;
import PamModel.parametermanager.PamParameterSet;
import PamModel.parametermanager.PrivatePamParameterData;
import PamguardMVC.PamConstants;
public class AcquisitionParameters implements Serializable, Cloneable, ManagedParameters {
static final long serialVersionUID = 2;
String daqSystemType = "Sound Card";
public float sampleRate = 48000;
public int nChannels = 2;
public double voltsPeak2Peak = 5;
private transient boolean isNetReceive;
/**
* List of channels data are acquired from (not necessarily 0,1,2, etc.)
* With NI boards, this has become a pain since if multiple boards are
* used, there may be repeats within this list.
*/
private int channelList[];// = new int[PamConstants.MAX_CHANNELS]; //Xiao Yan Deng
public Preamplifier preamplifier = new Preamplifier(0, new double[] {0, 20000});
/**
* Hydrophone list is a short list of length equal to the number of channels, so if
* your channel list does not start at zero, you have to first use the
* channelListIndexes before using this lookup table.
*/
private int[] hydrophoneList;
/**
* list of indexes for each hardware channel in channelList (i.e. opposite LUT)
*/
transient int[] channelListIndexes;
private PPSParameters ppsParameters;
public boolean subtractDC;
public double dcTimeConstant; // time constant for DC subtraction in seconds.
public AcquisitionParameters() {
getHardwareChannelList(); // automatically create a channellist.
/*
* this won't work since the constructor is only ever called for a new config, so if an old
* config is loaded, this will never be called.
*/
isNetReceive = PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER;
}
@Override
public AcquisitionParameters clone() {
try {
AcquisitionParameters ap = (AcquisitionParameters) super.clone();
if (ap.preamplifier != null) {
ap.preamplifier = ap.preamplifier.clone();
}
/*
* Automatically convert the old SMRU daq system name into the new SAIL name
*/
if (ap.daqSystemType != null && SmruDaqSystem.oldCardName.equals(ap.daqSystemType)) {
ap.daqSystemType = SmruDaqSystem.newCardName;
}
ap.isNetReceive = PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER;
if (ap.ppsParameters == null) {
ap.ppsParameters = new PPSParameters();
}
else {
ap.ppsParameters = ap.ppsParameters.clone();
}
if (ap.dcTimeConstant <= 0) {
ap.dcTimeConstant = 1.;
}
return ap;
}
catch (CloneNotSupportedException Ex) {
Ex.printStackTrace();
}
return null;
}
public String getDaqSystemType() {
return daqSystemType;
}
public void setDaqSystemType(String daqSystemType) {
this.daqSystemType = daqSystemType;
}
/**
* Gets a list of hydrophones from channel Indexes (not channel numbers)
* @return list of hydrophones.
*/
public int[] getHydrophoneList() {
if ((hydrophoneList == null || hydrophoneList.length < nChannels) && nChannels > 0) {
hydrophoneList = new int[nChannels];
for (int i = 0; i < nChannels; i++) {
hydrophoneList[i] = i;
}
}
return hydrophoneList;
}
/**
* Set a hydrophone list.
* @param hydrophoneList
*/
public void setHydrophoneList(int[] hydrophoneList) {
this.hydrophoneList = hydrophoneList;
}
/**
* Gets a hydrophone number from a channel number (not channel index)
* @param channel software channel number
* @return a specific hydrophone number from the selected array
*/
public int getHydrophone(int channel) {
if (isNetReceive) {
return channel;
}
// first convert the software channel to a channel index (i.e.
// if we're reading ch 4 and 5, convert to 0 or 1.
if (hydrophoneList == null) {
hydrophoneList = getHydrophoneList();
}
if (channelListIndexes == null) {
sortChannelListIndexes();
}
if (channel < 0) {
return channel;
}
if (channelListIndexes.length <= channel) return -1;
// this line no longer needed now that software channels are alwasy 0,1,2,3
// even if hardware channels are more random.
// channel = this.channelListIndexes[channel];
//channel = this.channelListIndexes[channel];
if (channel < 0) {
return -1;
}
if (hydrophoneList.length <= channel) return -1;
return hydrophoneList[channel];
}
public int getNChannels() {
return nChannels;
}
public void setNChannels(int channels) {
nChannels = channels;
}
public int[] getNChannelList(){
return channelList;
}
public Preamplifier getPreamplifier() {
return preamplifier;
}
public void setPreamplifier(Preamplifier preamplifier) {
this.preamplifier = preamplifier;
}
public float getSampleRate() {
return sampleRate;
}
public void setSampleRate(float sampleRate) {
this.sampleRate = sampleRate;
}
public double getVoltsPeak2Peak() {
return voltsPeak2Peak;
}
public void setVoltsPeak2Peak(double voltsPeak2Peak) {
this.voltsPeak2Peak = voltsPeak2Peak;
}
/**
* Gets / creates a list of hardware channels used. <p>
* i.e. converts from channel indexes to channel numbers.
* @return List of channel numbers
*/
public int[] getHardwareChannelList() {
if (channelList == null || ((channelList.length < nChannels) && nChannels > 0)) {
int[] newChannelList = new int[PamConstants.MAX_CHANNELS];
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) {
newChannelList[i] = i;
}
// use old list numbers if they exist.
if (channelList != null) {
for (int i = 0; i < Math.min(nChannels, channelList.length); i++) {
newChannelList[i] = channelList[i];
}
}
// now replace the old with the new.
channelList = newChannelList;
}
return channelList;
}
public void setChannelList(int[] channelList) {
this.channelList = channelList;
sortChannelListIndexes();
}
public void setChannelList(int index, int channelNumber) {
getHardwareChannelList();
if (index >= channelList.length) {
return;
}
channelList[index] = channelNumber;
sortChannelListIndexes();
}
/**
* Creates a default channel list 0,1,2,3,4 etc.
*/
public void setDefaultChannelList() {
channelList = new int[PamConstants.MAX_CHANNELS];
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) {
channelList[i] = i;
}
sortChannelListIndexes();
}
/**
* Gets the channel number for a particular channel index.
* @param index channel index
* @return channel number
*/
public int getChannelList(int index) {
return getHardwareChannelList()[index];
}
/**
* Gets the complete list of channel indexes.
* @return list of channel indexes.
*/
public int[] getChannelListIndexes() {
if (channelListIndexes == null) {
sortChannelListIndexes();
}
return channelListIndexes;
}
/**
* Sets the channel list indeces
* @param channelListIndexes
*/
public void setChannelListIndexes(int[] channelListIndexes) {
this.channelListIndexes = channelListIndexes;
}
/**
* Gets the channel index for a particular hardware channel
* @param channel
* @return channel index or -1 if it doesn't exist.
*/
public int getChannelListIndexes(int channel) {
if (channelListIndexes == null) {
sortChannelListIndexes();
}
if (channel >= 0 && channel < channelListIndexes.length) {
return channelListIndexes[channel];
}
else return -1;
}
/**
* Creates a set of easily accessible channel indexes
* which can be used to convert from channel numbers to
* channel index e.g. used channel numbers might be 3 and 4
* so the listIndexes will be {-1 -1 -1 0 1]
*/
private void sortChannelListIndexes() {
int max = 0;
getHardwareChannelList();
for (int i = 0; i < nChannels; i++) {
max = Math.max(max, channelList[i]);
}
channelListIndexes = new int[max+1];
for (int i = 0; i < channelListIndexes.length; i++) {
channelListIndexes[i] = -1;
}
for (int i = 0; i < nChannels; i++) {
channelListIndexes[channelList[i]] = i;
}
}
// public void setChannelListIndexes(int[] channelListIndexes) {
// this.channelListIndexes = channelListIndexes;
// }
/**
* @return the ppsParameters
*/
public PPSParameters getPpsParameters() {
if (ppsParameters == null) {
ppsParameters = new PPSParameters();
}
return ppsParameters;
}
@Override
public PamParameterSet getParameterSet() {
PamParameterSet ps = PamParameterSet.autoGenerate(this);
try {
Field field = this.getClass().getDeclaredField("channelList");
ps.put(new PrivatePamParameterData(this, field) {
@Override
public Object getData() throws IllegalArgumentException, IllegalAccessException {
return channelList;
}
});
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
return ps;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,88 @@
package Acquisition;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import PamDetection.RawDataUnit;
import PamUtils.PamUtils;
import PamguardMVC.PamConstants;
/**
* Better management of new data list.
* <p>
* This is a queue that sits between individual acquisition systems and
* the main Acquisition process. DAQ systems write data units into this list
* in their own thread and data are read out in a different thread.
* @author Doug Gillespie.
*
*/
public class AudioDataQueue {
private volatile List<RawDataUnit> newDataUnits;
private long samplesIn[] = new long[PamConstants.MAX_CHANNELS];
private long samplesOut[] = new long[PamConstants.MAX_CHANNELS];
public AudioDataQueue() {
newDataUnits = Collections.synchronizedList(new LinkedList<RawDataUnit>());
}
public synchronized void clearList() {
newDataUnits.clear();
for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) {
samplesIn[i] = samplesOut[i] = 0;
}
}
public synchronized boolean hasData() {
return !newDataUnits.isEmpty();
}
public synchronized int getQueueSize() {
return newDataUnits.size();
}
public synchronized RawDataUnit removeOldest() {
RawDataUnit ru = newDataUnits.remove(0);
if (ru != null) {
int chan = PamUtils.getSingleChannel(ru.getChannelBitmap());
samplesOut[chan] += ru.getSampleDuration();
}
return ru;
}
public void addNewData(RawDataUnit newDataUnit) {
addNewData(newDataUnit, PamUtils.getSingleChannel(newDataUnit.getChannelBitmap()));
}
public synchronized void addNewData(RawDataUnit newDataUnit, int channel) {
samplesIn[channel] += newDataUnit.getSampleDuration();
newDataUnits.add(newDataUnit);
}
/**
* Get the total number of samples in the data queue based on the difference between
* the last sample put in and the last taken out.
* @param channel channel number
* @return number of stored samples in queue
*/
public synchronized long getQueuedSamples(int channel) {
return samplesIn[channel] - samplesOut[channel];
}
/**
* @return the samplesIn
*/
public long getSamplesIn(int channel) {
return samplesIn[channel];
}
/**
* @return the samplesOut
*/
public long getSamplesOut(int channel) {
return samplesOut[channel];
}
}

View File

@ -0,0 +1,32 @@
package Acquisition;
abstract public class AudioFileFuncs {
public static final int FILE_OK = 0;
public static final int FILE_ERROR = 1;
public static final int FILE_REPAIRED = 2;
public static final int FILE_CANTREPAIR = 3;
public static final int FILE_DOESNTEXIST = 4;
public static final int FILE_CANTOPEN = 5;
public static final int FILE_UNKNOWNTYPE = 6;
public static String getMessage(int m) {
switch(m) {
case FILE_OK:
return "Ok";
case FILE_ERROR:
return "Error";
case FILE_REPAIRED:
return "Repaired";
case FILE_CANTREPAIR:
return "Can't Repair";
case FILE_DOESNTEXIST:
return "Doesn't Exist";
case FILE_CANTOPEN:
return "Can't Open";
case FILE_UNKNOWNTYPE:
return "Unknown Type";
}
return null;
}
}

View File

@ -0,0 +1,54 @@
package Acquisition;
import java.awt.Component;
import javafx.scene.Node;
/**
* Interface allowing individual devices to provide their
* own channel list panel. Some devices (such as sound cards)
* don't use this at all. ASIO cards use a standard concrete
* implementation. NI cards use a more sophisticated one
* whereby multiple devices may be used.
* @author Doug Gillespie
*
*/
public interface ChannelListPanel {
/**
*
* @return the component for the dialog panel.
*/
public Component getComponent();
/**
*
* @return the component for the dialog panel.
*/
public Node getNode();
/**
* Set the channel list.
* @param channelList channel list
*/
public void setParams(int[] channelList);
/**
*
* @return the channel list
*/
public int[] getChannelList();
/**
*
* @return true if the configuration seems to be valid (i.e. no repeated channels, etc)
*/
public boolean isDataOk();
/**
* Set the total number of channels to display.
* @param nChannels the total number of channels to display.
*/
public void setNumChannels(int nChannels);
}

View File

@ -0,0 +1,240 @@
package Acquisition;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Window;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.SwingWorker;
import javax.swing.border.TitledBorder;
import PamUtils.PamAudioFileFilter;
import PamView.dialog.PamDialog;
public class CheckWavFileHeaders extends PamDialog {
private static CheckWavFileHeaders singleInstance;
private FolderInputSystem folderInputSystem;
private JTextArea textArea;
// private JButton check, checkRepair;
private JProgressBar progressBar;
private int nFiles, nErrors, doneFiles;
private boolean subFolders;
private File folder;
private JLabel folderName;
private boolean running, ran;
private CheckFiles checkFilesWorker;
private ArrayList<File> allFiles = new ArrayList<File>();
private CheckWavFileHeaders(Window parentFrame) {
super(parentFrame, "Check File Headers", false);
JPanel top = new JPanel(new BorderLayout());
top.setBorder(new TitledBorder(""));
top.add(BorderLayout.NORTH, folderName = new JLabel(" "));
textArea = new JTextArea();
textArea.setEditable(false);
JScrollPane scrollPane = new JScrollPane(textArea);
scrollPane.setPreferredSize(new Dimension(322, 300));
top.add(BorderLayout.CENTER, scrollPane);
top.add(BorderLayout.SOUTH, progressBar = new JProgressBar());
setDialogComponent(top);
getOkButton().setText("Check and Repair");
getCancelButton().setText("Close");
}
public static void showDialog(Window parentWin, FolderInputSystem folderInputSystem) {
if (singleInstance == null || singleInstance.getOwner() != parentWin) {
singleInstance = new CheckWavFileHeaders(parentWin);
}
singleInstance.folderInputSystem = folderInputSystem;
singleInstance.setParams();
singleInstance.setVisible(true);
}
private void setParams() {
running = ran = false;
subFolders = folderInputSystem.getFolderInputParameters().subFolders;
if (subFolders) {
folderName.setText(folderInputSystem.getCurrentFolder() + " + sub folders");
}
else {
folderName.setText(folderInputSystem.getCurrentFolder());
}
folder = new File(folderInputSystem.getCurrentFolder());
textArea.setText(" ");
allFiles.clear();
nFiles = countFiles(folder);
progressBar.setValue(0);
progressBar.setMaximum(Math.max(nFiles, 1));
enableControls();
}
private void enableControls() {
getOkButton().setEnabled(nFiles > 0 & running == false && ran == false);
getCancelButton().setEnabled(running == false);
}
private int countFiles(File folder) {
int nF = 0;
File[] files = folder.listFiles(new PamAudioFileFilter());
if (files == null) return 0;
File file;
for (int i = 0; i < files.length; i++) {
file = files[i];
if (file.isDirectory() && subFolders) {
System.out.println(file.getAbsoluteFile());
nF += countFiles(file.getAbsoluteFile());
}
else if (file.isFile()) {
allFiles.add(file);
nF++;
}
}
return nF;
}
@Override
public void cancelButtonPressed() {
// TODO Auto-generated method stub
}
@Override
public boolean getParams() {
checkFiles();
return false;
}
private void checkFiles() {
running = true;
textArea.setText(String.format("Checking %d files ...\n", nFiles));
doneFiles = 0;
nErrors = 0;
enableControls();
checkFilesWorker = new CheckFiles();
checkFilesWorker.execute();
}
private void jobDone() {
running = false;
ran = true;
enableControls();
textArea.append(String.format("\n\n%d file headers contained errors", nErrors));
}
private void setProgressInfo(ProgressData progressData) {
progressBar.setValue(++doneFiles);
String msg = AudioFileFuncs.getMessage(progressData.headerError);
textArea.append(String.format("\n%s - %s", progressData.file.getName(), msg));
boolean problem = progressData.headerError != AudioFileFuncs.FILE_OK;
if (problem) {
nErrors++;
}
}
@Override
public void restoreDefaultSettings() {
// TODO Auto-generated method stub
}
/**
* Return true if there is an error
* @param aFile file to check, aif or wav
* @return true if there is an error
*/
private int checkFile(File aFile) {
if (aFile.exists() == false || aFile.isDirectory() == true) {
return AudioFileFuncs.FILE_DOESNTEXIST;
}
String fileName = aFile.getName();
// get the bit after the dot
int dotPos = fileName.lastIndexOf('.');
if (dotPos < 0) {
return AudioFileFuncs.FILE_UNKNOWNTYPE;
}
String fileEnd = fileName.substring(dotPos+1);
if (fileEnd.equalsIgnoreCase("wav")) {
return checkWavFile(aFile);
}
else if (fileEnd.equalsIgnoreCase("aif")) {
return checkAifFile(aFile);
}
return AudioFileFuncs.FILE_UNKNOWNTYPE;
}
private int checkAifFile(File file) {
// TODO Auto-generated method stub
return AudioFileFuncs.FILE_CANTOPEN;
}
private int checkWavFile(File aFile) {
return WavFileFuncs.checkHeader(aFile, true);
}
private class CheckFiles extends SwingWorker<Integer, ProgressData> {
@Override
protected Integer doInBackground() throws Exception {
/*
* need to loop over files again
* for each file, report on progress with it's name and
* whether or not it had an error
*/
int error;
File aFile;
for (int i = 0; i < allFiles.size(); i++) {
error = checkFile(aFile = allFiles.get(i));
publish(new ProgressData(aFile, error));
}
return null;
}
@Override
protected void done() {
super.done();
jobDone();
}
@Override
protected void process(List<ProgressData> progressData) {
for (int i = 0; i < progressData.size(); i++) {
setProgressInfo(progressData.get(i));
}
}
}
private class ProgressData {
File file;
int headerError;
public ProgressData(File file, int headerError) {
super();
this.file = file;
this.headerError = headerError;
}
}
}

View File

@ -0,0 +1,52 @@
package Acquisition;
import PamguardMVC.ChannelListManager;
/**
* Class for converting channel indexes and numbers to hydrophones
* for the main PAMGAURD DAQ.
* <p>
* All these functions are passed through to the AcquisitionParameters class
* but these ones are better organised and therefore much easier to use than
* the total mess in the AcquisitionParameters class
* @author Doug Gillespie
* @see AcquisitionParameters
*
*/
public class DAQChannelListManager extends ChannelListManager {
private AcquisitionControl acquisitionControl;
public DAQChannelListManager(AcquisitionControl acquisitionControl) {
this.acquisitionControl = acquisitionControl;
}
// @Override
// public int channelIndexToNumber(int channelIndex) {
//
// return acquisitionControl.acquisitionParameters.getChannelList(channelIndex);
//
// }
@Override
public int channelIndexToPhone(int channelIndex) {
int[] phoneList = acquisitionControl.acquisitionParameters.getHydrophoneList();
if (channelIndex >= phoneList.length) {
return -1;
}
else {
return phoneList[channelIndex];
}
}
// @Override
// public int channelNumberToIndex(int channelNumber) {
// return acquisitionControl.acquisitionParameters.getChannelListIndexes(channelNumber);
// }
//
// @Override
// public int channelNumberToPhone(int channelNumber) {
// return acquisitionControl.acquisitionParameters.getHydrophone(channelNumber);
// }
}

View File

@ -0,0 +1,37 @@
package Acquisition;
/**
* Class to remove DC offset from audio data.
* @author Douglas Gillespie
*
*/
public class DCFilter {
private double sampleRate;
private double timeConstant;
private int nChannels;
private double[] background;
private double alpha;
public DCFilter(double sampleRate, double timeConstant, int nChannels) {
this.sampleRate = sampleRate;
this.timeConstant = timeConstant;
this.nChannels = nChannels;
background = new double[nChannels];
alpha = 1-1./(sampleRate*timeConstant);
}
public void filterData(int channel, double[] data) {
double x;
double b = background[channel];
for (int i = 0; i < data.length; i++) {
x = data[i]-b;
b = data[i] - alpha*x;
data[i] = x;
// x = data[i] - b;
// b = b*alpha + (1.-alpha)*data[i];
// data[i] = x;
}
background[channel] = b;
}
}

View File

@ -0,0 +1,92 @@
package Acquisition;
import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
//import com.sun.org.apache.xerces.internal.dom.DocumentImpl;
import PamController.PamSettings;
import PamUtils.XMLUtils;
public class DCL5System extends FolderInputSystem implements PamSettings {
// public DCL5System() {
// super();
// PamSettingManager.getInstance().registerSettings(this);
// }
String xmlDocName = "C:\\DCL_5_2011\\Matlab\\SpeciesFiletimes2.xml";
Document doc;
public DCL5System(AcquisitionControl acquisitionControl) {
super(acquisitionControl);
// TODO Auto-generated constructor stub
}
@Override
public String getSystemType() {
return "DCL5 file folder or multiple files";
}
@Override
public String getUnitName() {
return "DCL5 Folder Analysis";
}
@Override
public String getUnitType() {
return "DCL5 Folder Acquisition System";
}
@Override
public long getFileStartTime(File file) {
if (doc == null) {
doc = XMLUtils.createBlankDoc();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
//Using factory get an instance of document builder
DocumentBuilder db = dbf.newDocumentBuilder();
//parse using builder to get DOM representation of the XML file
doc = db.parse(xmlDocName);
}
catch (Exception e) {
e.printStackTrace();
return 0;
}
}
NodeList nl = doc.getElementsByTagName("files");
Element fileEl = (Element) nl.item(0);
// Element fileEl = doc.getElementById("files");
// Element aFileEl;
// aFileEl.getElementsByTagName(file.getName());
NodeList nl2 = fileEl.getElementsByTagName(file.getName());
if (nl2 == null) {
System.out.println("Unble to find time for file " + file.getName());
return 0;
}
Element e = (Element) nl2.item(0);
if (e == null) {
System.out.println("Unble to find time for file " + file.getName());
return 0;
}
String timeString = e.getAttribute("time");
return super.getFileStartTime(new File(timeString));
/*
* Get the file time from the XML document.
*/
// return super.getFileStartTime(file);
}
}

View File

@ -0,0 +1,154 @@
package Acquisition;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.io.File;
import java.io.IOException;
import Array.Preamplifier;
import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import binaryFileStorage.BinaryDataSource;
import binaryFileStorage.BinaryHeader;
import binaryFileStorage.BinaryObjectData;
import binaryFileStorage.ModuleFooter;
import binaryFileStorage.ModuleHeader;
import binaryFileStorage.PackedBinaryObject;
public class DaqStatusBinaryStore extends BinaryDataSource {
private PamDataBlock<DaqStatusDataUnit> daqStatusDataBlock;
private AcquisitionControl acquisitionControl;
private DaqStatusModuleHeader moduleHeader;
public DaqStatusBinaryStore(PamDataBlock<DaqStatusDataUnit> daqStatusDataBlock, AcquisitionControl acquisitionControl) {
super(daqStatusDataBlock, false);
this.daqStatusDataBlock = daqStatusDataBlock;
this.acquisitionControl= acquisitionControl;
}
@Override
public String getStreamName() {
return "DAQStatus";
}
@Override
public int getStreamVersion() {
return 1;
}
@Override
public int getModuleVersion() {
return 1;
}
@Override
public byte[] getModuleHeaderData() {
// TODO Auto-generated method stub
return null;
}
@Override
public PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion) {
ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(),
0, binaryObjectData.getDataLength());
DataInputStream dis = new DataInputStream(bis);
long adcMilliseconds = 0;
long samples = 0;
Long gpsPPSMillis = null;
short status = 0;
short reason = 0;
float clockError = 0;
String systemName = null;
try {
adcMilliseconds = dis.readLong();
samples = dis.readLong();
gpsPPSMillis = dis.readLong();
if (gpsPPSMillis == 0) {
// zero must be intrpreted as null (no data) or it can screw up some time corrections in the
// network receiver.
gpsPPSMillis = null;
}
status = dis.readShort();
reason = dis.readShort();
clockError = dis.readFloat();
dis.close();
} catch (IOException e) {
e.printStackTrace();
}
String daqSystemType = "unknown";
float sampleRate = 0;
int channels = 0;
double voltsPeak2Peak = 0;
double duration = 0;
if (moduleHeader != null) {
daqSystemType = moduleHeader.daqName;
sampleRate = moduleHeader.sampleRate;
channels = moduleHeader.channelMap;
voltsPeak2Peak = moduleHeader.voltsPeakToPeak;
duration = samples / sampleRate;
}
else {
// in NetRX mode will need to take this from the configuration
daqSystemType = acquisitionControl.acquisitionParameters.daqSystemType;
sampleRate = acquisitionControl.acquisitionParameters.getSampleRate();
channels = PamUtils.PamUtils.makeChannelMap(acquisitionControl.acquisitionParameters.nChannels);
voltsPeak2Peak = acquisitionControl.acquisitionParameters.voltsPeak2Peak;
}
AcquisitionParameters daqParams = new AcquisitionParameters();
daqParams.setVoltsPeak2Peak(voltsPeak2Peak);
daqParams.setPreamplifier(new Preamplifier(0, null));
daqParams.setSampleRate(sampleRate);
daqParams.setDaqSystemType(daqSystemType);
/**
* Only used in netrx mode and doesn't handle corrected milliseconds.
*/
DaqStatusDataUnit dsdu = new DaqStatusDataUnit(binaryObjectData.getTimeMilliseconds(),
adcMilliseconds, adcMilliseconds, samples, gpsPPSMillis, (new Short(status)).toString(),
(new Short(reason)).toString(), daqParams, null, duration, clockError);
return dsdu;
}
@Override
public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh) {
ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(),
0, binaryObjectData.getDataLength());
DataInputStream dis = new DataInputStream(bis);
moduleHeader = new DaqStatusModuleHeader(bh.getHeaderFormat());
try {
moduleHeader.daqName = dis.readUTF();
moduleHeader.sampleRate = dis.readFloat();
moduleHeader.channelMap = dis.readInt();
moduleHeader.voltsPeakToPeak = dis.readFloat();
dis.close();
} catch (IOException e) {
e.printStackTrace();
}
return moduleHeader;
}
@Override
public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh,
ModuleHeader moduleHeader) {
// TODO Auto-generated method stub
return null;
}
@Override
public BinaryObjectData getPackedData(PamDataUnit pamDataUnit) {
// TODO Auto-generated method stub
return null;
}
@Override
public void newFileOpened(File outputFile) {
// TODO Auto-generated method stub
}
}

Some files were not shown because too many files have changed in this diff Show More