SDRplay API

All source class files are auto-created from sdrplay api header files using JDK 22 jextract tool:

Version 3.07 is the oldest supported version.  Versions 3.08 through 3.14 are all functionally equivalent and
versions 3.15+ are functionally equivalent.

We use the jextract tool to generate java source files from the API include files that are located in
the /artifacts directory.

With each new JDK release where they change something about the Foreign Function api, we have to regenerate
the java source files.  My approach is to generate the java files into the source code directories alongside
the existing source files and then delete the existing files and rename the parent version package to the
same as was used by the existing classes so that we don't cause problems in any of the derivative classes.

If you need to find the SDRPlay API header/include files:
1. Install the sdrplay api
2. On Linux, headers are located here: /usr/local/include/*.h
3. On Windows, headers are located here: c:\Program Files\SDRPlay\api

Generate Source Files from SDRPlay API Headers
- Download latest jextract tool and alias the jextract command.
- cd into the (project)/jSDRplay/sdrplay-api/src/main/java/ directory

Note: each version is auto-generated with a _1 suffix to avoid overwriting the existing implementation.  Then,
you can just delete the original implementation and rename the suffixed versions to remove the _1.  Then,
resolve any import or syntax errors to integrate the new auto-gen code into the existing codebase.

Version 3.07
- cd into the same folder where the v3.07 header files are located.
- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_07 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07_1/ sdrplay_api.h

Version 3.08
- cd into the same folder where the v3.08 header files are located.
- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h

Version 3.15 - Adds support for RSP dx2
- cd into the same folder where the v3.15 header files are located.
- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_15 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15_1/ sdrplay_api.h

As a final step, delete the original api version branches and rename each of the new api version branches to remove the _1 suffix.

Code Modifications: for each version, modify the sdrplay_api_h.java class to wrap the SYMBOL_LOOKUP variable using the
following changes, so that the code doesn't throw an error on systems that don't have the API installed:

    //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library
    static SymbolLookup SYMBOL_LOOKUP;
    static
    {
        try
        {
            SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA)
                    .or(SymbolLookup.loaderLookup())
                    .or(Linker.nativeLinker().defaultLookup());
        }
        catch(Exception e)
        {
            if(SDRPlayLibraryHelper.LOADED_FROM_PATH)
            {
                try
                {
                    SYMBOL_LOOKUP = SymbolLookup.libraryLookup(SDRPlayLibraryHelper.LIBRARY_PATH, LIBRARY_ARENA)
                            .or(SymbolLookup.loaderLookup())
                            .or(Linker.nativeLinker().defaultLookup());
                }
                catch(Exception e2)
                {
                    SYMBOL_LOOKUP = null;
                }
            }
            else
            {
                SYMBOL_LOOKUP = null;
            }
        }
    }

... and add null checking to the findOrThrow() method ...
        if(SYMBOL_LOOKUP == null)
        {
            throw new UnsatisfiedLinkError("unresolved symbol:" + symbol);
        }


IntelliJ setup
1. Run configuration
2. JVM Option: --enable-native-access=ALL-UNNAMED
