Skip to content

DSheirer/jsdrplay

Repository files navigation

jsdrplay

Java wrapper for SDRplay API

Note: this is a work in progress and is not yet released.

Requirements

Supported API Version(s):

Supported Operating Systems:

  • Linux, MacOS, and Windows.

JDK 18 Project Panama

This library uses the new incubator features from JDK 18 JEP 419 Project Panama and the jextract tool to auto-generate java code to interface with native libararies. The jextract tool generates code from the native header file:

Generating Source Code

  1. Install the sdrplay api
  2. Locate the library headers.
    • Linux: /usr/local/include/*.h
    • Windows: C:\Program Files\SDRplay\API\inc*.h
    • MacOS: /usr/local/include/*.h
  3. cd into the library source directory: (project)/jsdrplay/sdrplay-api/src/main/java/
  4. Run: jextract -t io.github.dsheirer.sdrplay.api /usr/local/include/sdrplay_api.h -l libsdrplay_api --source

Note: the jextract auto-generated code includes a class RuntimeHelper that loads the library from the default system path. The sdrplay api is installed to a non-default location and the auto-generated code can't find it. Until I can figure out how to make that work, I've added a workaround where the SDRPlay class explicitly loads the library from the installed location. The auto-generated RuntimeHelper library load call is manually commented out.

IntelliJ setup

  1. Run configuration
  2. JVM Options: --enable-native-access=ALL-UNNAMED,sdrplay.api,io.github.dsheirer.sdrplay -Djava.library.path=/usr/local/lib
  3. Add the sdrplay library location to the java.library.path:
    • Linux: /usr/local/lib
    • Windows: C:\Program Files\SDRplay\API\inc\
    • MacOS: ??

About

Java wrapper for SDRplay API using Project Panama foreign function/memory access (Java 17+)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published