#1955 Java JDK 22 and Gradle 8.10. Updates SDRPlay API to latest Project Panama FFM API changes. Increment app version to 0.6.1-beta2 (#1958)

Co-authored-by: Dennis Sheirer <dsheirer@github.com>
This commit is contained in:
Denny Sheirer
2024-08-31 08:03:34 -04:00
committed by GitHub
parent 130e59f4c1
commit 36e198eb1b
335 changed files with 30503 additions and 17919 deletions

View File

@@ -1,11 +1,12 @@
SDRplay API
All source class files are auto-created from sdrplay api header files using JDK 20 jextract tool:
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.11 are all functionally equivalent.
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 JDK 20 jextract tool to generate java source files from the API include files that are
located in the /arctifacts directory.
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
@@ -21,22 +22,42 @@ 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 lcoated.
- jextract --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08_1 -l libsdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h
- In the generated RuntimeHelper class, comment out this line: System.loadLibrary("libsdrplay_api");
- 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
Note: API include files are from a windows 10 installer, with the windows DLL aspects commented out.
- cd into the same folder where the v3.08 header files are located.
- jextract --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08_1 -l libsdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h
- In the generated RuntimeHelper class, comment out this line: System.loadLibrary("libsdrplay_api");
- 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)
{
SYMBOL_LOOKUP = null;
}
}
IntelliJ setup
1. Run configuration
2. JVM Option: --enable-native-access=ALL-UNNAMED
3. Add library location to the java.library.path:
Linux: /usr/local/lib
Windows: ??
MacOS: ??

View File

@@ -0,0 +1,123 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
package io.github.dsheirer.source.tuner.sdrplay.api;
import java.nio.file.Files;
import java.nio.file.Path;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Helper utility to load the SDRPlay API native library into the VM.
*
* Note: the jextract auto-generated code attempts to load the native library by simple library name without any path
* information. On Windows this can fail because the API library is not installed in the normal Windows library location
* and for some reason the system library VM option with the specific location that is passed in as an argument on
* the command line doesn't help the system loader to resolve the library path. So, we preemptively load the library
* here.
*/
public class SDRPlayLibraryHelper
{
private static final Logger mLog = LoggerFactory.getLogger(SDRPlayLibraryHelper.class);
private static final String SDRPLAY_API_LIBRARY_NAME = "sdrplay_api";
private static final String SDRPLAY_API_PATH_LINUX = "/usr/local/lib/libsdrplay_api.so";
private static final String SDRPLAY_API_PATH_MAC_OS = "/usr/local/lib/libsdrplay_api.dylib";
private static final String SDRPLAY_API_PATH_MAC_OS_ALTERNATE = "/usr/local/lib/libsdrplay_api.so";
private static final String SDRPLAY_API_PATH_WINDOWS = System.getenv("ProgramFiles") +
"\\SDRplay\\API\\" + (System.getProperty("sun.arch.data.model").contentEquals("64") ? "x64" : "x86") +
"\\" + SDRPLAY_API_LIBRARY_NAME;
private static final String JAVA_LIBRARY_PATH_KEY = "java.library.path";
public static final boolean LOADED = load();
/**
* Attempts to load the SDRPlay API library from the local system.
*
* @return true if library was loaded successfully.
*/
public static boolean load()
{
try
{
System.loadLibrary(SDRPLAY_API_LIBRARY_NAME);
return true;
}
catch(Throwable t)
{
String libraryPath = getSDRplayLibraryPath();
Path path = Path.of(libraryPath);
boolean exists = Files.exists(path);
if(exists)
{
try
{
System.load(libraryPath);
return true;
}
catch(Throwable t2)
{
mLog.warn("Unable to load SDRPlay API native library: " + libraryPath);
}
}
else
{
mLog.info("SDRPlay API native library not found at: " + libraryPath);
}
}
return false;
}
/**
* Identifies the java library path for the sdrplay api library at runtime.
*/
public static String getSDRplayLibraryPath()
{
if(SystemUtils.IS_OS_WINDOWS)
{
return SDRPLAY_API_PATH_WINDOWS;
}
else if(SystemUtils.IS_OS_LINUX)
{
return SDRPLAY_API_PATH_LINUX;
}
else if(SystemUtils.IS_OS_MAC_OSX)
{
//API versions 3.14 and earlier used a (.so) extension and 3.15 and later use the (.dylib) extension
if(Files.exists(Path.of(SDRPLAY_API_PATH_MAC_OS)))
{
return SDRPLAY_API_PATH_MAC_OS;
}
else
{
return SDRPLAY_API_PATH_MAC_OS_ALTERNATE;
}
}
mLog.error("Unrecognized operating system. Cannot identify sdrplay api library path");
return "";
}
public static void main(String[] args)
{
System.out.println("Loaded: " + SDRPlayLibraryHelper.LOADED);
}
}

View File

@@ -33,7 +33,7 @@ import io.github.dsheirer.source.tuner.sdrplay.api.error.ErrorInformation;
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.CompositeParameters;
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.CompositeParametersFactory;
import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceParamsT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ErrorInfoT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h;
import java.lang.foreign.Arena;
@@ -44,35 +44,21 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang3.SystemUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* SDRplay API wrapper.
*
* Note: the jextract auto-generated RuntimeHelper contains a static block that attempts to load the sdrplay_api
* library. This approach fails because the API is installed to a non-default location. Comment out the library
* load code in the RuntimeHelper and we'll directly load the library.
*
* // System.loadLibrary("libsdrplay_api");
*/
public class SDRplay
{
public static final String SDRPLAY_API_LIBRARY_NAME = "sdrplay_api";
public static final String SDRPLAY_API_PATH_LINUX = "/usr/local/lib/libsdrplay_api.so";
public static final String SDRPLAY_API_PATH_MAC_OS = "/usr/local/lib/libsdrplay_api.dylib";
public static final String SDRPLAY_API_PATH_WINDOWS = System.getenv("ProgramFiles") +
"\\SDRplay\\API\\" + (System.getProperty("sun.arch.data.model").contentEquals("64") ? "x64" : "x86") +
"\\" + SDRPLAY_API_LIBRARY_NAME;
public static final String JAVA_LIBRARY_PATH_KEY = "java.library.path";
private static final Logger mLog = LoggerFactory.getLogger(SDRplay.class);
/**
* Foreign memory arena allocation resource scope
* Foreign memory arena allocation resource scope. We use a shared arena with a lifetime bounded by the
* lifetime of this API.
*/
private final Arena mArena = Arena.openShared();
private final Arena mSharedArena = Arena.ofShared();
/**
* Indicates if libsdrplay_api.xx library was found and loaded.
@@ -105,28 +91,21 @@ public class SDRplay
*/
public SDRplay() throws SDRPlayException
{
mSdrplayLibraryLoaded = loadLibrary();
mSdrplayLibraryLoaded = SDRPlayLibraryHelper.LOADED;
if(mSdrplayLibraryLoaded)
{
Status openStatus = open();
if(sLibraryLoadStatusLogging)
{
mLog.info("API library - open status: " + openStatus);
}
mAvailable = openStatus.success() && getVersion().isSupported();
if(openStatus == Status.FAIL)
{
throw new SDRPlayException("Service not available");
throw new SDRPlayException("Service not available - open status: " + openStatus);
}
}
else
{
if(sLibraryLoadStatusLogging)
{
mLog.info("API library was not loaded");
}
mAvailable = false;
}
@@ -141,7 +120,14 @@ public class SDRplay
{
if(sLibraryLoadStatusLogging)
{
mLog.info("API library is not available.");
if(!getVersion().isSupported())
{
mLog.info("API library is not available - unsupported version: " + getVersion());
}
else
{
mLog.info("API library is not available.");
}
}
}
@@ -151,52 +137,9 @@ public class SDRplay
/**
* Open Shared Memory Arena for this API instance
*/
private Arena getArena()
private Arena getSharedArena()
{
return mArena;
}
/**
* Attempts to load the SDRPlay API library from the local system.
*
* @return true if library was loaded successfully.
*/
private boolean loadLibrary()
{
try
{
String libraryPath = getSDRplayLibraryPath();
if(sLibraryLoadStatusLogging)
{
mLog.info("Loading API Library from default install path: " + libraryPath);
}
System.loadLibrary(SDRPLAY_API_LIBRARY_NAME);
return true;
}
catch(Throwable t)
{
mLog.error("Unable to load SDRplay API library from default install path. Loading from java system library path");
try
{
System.loadLibrary(SDRPLAY_API_LIBRARY_NAME);
return true;
}
catch(Throwable t2)
{
String name = System.mapLibraryName(SDRPLAY_API_LIBRARY_NAME);
if(sLibraryLoadStatusLogging)
{
mLog.warn("SDRPlay API library not found/installed on this system. Ensure the API is installed either " +
"in the default install location or the install location is included in the " +
"'java.library.path' JVM property contains path to the library file [" + name +
"]. Current library path property contents: " + System.getProperty(JAVA_LIBRARY_PATH_KEY));
}
}
}
return false;
return mSharedArena;
}
/**
@@ -219,9 +162,9 @@ public class SDRplay
List<IDeviceStruct> deviceStructs = new ArrayList<>();
//Get a version-correct array of DeviceT structures
MemorySegment devicesArray = DeviceFactory.createDeviceArray(getVersion(), getArena());
MemorySegment devicesArray = DeviceFactory.createDeviceArray(getVersion(), getSharedArena());
MemorySegment deviceCount = getArena().allocate(ValueLayout.JAVA_INT, 0);
MemorySegment deviceCount = getSharedArena().allocate(ValueLayout.JAVA_INT);
Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDevices(devicesArray, deviceCount,
sdrplay_api_h.SDRPLAY_MAX_DEVICES()));
@@ -356,18 +299,22 @@ public class SDRplay
*/
public CompositeParameters getCompositeParameters(DeviceType deviceType, MemorySegment deviceHandle) throws SDRPlayException
{
//Allocate a pointer that the api will fill with the memory address of the device parameters in memory.
MemorySegment pointer = getArena().allocate(ValueLayout.ADDRESS);
Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDeviceParams(deviceHandle, pointer));
//The GetDeviceParams function call returns a C pointer-to-pointer so we have to:
// 1) Allocate native memory to receive the address
// 2) Invoke the method call
// 3) Reinterpret the address to 8-bytes so we can get the returned address value
// 4) Allocate a memory segment for that address
// 5) Reinterpret the memory segment to the size of the DeviceParamsT structure
// 6) Finally, wrap the native memory in a composite parameters instance
MemorySegment pointerToPointer = getSharedArena().allocate(ValueLayout.ADDRESS);
Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDeviceParams(deviceHandle, pointerToPointer));
if(status.success())
{
//Get the memory address from the pointer's memory segment to where the structure is located
MemorySegment memoryAddress = pointer.get(ValueLayout.ADDRESS, 0);
//The structure's memory is already allocated ... wrap a memory segment around it
MemorySegment memorySegment = sdrplay_api_DeviceT.ofAddress(memoryAddress, getArena().scope());
return CompositeParametersFactory.create(getVersion(), deviceType, memorySegment, getArena());
MemorySegment pointer = pointerToPointer.reinterpret(ValueLayout.ADDRESS.byteSize());
MemorySegment deviceParamsAddress = MemorySegment.ofAddress(pointer.get(ValueLayout.JAVA_LONG, 0));
MemorySegment deviceParams = deviceParamsAddress.reinterpret(sdrplay_api_DeviceParamsT.sizeof(), getSharedArena(), null);
return CompositeParametersFactory.create(getVersion(), deviceType, deviceParams, getSharedArena());
}
else
{
@@ -385,7 +332,7 @@ public class SDRplay
private void init(MemorySegment deviceHandle, MemorySegment callbackFunctions) throws SDRPlayException
{
//Since we don't need/use the callback context ... setup as a pointer to the callback functions
MemorySegment contextPointer = getArena().allocate(ValueLayout.ADDRESS, callbackFunctions);
MemorySegment contextPointer = Arena.ofAuto().allocate(ValueLayout.ADDRESS);
Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_Init(deviceHandle, callbackFunctions, contextPointer));
if(!status.success())
@@ -410,7 +357,7 @@ public class SDRplay
if(callbackFunctions == null)
{
callbackFunctions = new CallbackFunctions(getArena(), eventListener, streamListener,
callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener,
device.getStreamCallbackListener());
mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions);
}
@@ -439,7 +386,7 @@ public class SDRplay
if(callbackFunctions == null)
{
callbackFunctions = new CallbackFunctions(getArena(), eventListener, streamListener, streamListener,
callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener, streamListener,
device.getStreamCallbackListener());
mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions);
}
@@ -505,7 +452,7 @@ public class SDRplay
private ErrorInformation getLastError(MemorySegment deviceSegment)
{
MemorySegment errorAddress = sdrplay_api_h.sdrplay_api_GetLastError(deviceSegment);
MemorySegment errorSegment = sdrplay_api_ErrorInfoT.ofAddress(errorAddress, getArena().scope());
MemorySegment errorSegment = errorAddress.reinterpret(sdrplay_api_ErrorInfoT.layout().byteSize(), getSharedArena(), null);
return new ErrorInformation(errorSegment);
}
@@ -559,7 +506,7 @@ public class SDRplay
* Closes the API service. MUST be invoked before shutdown, after all SDRPlay API operations are completed.
*
* Note: when using multiple instances of this class, only invoke close() on a single instance. With linux API
* version 3.07, if you invoked close() on one instance, then all of the other instances become unusable for
* version 3.07, if you invoked close() on one instance, then all other instances become unusable for
* performing device operations (e.g. release(), etc). This may be an artifact of the way that the Java
* Foreign Function support is implemented, but not sure. dls 1-Jan-2023
*/
@@ -579,12 +526,14 @@ public class SDRplay
mLog.error("Error closing SDRPlay API");
}
getSharedArena().close();
mSdrplayLibraryLoaded = false;
mAvailable = false;
return closeStatus;
}
else
{
getSharedArena().close();
return Status.API_UNAVAILABLE;
}
}
@@ -602,7 +551,7 @@ public class SDRplay
{
if(mSdrplayLibraryLoaded)
{
MemorySegment apiVersion = getArena().allocate(ValueLayout.JAVA_FLOAT, 0);
MemorySegment apiVersion = getSharedArena().allocate(ValueLayout.JAVA_FLOAT);
Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_ApiVersion(apiVersion));
if(status.success())
{
@@ -665,28 +614,6 @@ public class SDRplay
}
}
/**
* Identifies the java library path for the sdrplay api library at runtime.
*/
public static String getSDRplayLibraryPath()
{
if(SystemUtils.IS_OS_WINDOWS)
{
return SDRPLAY_API_PATH_WINDOWS;
}
else if(SystemUtils.IS_OS_LINUX)
{
return SDRPLAY_API_PATH_LINUX;
}
else if(SystemUtils.IS_OS_MAC_OSX)
{
return SDRPLAY_API_PATH_MAC_OS;
}
mLog.error("Unrecognized operating system. Cannot identify sdrplay api library path");
return "";
}
public static void main(String[] args)
{
/**

View File

@@ -78,7 +78,7 @@ public enum UpdateReason
EXTENSION_RSP_DX_RF_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_RfNotchControl(), "RSPdx RF Notch Control"),
EXTENSION_RSP_DX_RF_DAB_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_RfDabNotchControl(), "RSPdx RF DAB Notch Control"),
EXTENSION_RSP_DX_HDR_BANDWIDTH(sdrplay_api_h.sdrplay_api_Update_RspDx_HdrBw(), "RSPdx HDR Bandwidth"),
EXTENSION_RSP_DUO_RESET_SLAVE_FLAGS(io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h.sdrplay_api_Update_RspDuo_ResetSlaveFlags(), "RSPDuo Reset Slave Flags"),
EXTENSION_RSP_DUO_RESET_SLAVE_FLAGS(io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h.sdrplay_api_Update_RspDuo_ResetSlaveFlags(), "RSPDuo Reset Slave Flags"),
EXTENSION_NONE(sdrplay_api_h.sdrplay_api_Update_Ext1_None(), "NONE"),

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -30,33 +30,36 @@ import java.lang.foreign.MemorySegment;
*/
public class CallbackFunctions
{
private DeviceEventAdapter mDeviceEventAdapter;
private StreamCallbackAdapter mStreamACallbackAdapter;
private StreamCallbackAdapter mStreamBCallbackAdapter;
private MemorySegment mCallbackFunctionsMemorySegment;
private final DeviceEventAdapter mDeviceEventAdapter;
private final StreamCallbackAdapter mStreamACallbackAdapter;
private final StreamCallbackAdapter mStreamBCallbackAdapter;
private final MemorySegment mCallbackFunctionsMemorySegment;
/**
* Constructs a callback functions for single-tuner use.
* @param longLifecycleArena for native memory allocation for long lifecycle objects.
* @param arena for native memory allocation for long lifecycle objects.
* @param deviceEventListener for device events
* @param streamListener for streaming samples
* @param streamCallbackListener for streaming events
*/
public CallbackFunctions(Arena longLifecycleArena, IDeviceEventListener deviceEventListener,
IStreamListener streamListener, IStreamCallbackListener streamCallbackListener)
public CallbackFunctions(Arena arena, IDeviceEventListener deviceEventListener, IStreamListener streamListener,
IStreamCallbackListener streamCallbackListener)
{
//Create the event callback function
mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener);
MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, longLifecycleArena.scope());
MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena);
//Create the stream A callback function
mStreamACallbackAdapter = new StreamCallbackAdapter(streamListener, streamCallbackListener);
MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, longLifecycleArena.scope());
MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena);
mStreamBCallbackAdapter = null;
//Create the callback functions union and populate the callback functions
mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(longLifecycleArena);
sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction);
sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction);
mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(arena);
sdrplay_api_CallbackFnsT.EventCbFn(mCallbackFunctionsMemorySegment, eventFunction);
sdrplay_api_CallbackFnsT.StreamACbFn(mCallbackFunctionsMemorySegment, streamAFunction);
// sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction);
// sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction);
}
/**
@@ -73,21 +76,24 @@ public class CallbackFunctions
{
//Create the event callback function
mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener);
MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena.scope());
MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena);
//Create the stream A callback function
mStreamACallbackAdapter = new StreamCallbackAdapter(streamAListener, streamCallbackListener);
MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena.scope());
MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena);
//Create the stream B callback function
mStreamBCallbackAdapter = new StreamCallbackAdapter(streamBListener, streamCallbackListener);
MemorySegment streamBFunction = sdrplay_api_StreamCallback_t.allocate(mStreamBCallbackAdapter, arena.scope());
MemorySegment streamBFunction = sdrplay_api_StreamCallback_t.allocate(mStreamBCallbackAdapter, arena);
//Create the callback functions union and populate the callback functions
mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(arena);
sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction);
sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction);
sdrplay_api_CallbackFnsT.StreamBCbFn$set(mCallbackFunctionsMemorySegment, streamBFunction);
sdrplay_api_CallbackFnsT.EventCbFn(mCallbackFunctionsMemorySegment, eventFunction);
sdrplay_api_CallbackFnsT.StreamACbFn(mCallbackFunctionsMemorySegment, streamAFunction);
sdrplay_api_CallbackFnsT.StreamBCbFn(mCallbackFunctionsMemorySegment, streamBFunction);
// sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction);
// sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction);
// sdrplay_api_CallbackFnsT.StreamBCbFn$set(mCallbackFunctionsMemorySegment, streamBFunction);
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -33,7 +33,7 @@ import org.slf4j.LoggerFactory;
* Adapter for Device Event callbacks. Implements foreign interface and transfers foreign memory event details to
* native Java and invokes the appropriate interface methods for an event listener.
*/
public class DeviceEventAdapter implements sdrplay_api_EventCallback_t
public class DeviceEventAdapter implements sdrplay_api_EventCallback_t.Function
{
private static final Logger mLog = LoggerFactory.getLogger(DeviceEventAdapter.class);
private IDeviceEventListener mDeviceEventListener;
@@ -65,44 +65,43 @@ public class DeviceEventAdapter implements sdrplay_api_EventCallback_t
public void apply(int eventTypeId, int tunerSelectId, MemorySegment eventParametersPointer,
MemorySegment callbackContext)
{
try(Arena arena = Arena.openConfined())
{
MemorySegment memorySegment = sdrplay_api_EventParamsT.ofAddress(eventParametersPointer, arena.scope());
EventType eventType = EventType.fromValue(eventTypeId);
TunerSelect tunerSelect = TunerSelect.fromValue(tunerSelectId);
//Use an auto arena to allow the garbage collector to deallocate, since we don't know if the device event
//listener will ever hold onto any object that is backed by our memory segment.
MemorySegment eventParams = eventParametersPointer.reinterpret(sdrplay_api_EventParamsT.sizeof(), Arena.ofAuto(), null);
EventType eventType = EventType.fromValue(eventTypeId);
TunerSelect tunerSelect = TunerSelect.fromValue(tunerSelectId);
switch(eventType)
switch(eventType)
{
case GAIN_CHANGE ->
{
case GAIN_CHANGE ->
{
mDeviceEventListener.processGainChange(tunerSelect,
EventParametersFactory.createGainCallbackParameters(memorySegment));
}
case POWER_OVERLOAD_CHANGE ->
{
mDeviceEventListener.processPowerOverload(tunerSelect,
EventParametersFactory.createPowerOverloadCallbackParameters(memorySegment));
}
case DEVICE_REMOVED ->
{
mDeviceEventListener.processDeviceRemoval(tunerSelect);
}
case RSP_DUO_MODE_CHANGE ->
{
mDeviceEventListener.processRspDuoModeChange(tunerSelect,
EventParametersFactory.createRspDuoModeCallbackParameters(memorySegment));
}
case UNKNOWN ->
{
mLog.warn("Unknown device event callback ignored. Please contact the library developer as this may " +
"indicate a change to the SDRPlay API change. Tuner:" + tunerSelect + " Event Type ID:" +
eventTypeId);
mDeviceEventListener.processEvent(eventType, tunerSelect);
}
default ->
{
throw new IllegalStateException("DeviceEventAdapter must be updated handle EventType." + eventType);
}
mDeviceEventListener.processGainChange(tunerSelect,
EventParametersFactory.createGainCallbackParameters(eventParams));
}
case POWER_OVERLOAD_CHANGE ->
{
mDeviceEventListener.processPowerOverload(tunerSelect,
EventParametersFactory.createPowerOverloadCallbackParameters(eventParams));
}
case DEVICE_REMOVED ->
{
mDeviceEventListener.processDeviceRemoval(tunerSelect);
}
case RSP_DUO_MODE_CHANGE ->
{
mDeviceEventListener.processRspDuoModeChange(tunerSelect,
EventParametersFactory.createRspDuoModeCallbackParameters(eventParams));
}
case UNKNOWN ->
{
mLog.warn("Unknown device event callback ignored. Please contact the library developer as this may " +
"indicate a change to the SDRPlay API change. Tuner:" + tunerSelect + " Event Type ID:" +
eventTypeId);
mDeviceEventListener.processEvent(eventType, tunerSelect);
}
default ->
{
throw new IllegalStateException("DeviceEventAdapter must be updated handle EventType." + eventType);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
* I/Q sample stream callback adapter. Implements the native interface and transfers the native callback data to an
* implementation of the Java IStreamListener interface.
*/
public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t
public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t.Function
{
private static final Logger mLog = LoggerFactory.getLogger(StreamCallbackAdapter.class);
private IStreamListener mStreamListener;
@@ -73,11 +73,11 @@ public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t
{
if(mStreamListener != null || mStreamCallbackListener != null)
{
try(Arena arena = Arena.openConfined())
try(Arena confinedArena = Arena.ofConfined())
{
//Translate the callback parameters pointer to a memory segment and re-construct the parameters as a Java object
StreamCallbackParameters parameters = new StreamCallbackParameters(sdrplay_api_StreamCbParamsT
.ofAddress(parametersPointer, arena.scope()));
MemorySegment memorySegment = parametersPointer.reinterpret(sdrplay_api_StreamCbParamsT.sizeof(), confinedArena, null);
StreamCallbackParameters parameters = new StreamCallbackParameters(memorySegment);
if(mStreamCallbackListener != null)
{
@@ -88,8 +88,10 @@ public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t
{
//Allocate memory segments from I/Q pointers, transfer from native to JVM array, and send to listener
long arrayByteSize = ValueLayout.JAVA_SHORT.byteSize() * sampleCount;
MemorySegment iSamples = MemorySegment.ofAddress(iSamplesPointer.address(), arrayByteSize, arena.scope());
MemorySegment qSamples = MemorySegment.ofAddress(qSamplesPointer.address(), arrayByteSize, arena.scope());
MemorySegment iSamples = iSamplesPointer.reinterpret(arrayByteSize, confinedArena, null);
MemorySegment qSamples = qSamplesPointer.reinterpret(arrayByteSize, confinedArena, null);
// MemorySegment iSamples = MemorySegment.ofAddress(iSamplesPointer.address(), arrayByteSize, confinedArena.scope());
// MemorySegment qSamples = MemorySegment.ofAddress(qSamplesPointer.address(), arrayByteSize, confinedArena.scope());
short[] i = iSamples.toArray(ValueLayout.JAVA_SHORT);
short[] q = qSamples.toArray(ValueLayout.JAVA_SHORT);
mStreamListener.processStream(i, q, parameters, Flag.evaluate(reset));

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,22 +28,22 @@ import java.lang.foreign.MemorySegment;
*/
public class StreamCallbackParameters
{
private int mFirstSampleNumber;
private boolean mGainReductionChanged;
private boolean mRfFrequencyChanged;
private boolean mSampleRateChanged;
private long mNumberSamples;
private final int mFirstSampleNumber;
private final boolean mGainReductionChanged;
private final boolean mRfFrequencyChanged;
private final boolean mSampleRateChanged;
private final long mNumberSamples;
/**
* Constructs an instance from the foreign memory segment
*/
public StreamCallbackParameters(MemorySegment memorySegment)
{
mFirstSampleNumber = sdrplay_api_StreamCbParamsT.firstSampleNum$get(memorySegment);
mGainReductionChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.grChanged$get(memorySegment));
mRfFrequencyChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.rfChanged$get(memorySegment));
mSampleRateChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.fsChanged$get(memorySegment));
mNumberSamples = sdrplay_api_StreamCbParamsT.numSamples$get(memorySegment);
mFirstSampleNumber = sdrplay_api_StreamCbParamsT.firstSampleNum(memorySegment);
mGainReductionChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.grChanged(memorySegment));
mRfFrequencyChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.rfChanged(memorySegment));
mSampleRateChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.fsChanged(memorySegment));
mNumberSamples = sdrplay_api_StreamCbParamsT.numSamples(memorySegment);
}
/**

View File

@@ -28,16 +28,12 @@ import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Factory methods for creating new RSP Device instances
*/
public class DeviceFactory
{
private static final Logger mLog = LoggerFactory.getLogger(DeviceFactory.class);
/**
* Creates a foreign memory segment for a DeviceT array, appropriate for the specified version.
* @param version value
@@ -81,7 +77,7 @@ public class DeviceFactory
* @param devicesArray memory segment
* @param count of device structures in the devicesArray.
* @return a list of device infos
* @throws exception if version is unrecognized or unsupported
* @throws SDRPlayException if version is unrecognized or unsupported
*/
public static List<IDeviceStruct> parseDeviceStructs(Version version, MemorySegment devicesArray, int count)
throws SDRPlayException
@@ -90,13 +86,13 @@ public class DeviceFactory
if(version.gte(Version.V3_08))
{
devicesArray.elements(sdrplay_api_DeviceT.$LAYOUT())
devicesArray.elements(sdrplay_api_DeviceT.layout())
.limit(count).forEach(memorySegment ->
deviceStructs.add(DeviceFactory.createDeviceStruct(version, memorySegment)));
}
else if(version == Version.V3_07)
{
devicesArray.elements(sdrplay_api_DeviceT.$LAYOUT()).limit(count).forEach(memorySegment ->
devicesArray.elements(sdrplay_api_DeviceT.layout()).limit(count).forEach(memorySegment ->
{
deviceStructs.add(DeviceFactory.createDeviceStruct(version, memorySegment));
});
@@ -112,7 +108,7 @@ public class DeviceFactory
/**
* Creates an SDRplay device from the foreign memory Device instance.
* @param sdrPlay for device callback support
* @param deviceMemorySegment instance for the device
* @param deviceStruct instance for the device
* @return correctly typed device
*/
public static Device createDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct)

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,9 +27,9 @@ import java.lang.foreign.MemorySegment;
*/
public class DeviceStruct_v3_07 implements IDeviceStruct
{
private MemorySegment mDeviceMemorySegment;
private DeviceType mDeviceType;
private String mSerialNumber;
private final MemorySegment mDeviceMemorySegment;
private final DeviceType mDeviceType;
private final String mSerialNumber;
/**
* Constructs an instance
@@ -38,9 +38,9 @@ public class DeviceStruct_v3_07 implements IDeviceStruct
public DeviceStruct_v3_07(MemorySegment deviceMemorySegment)
{
mDeviceMemorySegment = deviceMemorySegment;
mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer$get(mDeviceMemorySegment));
MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo$slice(mDeviceMemorySegment);
mSerialNumber = serialSegment.getUtf8String(0);
mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment));
MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment);
mSerialNumber = serialSegment.getString(0);
}
@Override public MemorySegment getDeviceMemorySegment()
@@ -60,18 +60,18 @@ public class DeviceStruct_v3_07 implements IDeviceStruct
@Override public TunerSelect getTunerSelect()
{
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment()));
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment()));
}
@Override public RspDuoMode getRspDuoMode()
{
return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode$get(getDeviceMemorySegment()));
return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment()));
}
@Override
public void setRspDuoMode(RspDuoMode mode)
{
sdrplay_api_DeviceT.rspDuoMode$set(getDeviceMemorySegment(), mode.getValue());
sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue());
}
@Override public boolean isValid()
@@ -82,17 +82,17 @@ public class DeviceStruct_v3_07 implements IDeviceStruct
@Override public double getRspDuoSampleFrequency()
{
return sdrplay_api_DeviceT.rspDuoSampleFreq$get(getDeviceMemorySegment());
return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment());
}
@Override
public void setRspDuoSampleFrequency(double frequency)
{
sdrplay_api_DeviceT.rspDuoSampleFreq$set(getDeviceMemorySegment(), frequency);
sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency);
}
@Override public MemorySegment getDeviceHandle()
{
return sdrplay_api_DeviceT.dev$get(getDeviceMemorySegment());
return sdrplay_api_DeviceT.dev(getDeviceMemorySegment());
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,9 +27,9 @@ import java.lang.foreign.MemorySegment;
*/
public class DeviceStruct_v3_08 implements IDeviceStruct
{
private MemorySegment mDeviceMemorySegment;
private DeviceType mDeviceType;
private String mSerialNumber;
private final MemorySegment mDeviceMemorySegment;
private final DeviceType mDeviceType;
private final String mSerialNumber;
/**
* Constructs an instance
@@ -38,9 +38,9 @@ public class DeviceStruct_v3_08 implements IDeviceStruct
public DeviceStruct_v3_08(MemorySegment deviceMemorySegment)
{
mDeviceMemorySegment = deviceMemorySegment;
mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer$get(mDeviceMemorySegment));
MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo$slice(mDeviceMemorySegment);
mSerialNumber = serialSegment.getUtf8String(0);
mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment));
MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment);
mSerialNumber = serialSegment.getString(0);
}
@Override public MemorySegment getDeviceMemorySegment()
@@ -60,18 +60,18 @@ public class DeviceStruct_v3_08 implements IDeviceStruct
@Override public TunerSelect getTunerSelect()
{
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment()));
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment()));
}
@Override public RspDuoMode getRspDuoMode()
{
return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode$get(getDeviceMemorySegment()));
return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment()));
}
@Override
public void setRspDuoMode(RspDuoMode mode)
{
sdrplay_api_DeviceT.rspDuoMode$set(getDeviceMemorySegment(), mode.getValue());
sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue());
}
@Override public boolean isValid()
@@ -82,17 +82,17 @@ public class DeviceStruct_v3_08 implements IDeviceStruct
@Override public double getRspDuoSampleFrequency()
{
return sdrplay_api_DeviceT.rspDuoSampleFreq$get(getDeviceMemorySegment());
return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment());
}
@Override
public void setRspDuoSampleFrequency(double frequency)
{
sdrplay_api_DeviceT.rspDuoSampleFreq$set(getDeviceMemorySegment(), frequency);
sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency);
}
@Override public MemorySegment getDeviceHandle()
{
return sdrplay_api_DeviceT.dev$get(getDeviceMemorySegment());
return sdrplay_api_DeviceT.dev(getDeviceMemorySegment());
}
}

View File

@@ -19,7 +19,7 @@
package io.github.dsheirer.source.tuner.sdrplay.api.device;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h;
/**
* RSP Device type
@@ -32,11 +32,11 @@ public enum DeviceType
RSP2(sdrplay_api_h.SDRPLAY_RSP2_ID(), "RSP2"),
RSPduo(sdrplay_api_h.SDRPLAY_RSPduo_ID(), "RSPduo"),
RSPdx(sdrplay_api_h.SDRPLAY_RSPdx_ID(), "RSPdx"),
RSPdxR2(sdrplay_api_h.SDRPLAY_RSPdx_R2_ID(), "RSPdxR2"),
RSPdxR2(sdrplay_api_h.SDRPLAY_RSPdxR2_ID(), "RSPdxR2"),
UNKNOWN(Integer.MIN_VALUE, "UNKNOWN");
private int mValue;
private String mDescription;
private final int mValue;
private final String mDescription;
DeviceType(int value, String description)
{

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -26,16 +26,12 @@ import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.RspDuoCom
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.IfMode;
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.LoMode;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceT;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* RSPduo Device
*/
public class RspDuoDevice extends Device<RspDuoCompositeParameters, RspDuoTuner>
{
private static final Logger mLog = LoggerFactory.getLogger(RspDuoDevice.class);
private RspDuoTuner mTuner;
/**
@@ -87,7 +83,7 @@ public class RspDuoDevice extends Device<RspDuoCompositeParameters, RspDuoTuner>
@Override
public TunerSelect getTunerSelect()
{
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment()));
return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment()));
}
/**
@@ -95,7 +91,7 @@ public class RspDuoDevice extends Device<RspDuoCompositeParameters, RspDuoTuner>
*/
public void setTunerSelect(TunerSelect tunerSelect)
{
sdrplay_api_DeviceT.tuner$set(getDeviceMemorySegment(), tunerSelect.getValue());
sdrplay_api_DeviceT.tuner(getDeviceMemorySegment(), tunerSelect.getValue());
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,20 +27,20 @@ import java.lang.foreign.MemorySegment;
*/
public class ErrorInformation
{
private String mFile;
private String mFunction;
private int mLine;
private String mMessage;
private final String mFile;
private final String mFunction;
private final int mLine;
private final String mMessage;
/**
* Constructs an instance from the foreign memory segment
*/
public ErrorInformation(MemorySegment memorySegment)
{
mFile = sdrplay_api_ErrorInfoT.file$slice(memorySegment).getUtf8String(0);
mFunction = sdrplay_api_ErrorInfoT.function$slice(memorySegment).getUtf8String(0);
mLine = sdrplay_api_ErrorInfoT.line$get(memorySegment);
mMessage = sdrplay_api_ErrorInfoT.message$slice(memorySegment).getUtf8String(0);
mFile = sdrplay_api_ErrorInfoT.file(memorySegment).getString(0);
mFunction = sdrplay_api_ErrorInfoT.function(memorySegment).getString(0);
mLine = sdrplay_api_ErrorInfoT.line(memorySegment);
mMessage = sdrplay_api_ErrorInfoT.message(memorySegment).getString(0);
}
public String getFile()

View File

@@ -26,6 +26,7 @@ import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.DeviceParame
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.DeviceParametersFactory;
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParameters;
import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParametersFactory;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ControlParamsT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DevParamsT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceParamsT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RxChannelParamsT;
@@ -34,37 +35,37 @@ import java.lang.foreign.MemorySegment;
/**
* Composite Device Parameters structure (sdrplay_api_DeviceParamsT) providing access to the device parameters and
* the tuner 1 parameters. Tuner 2 parameters are only accessible via the RSPduo sub-class implementation.
* the tuner 1 parameter. Tuner 2 parameters are only accessible via the RSPduo subclass implementation.
*
* Note: sub-class implementations will constrain access to the appropriate sub-structures of the DeviceParamsT
* Note: subclass implementations will constrain access to the appropriate sub-structures of the DeviceParamsT
* structure for each specific device.
*/
public class CompositeParameters<D extends DeviceParameters, T extends TunerParameters>
{
private D mDeviceParameters;
private T mTunerAParameters;
private ControlParameters mControlAParameters;
private final D mDeviceParameters;
private final T mTunerAParameters;
private final ControlParameters mControlAParameters;
/**
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param deviceType to create
* @param memorySegment for the composite structure in foreign memory
* @param deviceParamsT native memory sdrplay_api_DeviceParamsT structure
* @param arena for allocating additional memory segments for the sub-structures.
*/
public CompositeParameters(Version version, DeviceType deviceType, MemorySegment memorySegment, Arena arena)
public CompositeParameters(Version version, DeviceType deviceType, MemorySegment deviceParamsT, Arena arena)
{
MemorySegment parametersMemoryAddress = sdrplay_api_DeviceParamsT.devParams$get(memorySegment);
MemorySegment parametersMemorySegment = sdrplay_api_DevParamsT.ofAddress(parametersMemoryAddress, arena.scope());
mDeviceParameters = (D) DeviceParametersFactory.create(deviceType, parametersMemorySegment);
MemorySegment addressDevParams = sdrplay_api_DeviceParamsT.devParams(deviceParamsT);
MemorySegment devParams = addressDevParams.reinterpret(sdrplay_api_DevParamsT.sizeof(), arena, null);
mDeviceParameters = (D) DeviceParametersFactory.create(deviceType, devParams);
MemorySegment memoryAddressRxA = sdrplay_api_DeviceParamsT.rxChannelA$get(memorySegment);
MemorySegment memorySegmentRxA = sdrplay_api_RxChannelParamsT.ofAddress(memoryAddressRxA, arena.scope());
mTunerAParameters = (T) TunerParametersFactory.create(version, deviceType, memorySegmentRxA);
MemorySegment addressRxA = sdrplay_api_DeviceParamsT.rxChannelA(deviceParamsT);
MemorySegment rxA = addressRxA.reinterpret(sdrplay_api_RxChannelParamsT.sizeof(), arena, null);
mTunerAParameters = (T) TunerParametersFactory.create(version, deviceType, rxA);
MemorySegment tunerAControlParametersMemorySegment = sdrplay_api_RxChannelParamsT.ctrlParams$slice(memorySegmentRxA);
mControlAParameters = new ControlParameters(tunerAControlParametersMemorySegment);
MemorySegment tunerACtrlParams = rxA.asSlice(sdrplay_api_RxChannelParamsT.ctrlParams$offset(), sdrplay_api_ControlParamsT.sizeof());
mControlAParameters = new ControlParameters(tunerACtrlParams);
}
/**

View File

@@ -33,32 +33,32 @@ public class CompositeParametersFactory
* Creates a composite parameters instance for the specified device type
* @param version of the api
* @param deviceType to create
* @param memorySegment of foreign memory structure for the composite parameters
* @param deviceParams sdrplay_api_DeviceParamsT structure
* @param arena to allocate additional memory structures
* @return instance
*/
public static CompositeParameters create(Version version, DeviceType deviceType, MemorySegment memorySegment,
public static CompositeParameters create(Version version, DeviceType deviceType, MemorySegment deviceParams,
Arena arena)
{
switch(deviceType)
{
case RSP1 -> {
return new Rsp1CompositeParameters(version, memorySegment, arena);
return new Rsp1CompositeParameters(version, deviceParams, arena);
}
case RSP1A -> {
return new Rsp1aCompositeParameters(version, memorySegment, arena);
return new Rsp1aCompositeParameters(version, deviceParams, arena);
}
case RSP1B -> {
return new Rsp1bCompositeParameters(version, memorySegment, arena);
return new Rsp1bCompositeParameters(version, deviceParams, arena);
}
case RSP2 -> {
return new Rsp2CompositeParameters(version, memorySegment, arena);
return new Rsp2CompositeParameters(version, deviceParams, arena);
}
case RSPduo -> {
return new RspDuoCompositeParameters(version, memorySegment, arena);
return new RspDuoCompositeParameters(version, deviceParams, arena);
}
case RSPdx, RSPdxR2 -> {
return new RspDxCompositeParameters(version, memorySegment, arena);
return new RspDxCompositeParameters(version, deviceParams, arena);
}
}

View File

@@ -35,11 +35,11 @@ public class Rsp1CompositeParameters extends CompositeParameters<Rsp1DeviceParam
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams for the composite structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public Rsp1CompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public Rsp1CompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSP1, memorySegment, arena);
super(version, DeviceType.RSP1, deviceParams, arena);
}
}

View File

@@ -35,11 +35,11 @@ public class Rsp1aCompositeParameters extends CompositeParameters<Rsp1aDevicePar
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams for the composite structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public Rsp1aCompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public Rsp1aCompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSP1A, memorySegment, arena);
super(version, DeviceType.RSP1A, deviceParams, arena);
}
}

View File

@@ -37,11 +37,11 @@ public class Rsp1bCompositeParameters extends CompositeParameters<Rsp1aDevicePar
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams for the composite structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public Rsp1bCompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public Rsp1bCompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSP1B, memorySegment, arena);
super(version, DeviceType.RSP1B, deviceParams, arena);
}
}

View File

@@ -35,11 +35,11 @@ public class Rsp2CompositeParameters extends CompositeParameters<Rsp2DeviceParam
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams for the composite structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public Rsp2CompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public Rsp2CompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSP2, memorySegment, arena);
super(version, DeviceType.RSP2, deviceParams, arena);
}
}

View File

@@ -35,26 +35,26 @@ import java.lang.foreign.MemorySegment;
*/
public class RspDuoCompositeParameters extends CompositeParameters<RspDuoDeviceParameters, RspDuoTunerParameters>
{
private RspDuoTunerParameters mTunerBParameters;
private ControlParameters mControlBParameters;
private final RspDuoTunerParameters mTunerBParameters;
private final ControlParameters mControlBParameters;
/**
* Constructs an instance from the foreign memory segment
*
* @param version for constructing the correct version structure.
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public RspDuoCompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public RspDuoCompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSPduo, memorySegment, arena);
super(version, DeviceType.RSPduo, deviceParams, arena);
MemorySegment memoryAddressRxB = sdrplay_api_DeviceParamsT.rxChannelB$get(memorySegment);
MemorySegment memorySegmentRxB = sdrplay_api_RxChannelParamsT.ofAddress(memoryAddressRxB, arena.scope());
mTunerBParameters = (RspDuoTunerParameters) TunerParametersFactory.create(version, DeviceType.RSPduo, memorySegmentRxB);
MemorySegment addressRxChannelB = sdrplay_api_DeviceParamsT.rxChannelB(deviceParams);
MemorySegment rxChannelB = addressRxChannelB.reinterpret(sdrplay_api_RxChannelParamsT.sizeof(), arena, null);
mTunerBParameters = (RspDuoTunerParameters) TunerParametersFactory.create(version, DeviceType.RSPduo, rxChannelB);
MemorySegment tunerBControlParametersMemorySegment = sdrplay_api_RxChannelParamsT.ctrlParams$slice(memorySegmentRxB);
mControlBParameters = new ControlParameters(tunerBControlParametersMemorySegment);
MemorySegment rxChannelBCtrlParams = sdrplay_api_RxChannelParamsT.ctrlParams(rxChannelB);
mControlBParameters = new ControlParameters(rxChannelBCtrlParams);
}
/**

View File

@@ -35,11 +35,11 @@ public class RspDxCompositeParameters extends CompositeParameters<RspDxDevicePar
* Constructs an instance from the foreign memory segment
*
* @param version of the API
* @param memorySegment for the composite structure in foreign memory
* @param deviceParams for the composite structure in foreign memory
* @param arena for allocating additional memory segments for the sub-structures.
*/
public RspDxCompositeParameters(Version version, MemorySegment memorySegment, Arena arena)
public RspDxCompositeParameters(Version version, MemorySegment deviceParams, Arena arena)
{
super(version, DeviceType.RSPdx, memorySegment, arena);
super(version, DeviceType.RSPdx, deviceParams, arena);
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,7 +28,7 @@ import java.lang.foreign.MemorySegment;
*/
public class Agc
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from the foreign memory segment
@@ -51,7 +51,7 @@ public class Agc
*/
public AgcMode getAgcMode()
{
return AgcMode.fromValue(sdrplay_api_AgcT.enable$get(getMemorySegment()));
return AgcMode.fromValue(sdrplay_api_AgcT.enable(getMemorySegment()));
}
/**
@@ -59,7 +59,7 @@ public class Agc
*/
public void setAgcMode(AgcMode mode)
{
sdrplay_api_AgcT.enable$set(getMemorySegment(), mode.getValue());
sdrplay_api_AgcT.enable(getMemorySegment(), mode.getValue());
}
/**
@@ -67,7 +67,7 @@ public class Agc
*/
public int getSetPointDbfs()
{
return sdrplay_api_AgcT.setPoint_dBfs$get(getMemorySegment());
return sdrplay_api_AgcT.setPoint_dBfs(getMemorySegment());
}
/**
@@ -75,7 +75,7 @@ public class Agc
*/
public void setSetPointDbfs(int setPointDbfs)
{
sdrplay_api_AgcT.setPoint_dBfs$set(getMemorySegment(), setPointDbfs);
sdrplay_api_AgcT.setPoint_dBfs(getMemorySegment(), setPointDbfs);
}
/**
@@ -83,7 +83,7 @@ public class Agc
*/
public int getAttackMs()
{
return sdrplay_api_AgcT.attack_ms$get(getMemorySegment());
return sdrplay_api_AgcT.attack_ms(getMemorySegment());
}
/**
@@ -91,7 +91,7 @@ public class Agc
*/
public void setAttackMs(int attackMs)
{
sdrplay_api_AgcT.attack_ms$set(getMemorySegment(), (short)attackMs);
sdrplay_api_AgcT.attack_ms(getMemorySegment(), (short)attackMs);
}
/**
@@ -99,7 +99,7 @@ public class Agc
*/
public int getDecayMs()
{
return sdrplay_api_AgcT.decay_ms$get(getMemorySegment());
return sdrplay_api_AgcT.decay_ms(getMemorySegment());
}
/**
@@ -107,7 +107,7 @@ public class Agc
*/
public void setDecayMs(int decayMs)
{
sdrplay_api_AgcT.decay_ms$set(getMemorySegment(), (short)decayMs);
sdrplay_api_AgcT.decay_ms(getMemorySegment(), (short)decayMs);
}
/**
@@ -115,7 +115,7 @@ public class Agc
*/
public int getDecayDelayMs()
{
return sdrplay_api_AgcT.decay_delay_ms$get(getMemorySegment());
return sdrplay_api_AgcT.decay_delay_ms(getMemorySegment());
}
/**
@@ -123,7 +123,7 @@ public class Agc
*/
public void setDecayDelayMs(int decayDelayMs)
{
sdrplay_api_AgcT.decay_delay_ms$set(getMemorySegment(), (short)decayDelayMs);
sdrplay_api_AgcT.decay_delay_ms(getMemorySegment(), (short)decayDelayMs);
}
/**
@@ -131,7 +131,7 @@ public class Agc
*/
public int getDecayThresholdDb()
{
return sdrplay_api_AgcT.decay_threshold_dB$get(getMemorySegment());
return sdrplay_api_AgcT.decay_threshold_dB(getMemorySegment());
}
/**
@@ -139,7 +139,7 @@ public class Agc
*/
public void setDecayThresholdDb(int decayThresholdDb)
{
sdrplay_api_AgcT.decay_threshold_dB$set(getMemorySegment(), (short)decayThresholdDb);
sdrplay_api_AgcT.decay_threshold_dB(getMemorySegment(), (short)decayThresholdDb);
}
/**
@@ -148,6 +148,6 @@ public class Agc
public void setSynchronousUpdate(boolean syncUpdate)
{
//Note: this is supposed to be an integer value ... does it represent a boolean (0 or 1) or something else??
sdrplay_api_AgcT.syncUpdate$set(getMemorySegment(), Flag.of(syncUpdate));
sdrplay_api_AgcT.syncUpdate(getMemorySegment(), Flag.of(syncUpdate));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,28 +27,28 @@ import java.lang.foreign.MemorySegment;
*/
public class ControlParameters
{
private MemorySegment mMemorySegment;
private DcOffset mDcOffset;
private Decimation mDecimation;
private Agc mAgc;
private final MemorySegment mControlParams;
private final DcOffset mDcOffset;
private final Decimation mDecimation;
private final Agc mAgc;
/**
* Creates an instance from the foreign memory segment
*/
public ControlParameters(MemorySegment memorySegment)
public ControlParameters(MemorySegment controlParams)
{
mMemorySegment = memorySegment;
mDcOffset = new DcOffset(sdrplay_api_ControlParamsT.dcOffset$slice(memorySegment));
mDecimation = new Decimation(sdrplay_api_ControlParamsT.decimation$slice(memorySegment));
mAgc = new Agc(sdrplay_api_ControlParamsT.agc$slice(memorySegment));
mControlParams = controlParams;
mDcOffset = new DcOffset(sdrplay_api_ControlParamsT.dcOffset(controlParams));
mDecimation = new Decimation(sdrplay_api_ControlParamsT.decimation(controlParams));
mAgc = new Agc(sdrplay_api_ControlParamsT.agc(controlParams));
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getMemorySegment()
private MemorySegment getControlParams()
{
return mMemorySegment;
return mControlParams;
}
/**
@@ -80,7 +80,7 @@ public class ControlParameters
*/
public AdsbMode getAdsbMode()
{
return AdsbMode.fromValue(sdrplay_api_ControlParamsT.adsbMode$get(getMemorySegment()));
return AdsbMode.fromValue(sdrplay_api_ControlParamsT.adsbMode(getControlParams()));
}
/**
@@ -88,6 +88,6 @@ public class ControlParameters
*/
public void setAdsbMode(AdsbMode mode)
{
sdrplay_api_ControlParamsT.adsbMode$set(getMemorySegment(), mode.getValue());
sdrplay_api_ControlParamsT.adsbMode(getControlParams(), mode.getValue());
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,22 +28,22 @@ import java.lang.foreign.MemorySegment;
*/
public class DcOffset
{
private MemorySegment mMemorySegment;
private final MemorySegment mDCOffset;
/**
* Constructs an instance from the foreign memory segment
*/
public DcOffset(MemorySegment memorySegment)
public DcOffset(MemorySegment dCOffset)
{
mMemorySegment = memorySegment;
mDCOffset = dCOffset;
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getMemorySegment()
private MemorySegment getDCOffset()
{
return mMemorySegment;
return mDCOffset;
}
/**
@@ -51,7 +51,7 @@ public class DcOffset
*/
public boolean isDC()
{
return Flag.evaluate(sdrplay_api_DcOffsetT.DCenable$get(getMemorySegment()));
return Flag.evaluate(sdrplay_api_DcOffsetT.DCenable(getDCOffset()));
}
/**
@@ -59,7 +59,7 @@ public class DcOffset
*/
public void setDC(boolean enable)
{
sdrplay_api_DcOffsetT.DCenable$set(getMemorySegment(), Flag.of(enable));
sdrplay_api_DcOffsetT.DCenable(getDCOffset(), Flag.of(enable));
}
/**
@@ -67,7 +67,7 @@ public class DcOffset
*/
public boolean isIQ()
{
return Flag.evaluate(sdrplay_api_DcOffsetT.IQenable$get(getMemorySegment()));
return Flag.evaluate(sdrplay_api_DcOffsetT.IQenable(getDCOffset()));
}
/**
@@ -75,6 +75,6 @@ public class DcOffset
*/
public void setIQ(boolean enable)
{
sdrplay_api_DcOffsetT.IQenable$set(getMemorySegment(), Flag.of(enable));
sdrplay_api_DcOffsetT.IQenable(getDCOffset(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,7 +28,7 @@ import java.lang.foreign.MemorySegment;
*/
public class Decimation
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from the foreign memory segment
@@ -51,7 +51,7 @@ public class Decimation
*/
public boolean isEnabled()
{
return Flag.evaluate(sdrplay_api_DecimationT.enable$get(getMemorySegment()));
return Flag.evaluate(sdrplay_api_DecimationT.enable(getMemorySegment()));
}
/**
@@ -59,7 +59,7 @@ public class Decimation
*/
public void setEnabled(boolean enable)
{
sdrplay_api_DecimationT.enable$set(getMemorySegment(), Flag.of(enable));
sdrplay_api_DecimationT.enable(getMemorySegment(), Flag.of(enable));
}
/**
@@ -67,7 +67,7 @@ public class Decimation
*/
public int getDecimationFactor()
{
return sdrplay_api_DecimationT.decimationFactor$get(getMemorySegment());
return sdrplay_api_DecimationT.decimationFactor(getMemorySegment());
}
/**
@@ -75,7 +75,7 @@ public class Decimation
*/
public void setDecimationFactor(int decimationFactor)
{
sdrplay_api_DecimationT.decimationFactor$set(getMemorySegment(), (byte)decimationFactor);
sdrplay_api_DecimationT.decimationFactor(getMemorySegment(), (byte)decimationFactor);
}
/**
@@ -83,7 +83,7 @@ public class Decimation
*/
public boolean isWideBandSignal()
{
return Flag.evaluate(sdrplay_api_DecimationT.wideBandSignal$get(getMemorySegment()));
return Flag.evaluate(sdrplay_api_DecimationT.wideBandSignal(getMemorySegment()));
}
/**
@@ -91,6 +91,6 @@ public class Decimation
*/
public void setWideBandSignal(boolean enable)
{
sdrplay_api_DecimationT.wideBandSignal$set(getMemorySegment(), Flag.of(enable));
sdrplay_api_DecimationT.wideBandSignal(getMemorySegment(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,25 +27,29 @@ import java.lang.foreign.MemorySegment;
*/
public abstract class DeviceParameters
{
private MemorySegment mMemorySegment;
private SamplingFrequency mSamplingFrequency;
private SynchronousUpdate mSynchronousUpdate;
private ResetFlags mResetFlags;
private final MemorySegment mDevParams;
private final SamplingFrequency mSamplingFrequency;
private final SynchronousUpdate mSynchronousUpdate;
private final ResetFlags mResetFlags;
public DeviceParameters(MemorySegment memorySegment)
/**
* Constructs an instance.
* @param devParams for the DeviceParameters structure
*/
public DeviceParameters(MemorySegment devParams)
{
mMemorySegment = memorySegment;
mSamplingFrequency = new SamplingFrequency(sdrplay_api_DevParamsT.fsFreq$slice(memorySegment));
mSynchronousUpdate = new SynchronousUpdate(sdrplay_api_DevParamsT.syncUpdate$slice(memorySegment));
mResetFlags = new ResetFlags(sdrplay_api_DevParamsT.resetFlags$slice(memorySegment));
mDevParams = devParams;
mSamplingFrequency = new SamplingFrequency(sdrplay_api_DevParamsT.fsFreq(devParams));
mSynchronousUpdate = new SynchronousUpdate(sdrplay_api_DevParamsT.syncUpdate(devParams));
mResetFlags = new ResetFlags(sdrplay_api_DevParamsT.resetFlags(devParams));
}
/**
* Foreign memory segment for this device parameters instance
*/
protected MemorySegment getMemorySegment()
protected MemorySegment getDevParams()
{
return mMemorySegment;
return mDevParams;
}
/**
@@ -54,7 +58,7 @@ public abstract class DeviceParameters
*/
public double getPPM()
{
return sdrplay_api_DevParamsT.ppm$get(getMemorySegment());
return sdrplay_api_DevParamsT.ppm(getDevParams());
}
/**
@@ -63,7 +67,7 @@ public abstract class DeviceParameters
*/
public void setPPM(double ppm)
{
sdrplay_api_DevParamsT.ppm$set(getMemorySegment(), ppm);
sdrplay_api_DevParamsT.ppm(getDevParams(), ppm);
}
/**
@@ -95,7 +99,7 @@ public abstract class DeviceParameters
*/
public TransferMode getTransferMode()
{
return TransferMode.fromValue(sdrplay_api_DevParamsT.mode$get(getMemorySegment()));
return TransferMode.fromValue(sdrplay_api_DevParamsT.mode(getDevParams()));
}
/**
@@ -105,13 +109,13 @@ public abstract class DeviceParameters
{
if(transferMode != TransferMode.UNKNOWN)
{
sdrplay_api_DevParamsT.mode$set(getMemorySegment(), transferMode.getValue());
sdrplay_api_DevParamsT.mode(getDevParams(), transferMode.getValue());
}
}
public long getSamplesPerPacket()
{
return sdrplay_api_DevParamsT.samplesPerPkt$get(getMemorySegment());
return sdrplay_api_DevParamsT.samplesPerPkt(getDevParams());
}
@Override

View File

@@ -30,7 +30,7 @@ public class DeviceParametersFactory
/**
* Create a device parameters instance
* @param deviceType for the device
* @param memorySegment of foreign memory representing the device type
* @param memorySegment for an allocated sdrplay_api_DevParamsT structure
* @return instance
*/
public static DeviceParameters create(DeviceType deviceType, MemorySegment memorySegment)

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,7 +28,7 @@ import java.lang.foreign.MemorySegment;
*/
public class ResetFlags
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from a foreign memory segment and transfers the structure fields into this instance.
@@ -52,7 +52,7 @@ public class ResetFlags
*/
public void resetGain(boolean reset)
{
sdrplay_api_ResetFlagsT.resetGainUpdate$set(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
sdrplay_api_ResetFlagsT.resetGainUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
}
/**
@@ -60,7 +60,7 @@ public class ResetFlags
*/
public void resetFrequency(boolean reset)
{
sdrplay_api_ResetFlagsT.resetRfUpdate$set(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
sdrplay_api_ResetFlagsT.resetRfUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
}
/**
@@ -68,6 +68,6 @@ public class ResetFlags
*/
public void resetSampleRate(boolean reset)
{
sdrplay_api_ResetFlagsT.resetFsUpdate$set(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
sdrplay_api_ResetFlagsT.resetFsUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE);
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,10 +28,10 @@ public class Rsp1DeviceParameters extends DeviceParameters
{
/**
* Constructs an instance
* @param memorySegment for this structure
* @param devParams for an allocated sdrplay_api_DevParamsT structure
*/
public Rsp1DeviceParameters(MemorySegment memorySegment)
public Rsp1DeviceParameters(MemorySegment devParams)
{
super(memorySegment);
super(devParams);
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -29,24 +29,24 @@ import java.lang.foreign.MemorySegment;
*/
public class Rsp1aDeviceParameters extends DeviceParameters
{
private MemorySegment mRsp1AMemorySegment;
private final MemorySegment mRsp1aParams;
/**
* Constructs an instance
* @param memorySegment for this structure
* @param devParams for an allocated sdrplay_api_DevParamsT structure
*/
public Rsp1aDeviceParameters(MemorySegment memorySegment)
public Rsp1aDeviceParameters(MemorySegment devParams)
{
super(memorySegment);
mRsp1AMemorySegment = sdrplay_api_DevParamsT.rsp1aParams$slice(memorySegment);
super(devParams);
mRsp1aParams = sdrplay_api_DevParamsT.rsp1aParams(devParams);
}
/**
* Foreign memory segment representing this structure
*/
private MemorySegment getRsp1AMemorySegment()
private MemorySegment getRsp1aParams()
{
return mRsp1AMemorySegment;
return mRsp1aParams;
}
/**
@@ -54,7 +54,7 @@ public class Rsp1aDeviceParameters extends DeviceParameters
*/
public boolean isRFNotch()
{
return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfNotchEnable$get(getRsp1AMemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfNotchEnable(getRsp1aParams()));
}
/**
@@ -62,7 +62,7 @@ public class Rsp1aDeviceParameters extends DeviceParameters
*/
public void setRFNotch(boolean enable)
{
sdrplay_api_Rsp1aParamsT.rfNotchEnable$set(getRsp1AMemorySegment(), Flag.of(enable));
sdrplay_api_Rsp1aParamsT.rfNotchEnable(getRsp1aParams(), Flag.of(enable));
}
/**
@@ -70,7 +70,7 @@ public class Rsp1aDeviceParameters extends DeviceParameters
*/
public boolean isRfDabNotch()
{
return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$get(getRsp1AMemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfDabNotchEnable(getRsp1aParams()));
}
/**
@@ -78,6 +78,6 @@ public class Rsp1aDeviceParameters extends DeviceParameters
*/
public void setRfDabNotch(boolean enable)
{
sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$set(getRsp1AMemorySegment(), Flag.of(enable));
sdrplay_api_Rsp1aParamsT.rfDabNotchEnable(getRsp1aParams(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -29,24 +29,24 @@ import java.lang.foreign.MemorySegment;
*/
public class Rsp2DeviceParameters extends DeviceParameters
{
private MemorySegment mRsp2MemorySegment;
private final MemorySegment mRsp2Params;
/**
* Constructs an instance
* @param memorySegment for this structure
* @param devParams for an allocated sdrplay_api_DevParamsT structure
*/
public Rsp2DeviceParameters(MemorySegment memorySegment)
public Rsp2DeviceParameters(MemorySegment devParams)
{
super(memorySegment);
mRsp2MemorySegment = sdrplay_api_DevParamsT.rsp2Params$slice(memorySegment);
super(devParams);
mRsp2Params = sdrplay_api_DevParamsT.rsp2Params(devParams);
}
/**
* Foreign memory segment representing this structure
*/
private MemorySegment getRsp2MemorySegment()
private MemorySegment getRsp2Params()
{
return mRsp2MemorySegment;
return mRsp2Params;
}
/**
@@ -54,7 +54,7 @@ public class Rsp2DeviceParameters extends DeviceParameters
*/
public boolean isExternalReferenceOutput()
{
return Flag.evaluate(sdrplay_api_Rsp2ParamsT.extRefOutputEn$get(getRsp2MemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp2ParamsT.extRefOutputEn(getRsp2Params()));
}
/**
@@ -62,6 +62,6 @@ public class Rsp2DeviceParameters extends DeviceParameters
*/
public void setExternalReferenceOutput(boolean enable)
{
sdrplay_api_Rsp2ParamsT.extRefOutputEn$set(getRsp2MemorySegment(), Flag.of(enable));
sdrplay_api_Rsp2ParamsT.extRefOutputEn(getRsp2Params(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -29,24 +29,24 @@ import java.lang.foreign.MemorySegment;
*/
public class RspDuoDeviceParameters extends DeviceParameters
{
private MemorySegment mRspDuoMemorySegment;
private final MemorySegment mRspDuoParams;
/**
* Constructs an instance
* @param memorySegment for this structure
* @param devParams for an allocated sdrplay_api_DevParamsT structure
*/
public RspDuoDeviceParameters(MemorySegment memorySegment)
public RspDuoDeviceParameters(MemorySegment devParams)
{
super(memorySegment);
mRspDuoMemorySegment = sdrplay_api_DevParamsT.rspDuoParams$slice(memorySegment);
super(devParams);
mRspDuoParams = sdrplay_api_DevParamsT.rspDuoParams(devParams);
}
/**
* Foreign memory segment representing this structure
*/
private MemorySegment getRspDuoMemorySegment()
private MemorySegment getRspDuoParams()
{
return mRspDuoMemorySegment;
return mRspDuoParams;
}
/**
@@ -54,7 +54,7 @@ public class RspDuoDeviceParameters extends DeviceParameters
*/
public boolean isExternalReferenceOutput()
{
return Flag.evaluate(sdrplay_api_RspDuoParamsT.extRefOutputEn$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoParamsT.extRefOutputEn(getRspDuoParams()));
}
/**
@@ -62,6 +62,6 @@ public class RspDuoDeviceParameters extends DeviceParameters
*/
public void setExternalReferenceOutput(boolean enable)
{
sdrplay_api_RspDuoParamsT.extRefOutputEn$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoParamsT.extRefOutputEn(getRspDuoParams(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -30,23 +30,24 @@ import java.lang.foreign.MemorySegment;
*/
public class RspDxDeviceParameters extends DeviceParameters
{
private MemorySegment mRspDxMemorySegment;
private final MemorySegment mRspDxParams;
/**
* Constructs an instance from the foreign memory segment.
* @param devParams an allocated sdrplay_api_DevParamsT structure
*/
public RspDxDeviceParameters(MemorySegment memorySegment)
public RspDxDeviceParameters(MemorySegment devParams)
{
super(memorySegment);
mRspDxMemorySegment = sdrplay_api_DevParamsT.rspDxParams$slice(memorySegment);
super(devParams);
mRspDxParams = sdrplay_api_DevParamsT.rspDxParams(devParams);
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getRspDxMemorySegment()
private MemorySegment getRspDxParams()
{
return mRspDxMemorySegment;
return mRspDxParams;
}
/**
@@ -54,7 +55,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public boolean isHdr()
{
return Flag.evaluate(sdrplay_api_RspDxParamsT.hdrEnable$get(getRspDxMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDxParamsT.hdrEnable(getRspDxParams()));
}
/**
@@ -62,7 +63,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public void setHdr(boolean enable)
{
sdrplay_api_RspDxParamsT.hdrEnable$set(getRspDxMemorySegment(), Flag.of(enable));
sdrplay_api_RspDxParamsT.hdrEnable(getRspDxParams(), Flag.of(enable));
}
/**
@@ -70,7 +71,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public boolean isBiasT()
{
return Flag.evaluate(sdrplay_api_RspDxParamsT.biasTEnable$get(getRspDxMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDxParamsT.biasTEnable(getRspDxParams()));
}
/**
@@ -78,7 +79,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public void setBiasT(boolean enable)
{
sdrplay_api_RspDxParamsT.biasTEnable$set(getRspDxMemorySegment(), Flag.of(enable));
sdrplay_api_RspDxParamsT.biasTEnable(getRspDxParams(), Flag.of(enable));
}
/**
@@ -86,7 +87,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public RspDxAntenna getRspDxAntenna()
{
return RspDxAntenna.fromValue(sdrplay_api_RspDxParamsT.antennaSel$get(getRspDxMemorySegment()));
return RspDxAntenna.fromValue(sdrplay_api_RspDxParamsT.antennaSel(getRspDxParams()));
}
/**
@@ -94,7 +95,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public void setRspDxAntenna(RspDxAntenna rspDxAntenna)
{
sdrplay_api_RspDxParamsT.antennaSel$set(getRspDxMemorySegment(), rspDxAntenna.getValue());
sdrplay_api_RspDxParamsT.antennaSel(getRspDxParams(), rspDxAntenna.getValue());
}
/**
@@ -102,7 +103,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public boolean isRfNotch()
{
return Flag.evaluate(sdrplay_api_RspDxParamsT.rfNotchEnable$get(getRspDxMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDxParamsT.rfNotchEnable(getRspDxParams()));
}
/**
@@ -110,7 +111,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public void setRfNotch(boolean enable)
{
sdrplay_api_RspDxParamsT.rfNotchEnable$set(getRspDxMemorySegment(), Flag.of(enable));
sdrplay_api_RspDxParamsT.rfNotchEnable(getRspDxParams(), Flag.of(enable));
}
/**
@@ -118,7 +119,7 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public boolean isRfDabNotch()
{
return Flag.evaluate(sdrplay_api_RspDxParamsT.rfDabNotchEnable$get(getRspDxMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDxParamsT.rfDabNotchEnable(getRspDxParams()));
}
/**
@@ -126,6 +127,6 @@ public class RspDxDeviceParameters extends DeviceParameters
*/
public void setRfDabNotch(boolean enable)
{
sdrplay_api_RspDxParamsT.rfDabNotchEnable$set(getRspDxMemorySegment(), Flag.of(enable));
sdrplay_api_RspDxParamsT.rfDabNotchEnable(getRspDxParams(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -22,16 +22,13 @@ package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device;
import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_FsFreqT;
import java.lang.foreign.MemorySegment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Sample Rate structure
*/
public class SamplingFrequency
{
private Logger mLog = LoggerFactory.getLogger(SamplingFrequency.class);
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from a foreign memory segment and transfers the structure fields into this instance.
@@ -53,7 +50,7 @@ public class SamplingFrequency
*/
public double getSampleRate()
{
return sdrplay_api_FsFreqT.fsHz$get(getMemorySegment());
return sdrplay_api_FsFreqT.fsHz(getMemorySegment());
}
/**
@@ -64,9 +61,9 @@ public class SamplingFrequency
*/
public void setSampleRate(double sampleRate, boolean synchronousUpdate, boolean recalibrate)
{
sdrplay_api_FsFreqT.fsHz$set(getMemorySegment(), sampleRate);
sdrplay_api_FsFreqT.syncUpdate$set(getMemorySegment(), synchronousUpdate ? Flag.TRUE : Flag.FALSE);
sdrplay_api_FsFreqT.reCal$set(getMemorySegment(), recalibrate ? Flag.TRUE : Flag.FALSE);
sdrplay_api_FsFreqT.fsHz(getMemorySegment(), sampleRate);
sdrplay_api_FsFreqT.syncUpdate(getMemorySegment(), synchronousUpdate ? Flag.TRUE : Flag.FALSE);
sdrplay_api_FsFreqT.reCal(getMemorySegment(), recalibrate ? Flag.TRUE : Flag.FALSE);
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,7 +27,7 @@ import java.lang.foreign.MemorySegment;
*/
public class SynchronousUpdate
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from a foreign memory segment
@@ -50,7 +50,7 @@ public class SynchronousUpdate
*/
public void set(int sampleNumber, int period)
{
sdrplay_api_SyncUpdateT.sampleNum$set(getMemorySegment(), sampleNumber);
sdrplay_api_SyncUpdateT.period$set(getMemorySegment(), period);
sdrplay_api_SyncUpdateT.sampleNum(getMemorySegment(), sampleNumber);
sdrplay_api_SyncUpdateT.period(getMemorySegment(), period);
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,31 +27,27 @@ import java.lang.foreign.MemorySegment;
*/
public class EventParametersFactory
{
private GainCallbackParameters mGainCallbackParameters;
private PowerOverloadCallbackParameters mPowerOverloadCallbackParameters;
private RspDuoModeCallbackParameters mRspDuoModeCallbackParameters;
/**
* Gain event callback parameters
*/
public static GainCallbackParameters createGainCallbackParameters(MemorySegment memorySegment)
public static GainCallbackParameters createGainCallbackParameters(MemorySegment eventParams)
{
return new GainCallbackParameters(sdrplay_api_EventParamsT.gainParams$slice(memorySegment));
return new GainCallbackParameters(sdrplay_api_EventParamsT.gainParams(eventParams));
}
/**
* Power overload event callback parameters
*/
public static PowerOverloadCallbackParameters createPowerOverloadCallbackParameters(MemorySegment memorySegment)
public static PowerOverloadCallbackParameters createPowerOverloadCallbackParameters(MemorySegment eventParams)
{
return new PowerOverloadCallbackParameters(sdrplay_api_EventParamsT.powerOverloadParams$slice(memorySegment));
return new PowerOverloadCallbackParameters(sdrplay_api_EventParamsT.powerOverloadParams(eventParams));
}
/**
* RSPduo mode event callback parameters
*/
public static RspDuoModeCallbackParameters createRspDuoModeCallbackParameters(MemorySegment memorySegment)
public static RspDuoModeCallbackParameters createRspDuoModeCallbackParameters(MemorySegment eventParams)
{
return new RspDuoModeCallbackParameters(sdrplay_api_EventParamsT.rspDuoModeParams$slice(memorySegment));
return new RspDuoModeCallbackParameters(sdrplay_api_EventParamsT.rspDuoModeParams(eventParams));
}
}

View File

@@ -30,7 +30,7 @@ public enum EventType
POWER_OVERLOAD_CHANGE(sdrplay_api_h.sdrplay_api_PowerOverloadChange(), "POWER OVERLOAD CHANGE"),
DEVICE_REMOVED(sdrplay_api_h.sdrplay_api_DeviceRemoved(), "DEVICE REMOVED"),
RSP_DUO_MODE_CHANGE(sdrplay_api_h.sdrplay_api_RspDuoModeChange(), "RSP-DUO MODE CHANGE"),
DEVICE_FAILURE(io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h.sdrplay_api_DeviceFailure(), "DEVICE FAILURE"),
DEVICE_FAILURE(io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h.sdrplay_api_DeviceFailure(), "DEVICE FAILURE"),
UNKNOWN(-1, "UNKNOWN");
private int mValue;

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,27 +21,24 @@ package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_GainCbParamT;
import java.lang.foreign.MemorySegment;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Gain Callback Parameters structure (sdrplay_api_GainCbParamT)
*/
public class GainCallbackParameters
{
private static final Logger mLog = LoggerFactory.getLogger(GainCallbackParameters.class);
private int mGainReductionDb;
private int mLnaGainReductionDb;
private double mCurrentGain;
private final int mGainReductionDb;
private final int mLnaGainReductionDb;
private final double mCurrentGain;
/**
* Constructs an instance from the foreign memory segment
*/
public GainCallbackParameters(MemorySegment memorySegment)
public GainCallbackParameters(MemorySegment gainCbParam)
{
mGainReductionDb = sdrplay_api_GainCbParamT.gRdB$get(memorySegment);
mLnaGainReductionDb = sdrplay_api_GainCbParamT.lnaGRdB$get(memorySegment);
mCurrentGain = sdrplay_api_GainCbParamT.currGain$get(memorySegment);
mGainReductionDb = sdrplay_api_GainCbParamT.gRdB(gainCbParam);
mLnaGainReductionDb = sdrplay_api_GainCbParamT.lnaGRdB(gainCbParam);
mCurrentGain = sdrplay_api_GainCbParamT.currGain(gainCbParam);
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,15 +27,15 @@ import java.lang.foreign.MemorySegment;
*/
public class PowerOverloadCallbackParameters
{
private PowerOverloadEventType mPowerOverloadEventType;
private final PowerOverloadEventType mPowerOverloadEventType;
/**
* Constructs an instance from the foreign memory segment
*/
public PowerOverloadCallbackParameters(MemorySegment memorySegment)
public PowerOverloadCallbackParameters(MemorySegment powerOverloadCbParam)
{
mPowerOverloadEventType = PowerOverloadEventType
.fromValue(sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$get(memorySegment));
.fromValue(sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType(powerOverloadCbParam));
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,14 +27,14 @@ import java.lang.foreign.MemorySegment;
*/
public class RspDuoModeCallbackParameters
{
private RspDuoModeEventType mRspDuoModeEventType;
private final RspDuoModeEventType mRspDuoModeEventType;
/**
* Constructs an instance from the foreign memory segment
*/
public RspDuoModeCallbackParameters(MemorySegment memorySegment)
public RspDuoModeCallbackParameters(MemorySegment rspDuoModeCbParam)
{
mRspDuoModeEventType = RspDuoModeEventType.fromValue(sdrplay_api_RspDuoModeCbParamT.modeChangeType$get(memorySegment));
mRspDuoModeEventType = RspDuoModeEventType.fromValue(sdrplay_api_RspDuoModeCbParamT.modeChangeType(rspDuoModeCbParam));
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,7 +28,7 @@ import java.lang.foreign.MemorySegment;
*/
public class DcOffsetTuner
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from the foreign memory segment
@@ -52,42 +52,42 @@ public class DcOffsetTuner
*/
public int getDcCal()
{
return sdrplay_api_DcOffsetTunerT.dcCal$get(getMemorySegment());
return sdrplay_api_DcOffsetTunerT.dcCal(getMemorySegment());
}
public void setDcCal(int dcCal)
{
sdrplay_api_DcOffsetTunerT.dcCal$set(getMemorySegment(), (byte)dcCal);
sdrplay_api_DcOffsetTunerT.dcCal(getMemorySegment(), (byte)dcCal);
}
public boolean isSpeedUp()
{
return Flag.evaluate(sdrplay_api_DcOffsetTunerT.speedUp$get(getMemorySegment()));
return Flag.evaluate(sdrplay_api_DcOffsetTunerT.speedUp(getMemorySegment()));
}
public void setSpeedUp(boolean speedUp)
{
sdrplay_api_DcOffsetTunerT.speedUp$set(getMemorySegment(), Flag.of(speedUp));
sdrplay_api_DcOffsetTunerT.speedUp(getMemorySegment(), Flag.of(speedUp));
}
public int getTrackTime()
{
return sdrplay_api_DcOffsetTunerT.trackTime$get(getMemorySegment());
return sdrplay_api_DcOffsetTunerT.trackTime(getMemorySegment());
}
public void setTrackTime(int trackTime)
{
sdrplay_api_DcOffsetTunerT.trackTime$set(getMemorySegment(), trackTime);
sdrplay_api_DcOffsetTunerT.trackTime(getMemorySegment(), trackTime);
}
public int getRefreshRateTime()
{
return sdrplay_api_DcOffsetTunerT.refreshRateTime$get(getMemorySegment());
return sdrplay_api_DcOffsetTunerT.refreshRateTime(getMemorySegment());
}
public void setRefreshRateTime(int refreshRateTime)
{
sdrplay_api_DcOffsetTunerT.refreshRateTime$set(getMemorySegment(), refreshRateTime);
sdrplay_api_DcOffsetTunerT.refreshRateTime(getMemorySegment(), refreshRateTime);
}
@Override

View File

@@ -32,8 +32,8 @@ public class Gain
{
private static final Logger mLog = LoggerFactory.getLogger(Gain.class);
private MemorySegment mMemorySegment;
private GainValues mGainValues;
private final MemorySegment mMemorySegment;
private final GainValues mGainValues;
/**
* Constructs an instance from the foreign memory segment
@@ -41,7 +41,7 @@ public class Gain
public Gain(MemorySegment memorySegment)
{
mMemorySegment = memorySegment;
mGainValues = new GainValues(sdrplay_api_GainT.gainVals$slice(memorySegment));
mGainValues = new GainValues(sdrplay_api_GainT.gainVals(memorySegment));
}
/**
@@ -58,7 +58,7 @@ public class Gain
*/
public int getGainReductionDb()
{
return sdrplay_api_GainT.gRdB$get(getMemorySegment());
return sdrplay_api_GainT.gRdB(getMemorySegment());
}
/**
@@ -67,7 +67,7 @@ public class Gain
*/
public void setGainReductionDb(int gainReductionDb)
{
sdrplay_api_GainT.gRdB$set(getMemorySegment(), gainReductionDb);
sdrplay_api_GainT.gRdB(getMemorySegment(), gainReductionDb);
}
/**
@@ -75,7 +75,7 @@ public class Gain
*/
public int getLNA()
{
return sdrplay_api_GainT.LNAstate$get(getMemorySegment());
return sdrplay_api_GainT.LNAstate(getMemorySegment());
}
/**
@@ -83,7 +83,7 @@ public class Gain
*/
public void setLNA(int lna)
{
sdrplay_api_GainT.LNAstate$set(getMemorySegment(), (byte)lna);
sdrplay_api_GainT.LNAstate(getMemorySegment(), (byte)lna);
}
/**
@@ -91,7 +91,7 @@ public class Gain
*/
public void setSynchronousUpdate(boolean syncUpdate)
{
sdrplay_api_GainT.syncUpdate$set(getMemorySegment(), Flag.of(syncUpdate));
sdrplay_api_GainT.syncUpdate(getMemorySegment(), Flag.of(syncUpdate));
}
/**
@@ -99,7 +99,7 @@ public class Gain
*/
public MinimumGainReductionMode getMinimumGainReductionMode()
{
return MinimumGainReductionMode.fromValue(sdrplay_api_GainT.minGr$get(getMemorySegment()));
return MinimumGainReductionMode.fromValue(sdrplay_api_GainT.minGr(getMemorySegment()));
}
/**
@@ -107,7 +107,7 @@ public class Gain
*/
public void setMinimumGainReductionMode(MinimumGainReductionMode minimumGainReductionMode)
{
sdrplay_api_GainT.minGr$set(getMemorySegment(), minimumGainReductionMode.getValue());
sdrplay_api_GainT.minGr(getMemorySegment(), minimumGainReductionMode.getValue());
}
/**

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -29,7 +29,7 @@ import java.lang.foreign.MemorySegment;
*/
public class GainValues
{
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from the foreign memory segment
@@ -50,17 +50,17 @@ public class GainValues
public float getCurrent()
{
return sdrplay_api_GainValuesT.curr$get(getMemorySegment());
return sdrplay_api_GainValuesT.curr(getMemorySegment());
}
public float getMax()
{
return sdrplay_api_GainValuesT.max$get(getMemorySegment());
return sdrplay_api_GainValuesT.max(getMemorySegment());
}
public float getMin()
{
return sdrplay_api_GainValuesT.min$get(getMemorySegment());
return sdrplay_api_GainValuesT.min(getMemorySegment());
}
@Override

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -31,7 +31,7 @@ public class RfFrequency
{
private static final double MINIMUM_FREQUENCY = 1_200;
private static final double MAXIMUM_FREQUENCY = 2_000_000_000;
private MemorySegment mMemorySegment;
private final MemorySegment mMemorySegment;
/**
* Constructs an instance from the foreign memory segment
@@ -53,7 +53,7 @@ public class RfFrequency
*/
public double getFrequency()
{
return sdrplay_api_RfFreqT.rfHz$get(getMemorySegment());
return sdrplay_api_RfFreqT.rfHz(getMemorySegment());
}
/**
@@ -66,8 +66,8 @@ public class RfFrequency
{
if(MINIMUM_FREQUENCY < frequency && frequency <= MAXIMUM_FREQUENCY)
{
sdrplay_api_RfFreqT.rfHz$set(getMemorySegment(), frequency);
sdrplay_api_RfFreqT.syncUpdate$set(getMemorySegment(), Flag.of(synchronousUpdate));
sdrplay_api_RfFreqT.rfHz(getMemorySegment(), frequency);
sdrplay_api_RfFreqT.syncUpdate(getMemorySegment(), Flag.of(synchronousUpdate));
}
else
{

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,23 +28,23 @@ import java.lang.foreign.MemorySegment;
*/
public class Rsp1aTunerParameters extends TunerParameters
{
private MemorySegment mRsp1aMemorySegment;
private final MemorySegment mRsp1aTunerParams;
/**
* Constructs an instance from the foreign memory segment.
*/
public Rsp1aTunerParameters(MemorySegment tunerParametersMemorySegment, MemorySegment rsp1aMemorySegment)
public Rsp1aTunerParameters(MemorySegment rxChannelParams, MemorySegment rsp1aTunerParams)
{
super(tunerParametersMemorySegment);
mRsp1aMemorySegment = rsp1aMemorySegment;
super(rxChannelParams);
mRsp1aTunerParams = rsp1aTunerParams;
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getRsp1aMemorySegment()
private MemorySegment getRsp1aTunerParams()
{
return mRsp1aMemorySegment;
return mRsp1aTunerParams;
}
/**
@@ -52,7 +52,7 @@ public class Rsp1aTunerParameters extends TunerParameters
*/
public boolean isBiasT()
{
return Flag.evaluate(sdrplay_api_Rsp1aTunerParamsT.biasTEnable$get(getRsp1aMemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp1aTunerParamsT.biasTEnable(getRsp1aTunerParams()));
}
/**
@@ -60,6 +60,6 @@ public class Rsp1aTunerParameters extends TunerParameters
*/
public void setBiasT(boolean enable)
{
sdrplay_api_Rsp1aTunerParamsT.biasTEnable$set(getRsp1aMemorySegment(), Flag.of(enable));
sdrplay_api_Rsp1aTunerParamsT.biasTEnable(getRsp1aTunerParams(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -28,20 +28,20 @@ import java.lang.foreign.MemorySegment;
*/
public class Rsp2TunerParameters extends TunerParameters
{
private MemorySegment mRsp2MemorySegment;
private final MemorySegment mRsp2TunerParams;
public Rsp2TunerParameters(MemorySegment tunerParametersMemorySegment, MemorySegment rsp2MemorySegment)
public Rsp2TunerParameters(MemorySegment rxChannelParams, MemorySegment rsp2TunerParams)
{
super(tunerParametersMemorySegment);
mRsp2MemorySegment = rsp2MemorySegment;
super(rxChannelParams);
mRsp2TunerParams = rsp2TunerParams;
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getRsp2MemorySegment()
private MemorySegment getRsp2TunerParams()
{
return mRsp2MemorySegment;
return mRsp2TunerParams;
}
/**
@@ -49,7 +49,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public boolean isBiasT()
{
return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.biasTEnable$get(getRsp2MemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.biasTEnable(getRsp2TunerParams()));
}
/**
@@ -57,7 +57,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public void setBiasT(boolean enable)
{
sdrplay_api_Rsp2TunerParamsT.biasTEnable$set(getRsp2MemorySegment(), Flag.of(enable));
sdrplay_api_Rsp2TunerParamsT.biasTEnable(getRsp2TunerParams(), Flag.of(enable));
}
/**
@@ -65,7 +65,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public Rsp2AmPort getAmPort()
{
return Rsp2AmPort.fromValue(sdrplay_api_Rsp2TunerParamsT.amPortSel$get(getRsp2MemorySegment()));
return Rsp2AmPort.fromValue(sdrplay_api_Rsp2TunerParamsT.amPortSel(getRsp2TunerParams()));
}
/**
@@ -73,7 +73,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public void setAmPort(Rsp2AmPort amPort)
{
sdrplay_api_Rsp2TunerParamsT.amPortSel$set(getRsp2MemorySegment(), amPort.getValue());
sdrplay_api_Rsp2TunerParamsT.amPortSel(getRsp2TunerParams(), amPort.getValue());
}
/**
@@ -81,7 +81,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public Rsp2Antenna getAntenna()
{
return Rsp2Antenna.fromValue(sdrplay_api_Rsp2TunerParamsT.antennaSel$get(getRsp2MemorySegment()));
return Rsp2Antenna.fromValue(sdrplay_api_Rsp2TunerParamsT.antennaSel(getRsp2TunerParams()));
}
/**
@@ -89,7 +89,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public void setAntenna(Rsp2Antenna rsp2Antenna)
{
sdrplay_api_Rsp2TunerParamsT.antennaSel$set(getRsp2MemorySegment(), rsp2Antenna.getValue());
sdrplay_api_Rsp2TunerParamsT.antennaSel(getRsp2TunerParams(), rsp2Antenna.getValue());
}
/**
@@ -97,7 +97,7 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public boolean isRfNotch()
{
return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$get(getRsp2MemorySegment()));
return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.rfNotchEnable(getRsp2TunerParams()));
}
/**
@@ -105,6 +105,6 @@ public class Rsp2TunerParameters extends TunerParameters
*/
public void setRfNotch(boolean enable)
{
sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$set(getRsp2MemorySegment(), Flag.of(enable));
sdrplay_api_Rsp2TunerParamsT.rfNotchEnable(getRsp2TunerParams(), Flag.of(enable));
}
}

View File

@@ -26,25 +26,25 @@ import java.lang.foreign.MemorySegment;
*/
public abstract class RspDuoTunerParameters extends TunerParameters
{
private MemorySegment mRspDuoMemorySegment;
private MemorySegment mRspDuoTunerParams;
/**
* Constructs an instance from the foreign memory segment
* @param tunerParametersMemorySegment of foreign memory structure
* @param rspDuoMemorySegment of foreign memory structure
* @param rxChannelParams of foreign memory structure
* @param rspDuoTunerParams of foreign memory structure
*/
RspDuoTunerParameters(MemorySegment tunerParametersMemorySegment, MemorySegment rspDuoMemorySegment)
RspDuoTunerParameters(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams)
{
super(tunerParametersMemorySegment);
mRspDuoMemorySegment = rspDuoMemorySegment;
super(rxChannelParams);
mRspDuoTunerParams = rspDuoTunerParams;
}
/**
* Foreign memory segment for this structure
*/
MemorySegment getRspDuoMemorySegment()
MemorySegment getRspDuoTunerParams()
{
return mRspDuoMemorySegment;
return mRspDuoTunerParams;
}
/**

View File

@@ -30,12 +30,12 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
{
/**
* Constructs an instance from the foreign memory segment
* @param tunerParametersMemorySegment of foreign memory structure
* @param rspDuoMemorySegment of foreign memory structure
* @param rxChannelParams of foreign memory structure
* @param rspDuoTunerParams of foreign memory structure
*/
RspDuoTunerParametersV3_07(MemorySegment tunerParametersMemorySegment, MemorySegment rspDuoMemorySegment)
RspDuoTunerParametersV3_07(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams)
{
super(tunerParametersMemorySegment, rspDuoMemorySegment);
super(rxChannelParams, rspDuoTunerParams);
}
/**
@@ -43,7 +43,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public boolean isBiasT()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams()));
}
/**
@@ -51,7 +51,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public void setBiasT(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.biasTEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -59,7 +59,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public RspDuoAmPort getTuner1AmPort()
{
return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$get(getRspDuoMemorySegment()));
return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams()));
}
/**
@@ -67,7 +67,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public void setTuner1AmPort(RspDuoAmPort amPort)
{
sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$set(getRspDuoMemorySegment(), amPort.getValue());
sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams(), amPort.getValue());
}
/**
@@ -75,7 +75,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public boolean isTuner1AmNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -83,7 +83,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public void setTuner1AmNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -91,7 +91,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public boolean isRfNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -99,7 +99,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public void setRfNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -107,7 +107,7 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public boolean isRfDabNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -115,6 +115,6 @@ public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters
*/
public void setRfDabNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
}

View File

@@ -20,7 +20,7 @@
package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner;
import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_RspDuoTunerParamsT;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_RspDuoTunerParamsT;
import java.lang.foreign.MemorySegment;
/**
@@ -33,12 +33,12 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
{
/**
* Constructs an instance from the foreign memory segment
* @param tunerParametersMemorySegment of foreign memory structure
* @param rspDuoMemorySegment of foreign memory structure
* @param rxChannelParams of foreign memory structure
* @param rspDuoTunerParams of foreign memory structure
*/
RspDuoTunerParametersV3_14(MemorySegment tunerParametersMemorySegment, MemorySegment rspDuoMemorySegment)
RspDuoTunerParametersV3_14(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams)
{
super(tunerParametersMemorySegment, rspDuoMemorySegment);
super(rxChannelParams, rspDuoTunerParams);
}
/**
@@ -46,7 +46,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public boolean isBiasT()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams()));
}
/**
@@ -54,7 +54,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public void setBiasT(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.biasTEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -62,7 +62,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public RspDuoAmPort getTuner1AmPort()
{
return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$get(getRspDuoMemorySegment()));
return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams()));
}
/**
@@ -70,7 +70,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public void setTuner1AmPort(RspDuoAmPort amPort)
{
sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$set(getRspDuoMemorySegment(), amPort.getValue());
sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams(), amPort.getValue());
}
/**
@@ -78,7 +78,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public boolean isTuner1AmNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -86,7 +86,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public void setTuner1AmNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -94,7 +94,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public boolean isRfNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -102,7 +102,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public void setRfNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
/**
@@ -110,7 +110,7 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public boolean isRfDabNotch()
{
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$get(getRspDuoMemorySegment()));
return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams()));
}
/**
@@ -118,6 +118,6 @@ public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters
*/
public void setRfDabNotch(boolean enable)
{
sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$set(getRspDuoMemorySegment(), Flag.of(enable));
sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams(), Flag.of(enable));
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,23 +27,23 @@ import java.lang.foreign.MemorySegment;
*/
public class RspDxTunerParameters extends TunerParameters
{
private MemorySegment mRspDxMemorySegment;
private final MemorySegment mRspDxTunerParams;
/**
* Constructs an instance from the foreign memory segment.
*/
public RspDxTunerParameters(MemorySegment tunerParametersMemorySegment, MemorySegment rspDxMemorySegment)
public RspDxTunerParameters(MemorySegment rxChannelParams, MemorySegment rspDxTunerParams)
{
super(tunerParametersMemorySegment);
mRspDxMemorySegment = rspDxMemorySegment;
super(rxChannelParams);
mRspDxTunerParams = rspDxTunerParams;
}
/**
* Foreign memory segment for this structure
*/
private MemorySegment getRspDxMemorySegment()
private MemorySegment getRspDxTunerParams()
{
return mRspDxMemorySegment;
return mRspDxTunerParams;
}
/**
@@ -51,7 +51,7 @@ public class RspDxTunerParameters extends TunerParameters
*/
public HdrModeBandwidth getHdrModeBandwidth()
{
return HdrModeBandwidth.fromValue(sdrplay_api_RspDxTunerParamsT.hdrBw$get(getRspDxMemorySegment()));
return HdrModeBandwidth.fromValue(sdrplay_api_RspDxTunerParamsT.hdrBw(getRspDxTunerParams()));
}
/**
@@ -59,6 +59,6 @@ public class RspDxTunerParameters extends TunerParameters
*/
public void setHdrModeBandwidth(HdrModeBandwidth bandwidth)
{
sdrplay_api_RspDxTunerParamsT.hdrBw$set(getRspDxMemorySegment(), bandwidth.getValue());
sdrplay_api_RspDxTunerParamsT.hdrBw(getRspDxTunerParams(), bandwidth.getValue());
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -27,28 +27,28 @@ import java.lang.foreign.MemorySegment;
*/
public abstract class TunerParameters
{
private MemorySegment mMemorySegment;
private RfFrequency mRfFrequency;
private Gain mGain;
private DcOffsetTuner mDcOffsetTuner;
private final MemorySegment mTunerParams;
private final RfFrequency mRfFrequency;
private final Gain mGain;
private final DcOffsetTuner mDcOffsetTuner;
/**
* Constructs an instance from the foreign memory segment
*/
public TunerParameters(MemorySegment memorySegment)
public TunerParameters(MemorySegment tunerParams)
{
mMemorySegment = memorySegment;
mRfFrequency = new RfFrequency(sdrplay_api_TunerParamsT.rfFreq$slice(memorySegment));
mGain = new Gain(sdrplay_api_TunerParamsT.gain$slice(memorySegment));
mDcOffsetTuner = new DcOffsetTuner(sdrplay_api_TunerParamsT.dcOffsetTuner$slice(memorySegment));
mTunerParams = tunerParams;
mRfFrequency = new RfFrequency(sdrplay_api_TunerParamsT.rfFreq(tunerParams));
mGain = new Gain(sdrplay_api_TunerParamsT.gain(tunerParams));
mDcOffsetTuner = new DcOffsetTuner(sdrplay_api_TunerParamsT.dcOffsetTuner(tunerParams));
}
/**
* Foreign memory segment for this tuner parameters structure
*/
private MemorySegment getMemorySegment()
private MemorySegment getTunerParams()
{
return mMemorySegment;
return mTunerParams;
}
/**
@@ -56,7 +56,7 @@ public abstract class TunerParameters
*/
public Bandwidth getBandwidth()
{
return Bandwidth.fromValue(sdrplay_api_TunerParamsT.bwType$get(getMemorySegment()));
return Bandwidth.fromValue(sdrplay_api_TunerParamsT.bwType(getTunerParams()));
}
/**
@@ -64,7 +64,7 @@ public abstract class TunerParameters
*/
public void setBandwidth(Bandwidth bandwidth)
{
sdrplay_api_TunerParamsT.bwType$set(getMemorySegment(), bandwidth.getValue());
sdrplay_api_TunerParamsT.bwType(getTunerParams(), bandwidth.getValue());
}
/**
@@ -72,7 +72,7 @@ public abstract class TunerParameters
*/
public IfMode getIfMode()
{
return IfMode.fromValue(sdrplay_api_TunerParamsT.ifType$get(getMemorySegment()));
return IfMode.fromValue(sdrplay_api_TunerParamsT.ifType(getTunerParams()));
}
/**
@@ -80,7 +80,7 @@ public abstract class TunerParameters
*/
public void setIfMode(IfMode ifMode)
{
sdrplay_api_TunerParamsT.ifType$set(getMemorySegment(), ifMode.getValue());
sdrplay_api_TunerParamsT.ifType(getTunerParams(), ifMode.getValue());
}
/**
@@ -88,7 +88,7 @@ public abstract class TunerParameters
*/
public LoMode getLoMode()
{
return LoMode.fromValue(sdrplay_api_TunerParamsT.loMode$get(getMemorySegment()));
return LoMode.fromValue(sdrplay_api_TunerParamsT.loMode(getTunerParams()));
}
/**
@@ -96,7 +96,7 @@ public abstract class TunerParameters
*/
public void setLoMode(LoMode loMode)
{
sdrplay_api_TunerParamsT.loMode$set(getMemorySegment(), loMode.getValue());
sdrplay_api_TunerParamsT.loMode(getTunerParams(), loMode.getValue());
}
/**

View File

@@ -32,37 +32,37 @@ public class TunerParametersFactory
/**
* Creats a tuner parameters instance for the specified device type
* @param deviceType to create
* @param memorySegment for the sdrplay_api_RxChannelParamsT structure
* @param rxChannelParams sdrplay_api_RxChannelParamsT structure
* @return tuner parameters
*/
public static TunerParameters create(Version version, DeviceType deviceType, MemorySegment memorySegment)
public static TunerParameters create(Version version, DeviceType deviceType, MemorySegment rxChannelParams)
{
MemorySegment tunerParametersMemorySegment = sdrplay_api_RxChannelParamsT.tunerParams$slice(memorySegment);
MemorySegment tunerParams = sdrplay_api_RxChannelParamsT.tunerParams(rxChannelParams);
switch(deviceType)
{
case RSP1 -> {
return new Rsp1TunerParameters(tunerParametersMemorySegment);
return new Rsp1TunerParameters(tunerParams);
}
//RSP1A and RSP1B share the same tuner parameters structures
case RSP1A, RSP1B -> {
MemorySegment rsp1AMemorySegment = sdrplay_api_RxChannelParamsT.rsp1aTunerParams$slice(memorySegment);
return new Rsp1aTunerParameters(memorySegment, rsp1AMemorySegment);
MemorySegment rsp1aTunerParams = sdrplay_api_RxChannelParamsT.rsp1aTunerParams(rxChannelParams);
return new Rsp1aTunerParameters(rxChannelParams, rsp1aTunerParams);
}
case RSP2 -> {
MemorySegment rsp2MemorySegment = sdrplay_api_RxChannelParamsT.rsp2TunerParams$slice(memorySegment);
return new Rsp2TunerParameters(memorySegment, rsp2MemorySegment);
MemorySegment rsp2TunerParams = sdrplay_api_RxChannelParamsT.rsp2TunerParams(rxChannelParams);
return new Rsp2TunerParameters(rxChannelParams, rsp2TunerParams);
}
case RSPduo -> {
if(version.gte(Version.V3_14))
{
MemorySegment rspDuoMemorySegment = io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_RxChannelParamsT.rspDuoTunerParams$slice(memorySegment);
return new RspDuoTunerParametersV3_14(memorySegment, rspDuoMemorySegment);
MemorySegment rspDuoTunerParams = io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_RxChannelParamsT.rspDuoTunerParams(rxChannelParams);
return new RspDuoTunerParametersV3_14(rxChannelParams, rspDuoTunerParams);
}
else if(version.gte(Version.V3_07))
{
MemorySegment rspDuoMemorySegment = sdrplay_api_RxChannelParamsT.rspDuoTunerParams$slice(memorySegment);
return new RspDuoTunerParametersV3_07(memorySegment, rspDuoMemorySegment);
MemorySegment rspDuoTunerParams = sdrplay_api_RxChannelParamsT.rspDuoTunerParams(rxChannelParams);
return new RspDuoTunerParametersV3_07(rxChannelParams, rspDuoTunerParams);
}
else
{
@@ -70,8 +70,8 @@ public class TunerParametersFactory
}
}
case RSPdx, RSPdxR2 -> {
MemorySegment rspDxMemorySegment = sdrplay_api_RxChannelParamsT.rspDxTunerParams$slice(memorySegment);
return new RspDxTunerParameters(memorySegment, rspDxMemorySegment);
MemorySegment rspDxTunerParams = sdrplay_api_RxChannelParamsT.rspDxTunerParams(rxChannelParams);
return new RspDxTunerParameters(rxChannelParams, rspDxTunerParams);
}
default -> throw new IllegalArgumentException("Unrecognized device type: " + deviceType);
}

View File

@@ -1,55 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import static java.lang.foreign.ValueLayout.ADDRESS;
import static java.lang.foreign.ValueLayout.JAVA_BOOLEAN;
import static java.lang.foreign.ValueLayout.JAVA_BYTE;
import static java.lang.foreign.ValueLayout.JAVA_DOUBLE;
import static java.lang.foreign.ValueLayout.JAVA_FLOAT;
import static java.lang.foreign.ValueLayout.JAVA_INT;
import static java.lang.foreign.ValueLayout.JAVA_LONG;
import static java.lang.foreign.ValueLayout.JAVA_SHORT;
import static java.lang.foreign.ValueLayout.OfAddress;
import static java.lang.foreign.ValueLayout.OfBoolean;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfDouble;
import static java.lang.foreign.ValueLayout.OfFloat;
import static java.lang.foreign.ValueLayout.OfInt;
import static java.lang.foreign.ValueLayout.OfLong;
import static java.lang.foreign.ValueLayout.OfShort;
final class Constants$root {
// Suppresses default constructor, ensuring non-instantiability.
private Constants$root() {}
static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN;
static final OfByte C_CHAR$LAYOUT = JAVA_BYTE;
static final OfShort C_SHORT$LAYOUT = JAVA_SHORT;
static final OfInt C_INT$LAYOUT = JAVA_INT;
static final OfLong C_LONG$LAYOUT = JAVA_LONG;
static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG;
static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT;
static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE;
static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64).asUnbounded();
}

View File

@@ -1,253 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
// Generated by jextract
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.Linker;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.SymbolLookup;
import java.lang.foreign.ValueLayout;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
import static java.lang.foreign.ValueLayout.ADDRESS;
import static java.lang.foreign.ValueLayout.JAVA_DOUBLE;
import static java.lang.foreign.ValueLayout.JAVA_LONG;
final class RuntimeHelper {
private static final Linker LINKER = Linker.nativeLinker();
private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader();
private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup();
private static final SymbolLookup SYMBOL_LOOKUP;
private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); };
final static SegmentAllocator CONSTANT_ALLOCATOR =
(size, align) -> MemorySegment.allocateNative(size, align, SegmentScope.auto());
static {
// System.loadLibrary("libsdrplay_api");
SymbolLookup loaderLookup = SymbolLookup.loaderLookup();
SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name));
}
// Suppresses default constructor, ensuring non-instantiability.
private RuntimeHelper() {}
static <T> T requireNonNull(T obj, String symbolName) {
if (obj == null) {
throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName);
}
return obj;
}
static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) {
return SYMBOL_LOOKUP.find(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize(), symbol.scope())).orElse(null);
}
static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) {
return SYMBOL_LOOKUP.find(name).
map(addr -> LINKER.downcallHandle(addr, fdesc)).
orElse(null);
}
static MethodHandle downcallHandle(FunctionDescriptor fdesc) {
return LINKER.downcallHandle(fdesc);
}
static MethodHandle downcallHandleVariadic(String name, FunctionDescriptor fdesc) {
return SYMBOL_LOOKUP.find(name).
map(addr -> VarargsInvoker.make(addr, fdesc)).
orElse(null);
}
static MethodHandle upcallHandle(Class<?> fi, String name, FunctionDescriptor fdesc) {
try {
return MH_LOOKUP.findVirtual(fi, name, fdesc.toMethodType());
} catch (Throwable ex) {
throw new AssertionError(ex);
}
}
static <Z> MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, SegmentScope scope) {
try {
fiHandle = fiHandle.bindTo(z);
return LINKER.upcallStub(fiHandle, fdesc, scope);
} catch (Throwable ex) {
throw new AssertionError(ex);
}
}
static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, SegmentScope scope) {
return MemorySegment.ofAddress(addr.address(), numElements * layout.byteSize(), scope);
}
// Internals only below this point
private static final class VarargsInvoker {
private static final MethodHandle INVOKE_MH;
private final MemorySegment symbol;
private final FunctionDescriptor function;
private VarargsInvoker(MemorySegment symbol, FunctionDescriptor function) {
this.symbol = symbol;
this.function = function;
}
static {
try {
INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class));
} catch (ReflectiveOperationException e) {
throw new RuntimeException(e);
}
}
static MethodHandle make(MemorySegment symbol, FunctionDescriptor function) {
VarargsInvoker invoker = new VarargsInvoker(symbol, function);
MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1);
MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class);
for (MemoryLayout layout : function.argumentLayouts()) {
mtype = mtype.appendParameterTypes(carrier(layout, false));
}
mtype = mtype.appendParameterTypes(Object[].class);
boolean needsAllocator = function.returnLayout().isPresent() &&
function.returnLayout().get() instanceof GroupLayout;
if (needsAllocator) {
mtype = mtype.insertParameterTypes(0, SegmentAllocator.class);
} else {
handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR);
}
return handle.asType(mtype);
}
static Class<?> carrier(MemoryLayout layout, boolean ret) {
if (layout instanceof ValueLayout valueLayout) {
return valueLayout.carrier();
} else if (layout instanceof GroupLayout) {
return MemorySegment.class;
} else {
throw new AssertionError("Cannot get here!");
}
}
private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable {
// one trailing Object[]
int nNamedArgs = function.argumentLayouts().size();
assert(args.length == nNamedArgs + 1);
// The last argument is the array of vararg collector
Object[] unnamedArgs = (Object[]) args[args.length - 1];
int argsCount = nNamedArgs + unnamedArgs.length;
Class<?>[] argTypes = new Class<?>[argsCount];
MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length];
int pos = 0;
for (pos = 0; pos < nNamedArgs; pos++) {
argLayouts[pos] = function.argumentLayouts().get(pos);
}
assert pos == nNamedArgs;
for (Object o: unnamedArgs) {
argLayouts[pos] = variadicLayout(normalize(o.getClass()));
pos++;
}
assert pos == argsCount;
FunctionDescriptor f = (function.returnLayout().isEmpty()) ?
FunctionDescriptor.ofVoid(argLayouts) :
FunctionDescriptor.of(function.returnLayout().get(), argLayouts);
MethodHandle mh = LINKER.downcallHandle(symbol, f);
boolean needsAllocator = function.returnLayout().isPresent() &&
function.returnLayout().get() instanceof GroupLayout;
if (needsAllocator) {
mh = mh.bindTo(allocator);
}
// flatten argument list so that it can be passed to an asSpreader MH
Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length];
System.arraycopy(args, 0, allArgs, 0, nNamedArgs);
System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length);
return mh.asSpreader(Object[].class, argsCount).invoke(allArgs);
}
private static Class<?> unboxIfNeeded(Class<?> clazz) {
if (clazz == Boolean.class) {
return boolean.class;
} else if (clazz == Void.class) {
return void.class;
} else if (clazz == Byte.class) {
return byte.class;
} else if (clazz == Character.class) {
return char.class;
} else if (clazz == Short.class) {
return short.class;
} else if (clazz == Integer.class) {
return int.class;
} else if (clazz == Long.class) {
return long.class;
} else if (clazz == Float.class) {
return float.class;
} else if (clazz == Double.class) {
return double.class;
} else {
return clazz;
}
}
private Class<?> promote(Class<?> c) {
if (c == byte.class || c == char.class || c == short.class || c == int.class) {
return long.class;
} else if (c == float.class) {
return double.class;
} else {
return c;
}
}
private Class<?> normalize(Class<?> c) {
c = unboxIfNeeded(c);
if (c.isPrimitive()) {
return promote(c);
}
if (c == MemorySegment.class) {
return MemorySegment.class;
}
throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName());
}
private MemoryLayout variadicLayout(Class<?> c) {
if (c == long.class) {
return JAVA_LONG;
} else if (c == double.class) {
return JAVA_DOUBLE;
} else if (c == MemorySegment.class) {
return ADDRESS;
} else {
throw new IllegalArgumentException("Unhandled variadic argument class: " + c);
}
}
}
}

View File

@@ -1,90 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$0 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$0() {}
static final FunctionDescriptor sdrplay_api_StreamCallback_t$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_StreamCallback_t_UP$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_StreamCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_StreamCallback_t.class, "apply", constants$0.sdrplay_api_StreamCallback_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_StreamCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_StreamCallback_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$0.sdrplay_api_StreamCallback_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_EventCallback_t$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_EventCallback_t_UP$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_EventCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_EventCallback_t.class, "apply", constants$0.sdrplay_api_EventCallback_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_EventCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid(
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_EventCallback_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$0.sdrplay_api_EventCallback_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_Open_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final FunctionDescriptor sdrplay_api_Open_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Open_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Open_t.class, "apply", constants$0.sdrplay_api_Open_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_Open_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Open_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$0.sdrplay_api_Open_t_DOWN$FUNC
);
}

View File

@@ -1,60 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$1 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$1() {}
static final FunctionDescriptor sdrplay_api_Close_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final FunctionDescriptor sdrplay_api_Close_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Close_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Close_t.class, "apply", constants$1.sdrplay_api_Close_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_Close_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Close_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.sdrplay_api_Close_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_ApiVersion_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_ApiVersion_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ApiVersion_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ApiVersion_t.class, "apply", constants$1.sdrplay_api_ApiVersion_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_ApiVersion_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ApiVersion_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.sdrplay_api_ApiVersion_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_LockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_LockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_LockDeviceApi_t.class, "apply", constants$1.sdrplay_api_LockDeviceApi_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_LockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$1.sdrplay_api_LockDeviceApi_t_DOWN$FUNC
);
}

View File

@@ -1,47 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$10 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$10() {}
static final FunctionDescriptor sdrplay_api_SwapRspDuoMode$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_DOUBLE$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoMode$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_SwapRspDuoMode",
constants$10.sdrplay_api_SwapRspDuoMode$FUNC
);
}

View File

@@ -1,72 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$2 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$2() {}
static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_UnlockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_UnlockDeviceApi_t.class, "apply", constants$2.sdrplay_api_UnlockDeviceApi_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_UnlockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_GetDevices_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_GetDevices_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetDevices_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDevices_t.class, "apply", constants$2.sdrplay_api_GetDevices_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_GetDevices_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetDevices_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$2.sdrplay_api_GetDevices_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_SelectDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_SelectDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SelectDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SelectDevice_t.class, "apply", constants$2.sdrplay_api_SelectDevice_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_SelectDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SelectDevice_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$2.sdrplay_api_SelectDevice_t_DOWN$FUNC
);
}

View File

@@ -1,72 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$3 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$3() {}
static final FunctionDescriptor sdrplay_api_ReleaseDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ReleaseDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ReleaseDevice_t.class, "apply", constants$3.sdrplay_api_ReleaseDevice_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ReleaseDevice_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$3.sdrplay_api_ReleaseDevice_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_GetErrorString_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_GetErrorString_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetErrorString_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetErrorString_t.class, "apply", constants$3.sdrplay_api_GetErrorString_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_GetErrorString_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetErrorString_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$3.sdrplay_api_GetErrorString_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_GetLastError_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_GetLastError_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetLastError_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetLastError_t.class, "apply", constants$3.sdrplay_api_GetLastError_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_GetLastError_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetLastError_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$3.sdrplay_api_GetLastError_t_DOWN$FUNC
);
}

View File

@@ -1,72 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$4 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$4() {}
static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_DisableHeartbeat_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DisableHeartbeat_t.class, "apply", constants$4.sdrplay_api_DisableHeartbeat_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_DisableHeartbeat_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_DebugEnable_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_DebugEnable_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_DebugEnable_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DebugEnable_t.class, "apply", constants$4.sdrplay_api_DebugEnable_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_DebugEnable_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_DebugEnable_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$4.sdrplay_api_DebugEnable_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_GetDeviceParams_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetDeviceParams_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDeviceParams_t.class, "apply", constants$4.sdrplay_api_GetDeviceParams_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetDeviceParams_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$4.sdrplay_api_GetDeviceParams_t_DOWN$FUNC
);
}

View File

@@ -1,87 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$5 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$5() {}
static final FunctionDescriptor sdrplay_api_Init_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_Init_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Init_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Init_t.class, "apply", constants$5.sdrplay_api_Init_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_Init_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Init_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$5.sdrplay_api_Init_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_Uninit_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_Uninit_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Uninit_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Uninit_t.class, "apply", constants$5.sdrplay_api_Uninit_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_Uninit_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Uninit_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$5.sdrplay_api_Uninit_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_Update_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_Update_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_Update_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Update_t.class, "apply", constants$5.sdrplay_api_Update_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_Update_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_Update_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$5.sdrplay_api_Update_t_DOWN$FUNC
);
}

View File

@@ -1,99 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$6 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$6() {}
static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_DOUBLE$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_DOUBLE$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoMode_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoMode_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoMode_t_UP$FUNC);
static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_DOUBLE$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoMode_t_DOWN$MH = RuntimeHelper.downcallHandle(
constants$6.sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC
);
}

View File

@@ -1,69 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$7 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$7() {}
static final FunctionDescriptor sdrplay_api_Open$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Open$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_Open",
constants$7.sdrplay_api_Open$FUNC
);
static final FunctionDescriptor sdrplay_api_Close$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_Close$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_Close",
constants$7.sdrplay_api_Close$FUNC
);
static final FunctionDescriptor sdrplay_api_ApiVersion$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ApiVersion$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_ApiVersion",
constants$7.sdrplay_api_ApiVersion$FUNC
);
static final FunctionDescriptor sdrplay_api_LockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_LockDeviceApi$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_LockDeviceApi",
constants$7.sdrplay_api_LockDeviceApi$FUNC
);
static final FunctionDescriptor sdrplay_api_UnlockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_UnlockDeviceApi$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_UnlockDeviceApi",
constants$7.sdrplay_api_UnlockDeviceApi$FUNC
);
static final FunctionDescriptor sdrplay_api_GetDevices$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetDevices$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_GetDevices",
constants$7.sdrplay_api_GetDevices$FUNC
);
}

View File

@@ -1,74 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$8 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$8() {}
static final FunctionDescriptor sdrplay_api_SelectDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SelectDevice$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_SelectDevice",
constants$8.sdrplay_api_SelectDevice$FUNC
);
static final FunctionDescriptor sdrplay_api_ReleaseDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_ReleaseDevice$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_ReleaseDevice",
constants$8.sdrplay_api_ReleaseDevice$FUNC
);
static final FunctionDescriptor sdrplay_api_GetErrorString$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_GetErrorString$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_GetErrorString",
constants$8.sdrplay_api_GetErrorString$FUNC
);
static final FunctionDescriptor sdrplay_api_GetLastError$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetLastError$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_GetLastError",
constants$8.sdrplay_api_GetLastError$FUNC
);
static final FunctionDescriptor sdrplay_api_DisableHeartbeat$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT);
static final MethodHandle sdrplay_api_DisableHeartbeat$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_DisableHeartbeat",
constants$8.sdrplay_api_DisableHeartbeat$FUNC
);
static final FunctionDescriptor sdrplay_api_DebugEnable$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_DebugEnable$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_DebugEnable",
constants$8.sdrplay_api_DebugEnable$FUNC
);
}

View File

@@ -1,84 +0,0 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
*
* 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/>
* ****************************************************************************
*/
// Generated by jextract
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.FunctionDescriptor;
import java.lang.invoke.MethodHandle;
final class constants$9 {
// Suppresses default constructor, ensuring non-instantiability.
private constants$9() {}
static final FunctionDescriptor sdrplay_api_GetDeviceParams$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_GetDeviceParams$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_GetDeviceParams",
constants$9.sdrplay_api_GetDeviceParams$FUNC
);
static final FunctionDescriptor sdrplay_api_Init$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Init$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_Init",
constants$9.sdrplay_api_Init$FUNC
);
static final FunctionDescriptor sdrplay_api_Uninit$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_Uninit$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_Uninit",
constants$9.sdrplay_api_Uninit$FUNC
);
static final FunctionDescriptor sdrplay_api_Update$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_Update$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_Update",
constants$9.sdrplay_api_Update$FUNC
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_INT$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_SwapRspDuoActiveTuner",
constants$9.sdrplay_api_SwapRspDuoActiveTuner$FUNC
);
static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT,
Constants$root.C_POINTER$LAYOUT,
Constants$root.C_POINTER$LAYOUT
);
static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH = RuntimeHelper.downcallHandle(
"sdrplay_api_SwapRspDuoDualTunerModeSampleRate",
constants$9.sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC
);
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,15 +21,19 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfInt;
import static java.lang.foreign.ValueLayout.OfShort;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* sdrplay_api_AgcControlT enable;
* int setPoint_dBfs;
@@ -38,225 +42,382 @@ import java.lang.invoke.VarHandle;
* unsigned short decay_delay_ms;
* unsigned short decay_threshold_dB;
* int syncUpdate;
* };
* }
* }
*/
public class sdrplay_api_AgcT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("enable"),
Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"),
Constants$root.C_SHORT$LAYOUT.withName("attack_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"),
Constants$root.C_INT$LAYOUT.withName("syncUpdate")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_AgcT.$struct$LAYOUT;
sdrplay_api_AgcT() {
// Should not be called directly
}
static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable"));
public static VarHandle enable$VH() {
return sdrplay_api_AgcT.enable$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_INT.withName("enable"),
sdrplay_api_h.C_INT.withName("setPoint_dBfs"),
sdrplay_api_h.C_SHORT.withName("attack_ms"),
sdrplay_api_h.C_SHORT.withName("decay_ms"),
sdrplay_api_h.C_SHORT.withName("decay_delay_ms"),
sdrplay_api_h.C_SHORT.withName("decay_threshold_dB"),
sdrplay_api_h.C_INT.withName("syncUpdate")
).withName("$anon$36:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt enable$LAYOUT = (OfInt)$LAYOUT.select(groupElement("enable"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_AgcControlT enable
* }
*/
public static final OfInt enable$layout() {
return enable$LAYOUT;
}
private static final long enable$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_AgcControlT enable
* }
*/
public static final long enable$offset() {
return enable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_AgcControlT enable;
* {@snippet lang=c :
* sdrplay_api_AgcControlT enable
* }
*/
public static int enable$get(MemorySegment seg) {
return (int)sdrplay_api_AgcT.enable$VH.get(seg);
public static int enable(MemorySegment struct) {
return struct.get(enable$LAYOUT, enable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_AgcControlT enable;
* {@snippet lang=c :
* sdrplay_api_AgcControlT enable
* }
*/
public static void enable$set(MemorySegment seg, int x) {
sdrplay_api_AgcT.enable$VH.set(seg, x);
public static void enable(MemorySegment struct, int fieldValue) {
struct.set(enable$LAYOUT, enable$OFFSET, fieldValue);
}
public static int enable$get(MemorySegment seg, long index) {
return (int)sdrplay_api_AgcT.enable$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt setPoint_dBfs$LAYOUT = (OfInt)$LAYOUT.select(groupElement("setPoint_dBfs"));
/**
* Layout for field:
* {@snippet lang=c :
* int setPoint_dBfs
* }
*/
public static final OfInt setPoint_dBfs$layout() {
return setPoint_dBfs$LAYOUT;
}
public static void enable$set(MemorySegment seg, long index, int x) {
sdrplay_api_AgcT.enable$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle setPoint_dBfs$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("setPoint_dBfs"));
public static VarHandle setPoint_dBfs$VH() {
return sdrplay_api_AgcT.setPoint_dBfs$VH;
private static final long setPoint_dBfs$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* int setPoint_dBfs
* }
*/
public static final long setPoint_dBfs$offset() {
return setPoint_dBfs$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int setPoint_dBfs;
* {@snippet lang=c :
* int setPoint_dBfs
* }
*/
public static int setPoint_dBfs$get(MemorySegment seg) {
return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg);
public static int setPoint_dBfs(MemorySegment struct) {
return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* int setPoint_dBfs;
* {@snippet lang=c :
* int setPoint_dBfs
* }
*/
public static void setPoint_dBfs$set(MemorySegment seg, int x) {
sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg, x);
public static void setPoint_dBfs(MemorySegment struct, int fieldValue) {
struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue);
}
public static int setPoint_dBfs$get(MemorySegment seg, long index) {
return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg.asSlice(index*sizeof()));
private static final OfShort attack_ms$LAYOUT = (OfShort)$LAYOUT.select(groupElement("attack_ms"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short attack_ms
* }
*/
public static final OfShort attack_ms$layout() {
return attack_ms$LAYOUT;
}
public static void setPoint_dBfs$set(MemorySegment seg, long index, int x) {
sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle attack_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attack_ms"));
public static VarHandle attack_ms$VH() {
return sdrplay_api_AgcT.attack_ms$VH;
private static final long attack_ms$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short attack_ms
* }
*/
public static final long attack_ms$offset() {
return attack_ms$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned short attack_ms;
* {@snippet lang=c :
* unsigned short attack_ms
* }
*/
public static short attack_ms$get(MemorySegment seg) {
return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg);
public static short attack_ms(MemorySegment struct) {
return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned short attack_ms;
* {@snippet lang=c :
* unsigned short attack_ms
* }
*/
public static void attack_ms$set(MemorySegment seg, short x) {
sdrplay_api_AgcT.attack_ms$VH.set(seg, x);
public static void attack_ms(MemorySegment struct, short fieldValue) {
struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue);
}
public static short attack_ms$get(MemorySegment seg, long index) {
return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg.asSlice(index*sizeof()));
private static final OfShort decay_ms$LAYOUT = (OfShort)$LAYOUT.select(groupElement("decay_ms"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short decay_ms
* }
*/
public static final OfShort decay_ms$layout() {
return decay_ms$LAYOUT;
}
public static void attack_ms$set(MemorySegment seg, long index, short x) {
sdrplay_api_AgcT.attack_ms$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle decay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_ms"));
public static VarHandle decay_ms$VH() {
return sdrplay_api_AgcT.decay_ms$VH;
private static final long decay_ms$OFFSET = 10;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short decay_ms
* }
*/
public static final long decay_ms$offset() {
return decay_ms$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned short decay_ms;
* {@snippet lang=c :
* unsigned short decay_ms
* }
*/
public static short decay_ms$get(MemorySegment seg) {
return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg);
public static short decay_ms(MemorySegment struct) {
return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned short decay_ms;
* {@snippet lang=c :
* unsigned short decay_ms
* }
*/
public static void decay_ms$set(MemorySegment seg, short x) {
sdrplay_api_AgcT.decay_ms$VH.set(seg, x);
public static void decay_ms(MemorySegment struct, short fieldValue) {
struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue);
}
public static short decay_ms$get(MemorySegment seg, long index) {
return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg.asSlice(index*sizeof()));
private static final OfShort decay_delay_ms$LAYOUT = (OfShort)$LAYOUT.select(groupElement("decay_delay_ms"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short decay_delay_ms
* }
*/
public static final OfShort decay_delay_ms$layout() {
return decay_delay_ms$LAYOUT;
}
public static void decay_ms$set(MemorySegment seg, long index, short x) {
sdrplay_api_AgcT.decay_ms$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle decay_delay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_delay_ms"));
public static VarHandle decay_delay_ms$VH() {
return sdrplay_api_AgcT.decay_delay_ms$VH;
private static final long decay_delay_ms$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short decay_delay_ms
* }
*/
public static final long decay_delay_ms$offset() {
return decay_delay_ms$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned short decay_delay_ms;
* {@snippet lang=c :
* unsigned short decay_delay_ms
* }
*/
public static short decay_delay_ms$get(MemorySegment seg) {
return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg);
public static short decay_delay_ms(MemorySegment struct) {
return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned short decay_delay_ms;
* {@snippet lang=c :
* unsigned short decay_delay_ms
* }
*/
public static void decay_delay_ms$set(MemorySegment seg, short x) {
sdrplay_api_AgcT.decay_delay_ms$VH.set(seg, x);
public static void decay_delay_ms(MemorySegment struct, short fieldValue) {
struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue);
}
public static short decay_delay_ms$get(MemorySegment seg, long index) {
return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg.asSlice(index*sizeof()));
private static final OfShort decay_threshold_dB$LAYOUT = (OfShort)$LAYOUT.select(groupElement("decay_threshold_dB"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned short decay_threshold_dB
* }
*/
public static final OfShort decay_threshold_dB$layout() {
return decay_threshold_dB$LAYOUT;
}
public static void decay_delay_ms$set(MemorySegment seg, long index, short x) {
sdrplay_api_AgcT.decay_delay_ms$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle decay_threshold_dB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_threshold_dB"));
public static VarHandle decay_threshold_dB$VH() {
return sdrplay_api_AgcT.decay_threshold_dB$VH;
private static final long decay_threshold_dB$OFFSET = 14;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned short decay_threshold_dB
* }
*/
public static final long decay_threshold_dB$offset() {
return decay_threshold_dB$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned short decay_threshold_dB;
* {@snippet lang=c :
* unsigned short decay_threshold_dB
* }
*/
public static short decay_threshold_dB$get(MemorySegment seg) {
return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg);
public static short decay_threshold_dB(MemorySegment struct) {
return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned short decay_threshold_dB;
* {@snippet lang=c :
* unsigned short decay_threshold_dB
* }
*/
public static void decay_threshold_dB$set(MemorySegment seg, short x) {
sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg, x);
public static void decay_threshold_dB(MemorySegment struct, short fieldValue) {
struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue);
}
public static short decay_threshold_dB$get(MemorySegment seg, long index) {
return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt syncUpdate$LAYOUT = (OfInt)$LAYOUT.select(groupElement("syncUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* int syncUpdate
* }
*/
public static final OfInt syncUpdate$layout() {
return syncUpdate$LAYOUT;
}
public static void decay_threshold_dB$set(MemorySegment seg, long index, short x) {
sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate"));
public static VarHandle syncUpdate$VH() {
return sdrplay_api_AgcT.syncUpdate$VH;
private static final long syncUpdate$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* int syncUpdate
* }
*/
public static final long syncUpdate$offset() {
return syncUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int syncUpdate;
* {@snippet lang=c :
* int syncUpdate
* }
*/
public static int syncUpdate$get(MemorySegment seg) {
return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg);
public static int syncUpdate(MemorySegment struct) {
return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* int syncUpdate;
* {@snippet lang=c :
* int syncUpdate
* }
*/
public static void syncUpdate$set(MemorySegment seg, int x) {
sdrplay_api_AgcT.syncUpdate$VH.set(seg, x);
public static void syncUpdate(MemorySegment struct, int fieldValue) {
struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue);
}
public static int syncUpdate$get(MemorySegment seg, long index) {
return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void syncUpdate$set(MemorySegment seg, long index, int x) {
sdrplay_api_AgcT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,63 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_ApiVersion_t)(float* apiVer);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *)
* }
*/
public interface sdrplay_api_ApiVersion_t {
public class sdrplay_api_ApiVersion_t {
int apply(java.lang.foreign.MemorySegment currentSampleRate);
static MemorySegment allocate(sdrplay_api_ApiVersion_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$1.sdrplay_api_ApiVersion_t_UP$MH, fi, constants$1.sdrplay_api_ApiVersion_t$FUNC, scope);
sdrplay_api_ApiVersion_t() {
// Should not be called directly
}
static sdrplay_api_ApiVersion_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _currentSampleRate) -> {
try {
return (int)constants$1.sdrplay_api_ApiVersion_t_DOWN$MH.invokeExact(symbol, _currentSampleRate);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment apiVer);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ApiVersion_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_ApiVersion_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment apiVer) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, apiVer);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,131 +21,218 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.AddressLayout;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* sdrplay_api_StreamCallback_t StreamACbFn;
* sdrplay_api_StreamCallback_t StreamBCbFn;
* sdrplay_api_EventCallback_t EventCbFn;
* };
* }
* }
*/
public class sdrplay_api_CallbackFnsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_POINTER$LAYOUT.withName("StreamACbFn"),
Constants$root.C_POINTER$LAYOUT.withName("StreamBCbFn"),
Constants$root.C_POINTER$LAYOUT.withName("EventCbFn")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_CallbackFnsT.$struct$LAYOUT;
sdrplay_api_CallbackFnsT() {
// Should not be called directly
}
static final VarHandle StreamACbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamACbFn"));
public static VarHandle StreamACbFn$VH() {
return sdrplay_api_CallbackFnsT.StreamACbFn$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_POINTER.withName("StreamACbFn"),
sdrplay_api_h.C_POINTER.withName("StreamBCbFn"),
sdrplay_api_h.C_POINTER.withName("EventCbFn")
).withName("$anon$71:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout StreamACbFn$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("StreamACbFn"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamACbFn
* }
*/
public static final AddressLayout StreamACbFn$layout() {
return StreamACbFn$LAYOUT;
}
private static final long StreamACbFn$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamACbFn
* }
*/
public static final long StreamACbFn$offset() {
return StreamACbFn$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_StreamCallback_t StreamACbFn;
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamACbFn
* }
*/
public static MemorySegment StreamACbFn$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg);
public static MemorySegment StreamACbFn(MemorySegment struct) {
return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_StreamCallback_t StreamACbFn;
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamACbFn
* }
*/
public static void StreamACbFn$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg, x);
public static void StreamACbFn(MemorySegment struct, MemorySegment fieldValue) {
struct.set(StreamACbFn$LAYOUT, StreamACbFn$OFFSET, fieldValue);
}
public static MemorySegment StreamACbFn$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg.asSlice(index*sizeof()));
private static final AddressLayout StreamBCbFn$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("StreamBCbFn"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamBCbFn
* }
*/
public static final AddressLayout StreamBCbFn$layout() {
return StreamBCbFn$LAYOUT;
}
public static void StreamACbFn$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg.asSlice(index*sizeof()), x);
}
public static sdrplay_api_StreamCallback_t StreamACbFn(MemorySegment segment, SegmentScope scope) {
return sdrplay_api_StreamCallback_t.ofAddress(StreamACbFn$get(segment), scope);
}
static final VarHandle StreamBCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamBCbFn"));
public static VarHandle StreamBCbFn$VH() {
return sdrplay_api_CallbackFnsT.StreamBCbFn$VH;
private static final long StreamBCbFn$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamBCbFn
* }
*/
public static final long StreamBCbFn$offset() {
return StreamBCbFn$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_StreamCallback_t StreamBCbFn;
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamBCbFn
* }
*/
public static MemorySegment StreamBCbFn$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg);
public static MemorySegment StreamBCbFn(MemorySegment struct) {
return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_StreamCallback_t StreamBCbFn;
* {@snippet lang=c :
* sdrplay_api_StreamCallback_t StreamBCbFn
* }
*/
public static void StreamBCbFn$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg, x);
public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) {
struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue);
}
public static MemorySegment StreamBCbFn$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg.asSlice(index*sizeof()));
private static final AddressLayout EventCbFn$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("EventCbFn"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_EventCallback_t EventCbFn
* }
*/
public static final AddressLayout EventCbFn$layout() {
return EventCbFn$LAYOUT;
}
public static void StreamBCbFn$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg.asSlice(index*sizeof()), x);
}
public static sdrplay_api_StreamCallback_t StreamBCbFn(MemorySegment segment, SegmentScope scope) {
return sdrplay_api_StreamCallback_t.ofAddress(StreamBCbFn$get(segment), scope);
}
static final VarHandle EventCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("EventCbFn"));
public static VarHandle EventCbFn$VH() {
return sdrplay_api_CallbackFnsT.EventCbFn$VH;
private static final long EventCbFn$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_EventCallback_t EventCbFn
* }
*/
public static final long EventCbFn$offset() {
return EventCbFn$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_EventCallback_t EventCbFn;
* {@snippet lang=c :
* sdrplay_api_EventCallback_t EventCbFn
* }
*/
public static MemorySegment EventCbFn$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg);
public static MemorySegment EventCbFn(MemorySegment struct) {
return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_EventCallback_t EventCbFn;
* {@snippet lang=c :
* sdrplay_api_EventCallback_t EventCbFn
* }
*/
public static void EventCbFn$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg, x);
public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) {
struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue);
}
public static MemorySegment EventCbFn$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void EventCbFn$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static sdrplay_api_EventCallback_t EventCbFn(MemorySegment segment, SegmentScope scope) {
return sdrplay_api_EventCallback_t.ofAddress(EventCbFn$get(segment), scope);
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,61 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_Close_t)();
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void)
* }
*/
public interface sdrplay_api_Close_t {
public class sdrplay_api_Close_t {
int apply();
static MemorySegment allocate(sdrplay_api_Close_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$1.sdrplay_api_Close_t_UP$MH, fi, constants$1.sdrplay_api_Close_t$FUNC, scope);
sdrplay_api_Close_t() {
// Should not be called directly
}
static sdrplay_api_Close_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return () -> {
try {
return (int)constants$1.sdrplay_api_Close_t_DOWN$MH.invokeExact(symbol);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply();
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Close_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_Close_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr) {
try {
return (int) DOWN$MH.invokeExact(funcPtr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,93 +21,265 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* sdrplay_api_DcOffsetT dcOffset;
* sdrplay_api_DecimationT decimation;
* sdrplay_api_AgcT agc;
* sdrplay_api_AdsbModeT adsbMode;
* };
* }
* }
*/
public class sdrplay_api_ControlParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("DCenable"),
Constants$root.C_CHAR$LAYOUT.withName("IQenable")
).withName("dcOffset"),
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("enable"),
Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"),
Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal")
).withName("decimation"),
MemoryLayout.paddingLayout(24),
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("enable"),
Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"),
Constants$root.C_SHORT$LAYOUT.withName("attack_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"),
Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"),
Constants$root.C_INT$LAYOUT.withName("syncUpdate")
).withName("agc"),
Constants$root.C_INT$LAYOUT.withName("adsbMode")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_ControlParamsT.$struct$LAYOUT;
sdrplay_api_ControlParamsT() {
// Should not be called directly
}
public static MemorySegment dcOffset$slice(MemorySegment seg) {
return seg.asSlice(0, 2);
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_DcOffsetT.layout().withName("dcOffset"),
sdrplay_api_DecimationT.layout().withName("decimation"),
MemoryLayout.paddingLayout(3),
sdrplay_api_AgcT.layout().withName("agc"),
sdrplay_api_h.C_INT.withName("adsbMode")
).withName("$anon$47:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
public static MemorySegment decimation$slice(MemorySegment seg) {
return seg.asSlice(2, 3);
private static final GroupLayout dcOffset$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffset"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_DcOffsetT dcOffset
* }
*/
public static final GroupLayout dcOffset$layout() {
return dcOffset$LAYOUT;
}
public static MemorySegment agc$slice(MemorySegment seg) {
return seg.asSlice(8, 20);
}
static final VarHandle adsbMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("adsbMode"));
public static VarHandle adsbMode$VH() {
return sdrplay_api_ControlParamsT.adsbMode$VH;
private static final long dcOffset$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_DcOffsetT dcOffset
* }
*/
public static final long dcOffset$offset() {
return dcOffset$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_AdsbModeT adsbMode;
* {@snippet lang=c :
* sdrplay_api_DcOffsetT dcOffset
* }
*/
public static int adsbMode$get(MemorySegment seg) {
return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg);
public static MemorySegment dcOffset(MemorySegment struct) {
return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_AdsbModeT adsbMode;
* {@snippet lang=c :
* sdrplay_api_DcOffsetT dcOffset
* }
*/
public static void adsbMode$set(MemorySegment seg, int x) {
sdrplay_api_ControlParamsT.adsbMode$VH.set(seg, x);
public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize());
}
public static int adsbMode$get(MemorySegment seg, long index) {
return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg.asSlice(index*sizeof()));
private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_DecimationT decimation
* }
*/
public static final GroupLayout decimation$layout() {
return decimation$LAYOUT;
}
public static void adsbMode$set(MemorySegment seg, long index, int x) {
sdrplay_api_ControlParamsT.adsbMode$VH.set(seg.asSlice(index*sizeof()), x);
private static final long decimation$OFFSET = 2;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_DecimationT decimation
* }
*/
public static final long decimation$offset() {
return decimation$OFFSET;
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_DecimationT decimation
* }
*/
public static MemorySegment decimation(MemorySegment struct) {
return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_DecimationT decimation
* }
*/
public static void decimation(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, decimation$OFFSET, decimation$LAYOUT.byteSize());
}
private static final GroupLayout agc$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("agc"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_AgcT agc
* }
*/
public static final GroupLayout agc$layout() {
return agc$LAYOUT;
}
private static final long agc$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_AgcT agc
* }
*/
public static final long agc$offset() {
return agc$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_AgcT agc
* }
*/
public static MemorySegment agc(MemorySegment struct) {
return struct.asSlice(agc$OFFSET, agc$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_AgcT agc
* }
*/
public static void agc(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, agc$OFFSET, agc$LAYOUT.byteSize());
}
private static final OfInt adsbMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("adsbMode"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_AdsbModeT adsbMode
* }
*/
public static final OfInt adsbMode$layout() {
return adsbMode$LAYOUT;
}
private static final long adsbMode$OFFSET = 28;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_AdsbModeT adsbMode
* }
*/
public static final long adsbMode$offset() {
return adsbMode$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_AdsbModeT adsbMode
* }
*/
public static int adsbMode(MemorySegment struct) {
return struct.get(adsbMode$LAYOUT, adsbMode$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_AdsbModeT adsbMode
* }
*/
public static void adsbMode(MemorySegment struct, int fieldValue) {
struct.set(adsbMode$LAYOUT, adsbMode$OFFSET, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,92 +21,172 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char DCenable;
* unsigned char IQenable;
* };
* }
* }
*/
public class sdrplay_api_DcOffsetT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("DCenable"),
Constants$root.C_CHAR$LAYOUT.withName("IQenable")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DcOffsetT.$struct$LAYOUT;
sdrplay_api_DcOffsetT() {
// Should not be called directly
}
static final VarHandle DCenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("DCenable"));
public static VarHandle DCenable$VH() {
return sdrplay_api_DcOffsetT.DCenable$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("DCenable"),
sdrplay_api_h.C_CHAR.withName("IQenable")
).withName("$anon$23:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char DCenable
* }
*/
public static final OfByte DCenable$layout() {
return DCenable$LAYOUT;
}
private static final long DCenable$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char DCenable
* }
*/
public static final long DCenable$offset() {
return DCenable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char DCenable;
* {@snippet lang=c :
* unsigned char DCenable
* }
*/
public static byte DCenable$get(MemorySegment seg) {
return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg);
public static byte DCenable(MemorySegment struct) {
return struct.get(DCenable$LAYOUT, DCenable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char DCenable;
* {@snippet lang=c :
* unsigned char DCenable
* }
*/
public static void DCenable$set(MemorySegment seg, byte x) {
sdrplay_api_DcOffsetT.DCenable$VH.set(seg, x);
public static void DCenable(MemorySegment struct, byte fieldValue) {
struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue);
}
public static byte DCenable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte IQenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("IQenable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char IQenable
* }
*/
public static final OfByte IQenable$layout() {
return IQenable$LAYOUT;
}
public static void DCenable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DcOffsetT.DCenable$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle IQenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("IQenable"));
public static VarHandle IQenable$VH() {
return sdrplay_api_DcOffsetT.IQenable$VH;
private static final long IQenable$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char IQenable
* }
*/
public static final long IQenable$offset() {
return IQenable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char IQenable;
* {@snippet lang=c :
* unsigned char IQenable
* }
*/
public static byte IQenable$get(MemorySegment seg) {
return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg);
public static byte IQenable(MemorySegment struct) {
return struct.get(IQenable$LAYOUT, IQenable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char IQenable;
* {@snippet lang=c :
* unsigned char IQenable
* }
*/
public static void IQenable$set(MemorySegment seg, byte x) {
sdrplay_api_DcOffsetT.IQenable$VH.set(seg, x);
public static void IQenable(MemorySegment struct, byte fieldValue) {
struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue);
}
public static byte IQenable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void IQenable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DcOffsetT.IQenable$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,153 +21,266 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char dcCal;
* unsigned char speedUp;
* int trackTime;
* int refreshRateTime;
* };
* }
* }
*/
public class sdrplay_api_DcOffsetTunerT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("dcCal"),
Constants$root.C_CHAR$LAYOUT.withName("speedUp"),
MemoryLayout.paddingLayout(16),
Constants$root.C_INT$LAYOUT.withName("trackTime"),
Constants$root.C_INT$LAYOUT.withName("refreshRateTime")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DcOffsetTunerT.$struct$LAYOUT;
sdrplay_api_DcOffsetTunerT() {
// Should not be called directly
}
static final VarHandle dcCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dcCal"));
public static VarHandle dcCal$VH() {
return sdrplay_api_DcOffsetTunerT.dcCal$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("dcCal"),
sdrplay_api_h.C_CHAR.withName("speedUp"),
MemoryLayout.paddingLayout(2),
sdrplay_api_h.C_INT.withName("trackTime"),
sdrplay_api_h.C_INT.withName("refreshRateTime")
).withName("$anon$75:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte dcCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("dcCal"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char dcCal
* }
*/
public static final OfByte dcCal$layout() {
return dcCal$LAYOUT;
}
private static final long dcCal$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char dcCal
* }
*/
public static final long dcCal$offset() {
return dcCal$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char dcCal;
* {@snippet lang=c :
* unsigned char dcCal
* }
*/
public static byte dcCal$get(MemorySegment seg) {
return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg);
public static byte dcCal(MemorySegment struct) {
return struct.get(dcCal$LAYOUT, dcCal$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char dcCal;
* {@snippet lang=c :
* unsigned char dcCal
* }
*/
public static void dcCal$set(MemorySegment seg, byte x) {
sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg, x);
public static void dcCal(MemorySegment struct, byte fieldValue) {
struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue);
}
public static byte dcCal$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte speedUp$LAYOUT = (OfByte)$LAYOUT.select(groupElement("speedUp"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char speedUp
* }
*/
public static final OfByte speedUp$layout() {
return speedUp$LAYOUT;
}
public static void dcCal$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle speedUp$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("speedUp"));
public static VarHandle speedUp$VH() {
return sdrplay_api_DcOffsetTunerT.speedUp$VH;
private static final long speedUp$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char speedUp
* }
*/
public static final long speedUp$offset() {
return speedUp$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char speedUp;
* {@snippet lang=c :
* unsigned char speedUp
* }
*/
public static byte speedUp$get(MemorySegment seg) {
return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg);
public static byte speedUp(MemorySegment struct) {
return struct.get(speedUp$LAYOUT, speedUp$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char speedUp;
* {@snippet lang=c :
* unsigned char speedUp
* }
*/
public static void speedUp$set(MemorySegment seg, byte x) {
sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg, x);
public static void speedUp(MemorySegment struct, byte fieldValue) {
struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue);
}
public static byte speedUp$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt trackTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("trackTime"));
/**
* Layout for field:
* {@snippet lang=c :
* int trackTime
* }
*/
public static final OfInt trackTime$layout() {
return trackTime$LAYOUT;
}
public static void speedUp$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle trackTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("trackTime"));
public static VarHandle trackTime$VH() {
return sdrplay_api_DcOffsetTunerT.trackTime$VH;
private static final long trackTime$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* int trackTime
* }
*/
public static final long trackTime$offset() {
return trackTime$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int trackTime;
* {@snippet lang=c :
* int trackTime
* }
*/
public static int trackTime$get(MemorySegment seg) {
return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg);
public static int trackTime(MemorySegment struct) {
return struct.get(trackTime$LAYOUT, trackTime$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* int trackTime;
* {@snippet lang=c :
* int trackTime
* }
*/
public static void trackTime$set(MemorySegment seg, int x) {
sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg, x);
public static void trackTime(MemorySegment struct, int fieldValue) {
struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue);
}
public static int trackTime$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt refreshRateTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("refreshRateTime"));
/**
* Layout for field:
* {@snippet lang=c :
* int refreshRateTime
* }
*/
public static final OfInt refreshRateTime$layout() {
return refreshRateTime$LAYOUT;
}
public static void trackTime$set(MemorySegment seg, long index, int x) {
sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle refreshRateTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("refreshRateTime"));
public static VarHandle refreshRateTime$VH() {
return sdrplay_api_DcOffsetTunerT.refreshRateTime$VH;
private static final long refreshRateTime$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* int refreshRateTime
* }
*/
public static final long refreshRateTime$offset() {
return refreshRateTime$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int refreshRateTime;
* {@snippet lang=c :
* int refreshRateTime
* }
*/
public static int refreshRateTime$get(MemorySegment seg) {
return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg);
public static int refreshRateTime(MemorySegment struct) {
return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* int refreshRateTime;
* {@snippet lang=c :
* int refreshRateTime
* }
*/
public static void refreshRateTime$set(MemorySegment seg, int x) {
sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg, x);
public static void refreshRateTime(MemorySegment struct, int fieldValue) {
struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue);
}
public static int refreshRateTime$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void refreshRateTime$set(MemorySegment seg, long index, int x) {
sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,64 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_DebugEnable_t)(void* dev,enum dbgLvl);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t)
* }
*/
public interface sdrplay_api_DebugEnable_t {
public class sdrplay_api_DebugEnable_t {
int apply(java.lang.foreign.MemorySegment dev, int dbgLvl);
static MemorySegment allocate(sdrplay_api_DebugEnable_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DebugEnable_t_UP$MH, fi, constants$4.sdrplay_api_DebugEnable_t$FUNC, scope);
sdrplay_api_DebugEnable_t() {
// Should not be called directly
}
static sdrplay_api_DebugEnable_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _dev, int _dbgLvl) -> {
try {
return (int)constants$4.sdrplay_api_DebugEnable_t_DOWN$MH.invokeExact(symbol, _dev, _dbgLvl);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment dev, int dbgLvl);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,122 +21,218 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char enable;
* unsigned char decimationFactor;
* unsigned char wideBandSignal;
* };
* }
* }
*/
public class sdrplay_api_DecimationT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("enable"),
Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"),
Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DecimationT.$struct$LAYOUT;
sdrplay_api_DecimationT() {
// Should not be called directly
}
static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable"));
public static VarHandle enable$VH() {
return sdrplay_api_DecimationT.enable$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("enable"),
sdrplay_api_h.C_CHAR.withName("decimationFactor"),
sdrplay_api_h.C_CHAR.withName("wideBandSignal")
).withName("$anon$29:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char enable
* }
*/
public static final OfByte enable$layout() {
return enable$LAYOUT;
}
private static final long enable$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char enable
* }
*/
public static final long enable$offset() {
return enable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char enable;
* {@snippet lang=c :
* unsigned char enable
* }
*/
public static byte enable$get(MemorySegment seg) {
return (byte)sdrplay_api_DecimationT.enable$VH.get(seg);
public static byte enable(MemorySegment struct) {
return struct.get(enable$LAYOUT, enable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char enable;
* {@snippet lang=c :
* unsigned char enable
* }
*/
public static void enable$set(MemorySegment seg, byte x) {
sdrplay_api_DecimationT.enable$VH.set(seg, x);
public static void enable(MemorySegment struct, byte fieldValue) {
struct.set(enable$LAYOUT, enable$OFFSET, fieldValue);
}
public static byte enable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DecimationT.enable$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte decimationFactor$LAYOUT = (OfByte)$LAYOUT.select(groupElement("decimationFactor"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char decimationFactor
* }
*/
public static final OfByte decimationFactor$layout() {
return decimationFactor$LAYOUT;
}
public static void enable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DecimationT.enable$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle decimationFactor$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decimationFactor"));
public static VarHandle decimationFactor$VH() {
return sdrplay_api_DecimationT.decimationFactor$VH;
private static final long decimationFactor$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char decimationFactor
* }
*/
public static final long decimationFactor$offset() {
return decimationFactor$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char decimationFactor;
* {@snippet lang=c :
* unsigned char decimationFactor
* }
*/
public static byte decimationFactor$get(MemorySegment seg) {
return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg);
public static byte decimationFactor(MemorySegment struct) {
return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char decimationFactor;
* {@snippet lang=c :
* unsigned char decimationFactor
* }
*/
public static void decimationFactor$set(MemorySegment seg, byte x) {
sdrplay_api_DecimationT.decimationFactor$VH.set(seg, x);
public static void decimationFactor(MemorySegment struct, byte fieldValue) {
struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue);
}
public static byte decimationFactor$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte wideBandSignal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("wideBandSignal"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char wideBandSignal
* }
*/
public static final OfByte wideBandSignal$layout() {
return wideBandSignal$LAYOUT;
}
public static void decimationFactor$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DecimationT.decimationFactor$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle wideBandSignal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("wideBandSignal"));
public static VarHandle wideBandSignal$VH() {
return sdrplay_api_DecimationT.wideBandSignal$VH;
private static final long wideBandSignal$OFFSET = 2;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char wideBandSignal
* }
*/
public static final long wideBandSignal$offset() {
return wideBandSignal$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char wideBandSignal;
* {@snippet lang=c :
* unsigned char wideBandSignal
* }
*/
public static byte wideBandSignal$get(MemorySegment seg) {
return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg);
public static byte wideBandSignal(MemorySegment struct) {
return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char wideBandSignal;
* {@snippet lang=c :
* unsigned char wideBandSignal
* }
*/
public static void wideBandSignal$set(MemorySegment seg, byte x) {
sdrplay_api_DecimationT.wideBandSignal$VH.set(seg, x);
public static void wideBandSignal(MemorySegment struct, byte fieldValue) {
struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue);
}
public static byte wideBandSignal$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void wideBandSignal$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DecimationT.wideBandSignal$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,15 +21,19 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfDouble;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* double ppm;
* sdrplay_api_FsFreqT fsFreq;
@@ -41,166 +45,519 @@ import java.lang.invoke.VarHandle;
* sdrplay_api_Rsp2ParamsT rsp2Params;
* sdrplay_api_RspDuoParamsT rspDuoParams;
* sdrplay_api_RspDxParamsT rspDxParams;
* };
* }
* }
*/
public class sdrplay_api_DevParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_DOUBLE$LAYOUT.withName("ppm"),
MemoryLayout.structLayout(
Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"),
Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("reCal"),
MemoryLayout.paddingLayout(48)
).withName("fsFreq"),
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("sampleNum"),
Constants$root.C_INT$LAYOUT.withName("period")
).withName("syncUpdate"),
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate")
).withName("resetFlags"),
MemoryLayout.paddingLayout(8),
Constants$root.C_INT$LAYOUT.withName("mode"),
Constants$root.C_INT$LAYOUT.withName("samplesPerPkt"),
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"),
Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable")
).withName("rsp1aParams"),
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn")
).withName("rsp2Params"),
MemoryLayout.paddingLayout(8),
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("extRefOutputEn")
).withName("rspDuoParams"),
MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"),
Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"),
MemoryLayout.paddingLayout(16),
Constants$root.C_INT$LAYOUT.withName("antennaSel"),
Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"),
Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"),
MemoryLayout.paddingLayout(16)
).withName("rspDxParams")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DevParamsT.$struct$LAYOUT;
sdrplay_api_DevParamsT() {
// Should not be called directly
}
static final VarHandle ppm$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ppm"));
public static VarHandle ppm$VH() {
return sdrplay_api_DevParamsT.ppm$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_DOUBLE.withName("ppm"),
sdrplay_api_FsFreqT.layout().withName("fsFreq"),
sdrplay_api_SyncUpdateT.layout().withName("syncUpdate"),
sdrplay_api_ResetFlagsT.layout().withName("resetFlags"),
MemoryLayout.paddingLayout(1),
sdrplay_api_h.C_INT.withName("mode"),
sdrplay_api_h.C_INT.withName("samplesPerPkt"),
sdrplay_api_Rsp1aParamsT.layout().withName("rsp1aParams"),
sdrplay_api_Rsp2ParamsT.layout().withName("rsp2Params"),
MemoryLayout.paddingLayout(1),
sdrplay_api_RspDuoParamsT.layout().withName("rspDuoParams"),
sdrplay_api_RspDxParamsT.layout().withName("rspDxParams")
).withName("$anon$37:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfDouble ppm$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("ppm"));
/**
* Layout for field:
* {@snippet lang=c :
* double ppm
* }
*/
public static final OfDouble ppm$layout() {
return ppm$LAYOUT;
}
private static final long ppm$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* double ppm
* }
*/
public static final long ppm$offset() {
return ppm$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* double ppm;
* {@snippet lang=c :
* double ppm
* }
*/
public static double ppm$get(MemorySegment seg) {
return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg);
public static double ppm(MemorySegment struct) {
return struct.get(ppm$LAYOUT, ppm$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* double ppm;
* {@snippet lang=c :
* double ppm
* }
*/
public static void ppm$set(MemorySegment seg, double x) {
sdrplay_api_DevParamsT.ppm$VH.set(seg, x);
public static void ppm(MemorySegment struct, double fieldValue) {
struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue);
}
public static double ppm$get(MemorySegment seg, long index) {
return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg.asSlice(index*sizeof()));
private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_FsFreqT fsFreq
* }
*/
public static final GroupLayout fsFreq$layout() {
return fsFreq$LAYOUT;
}
public static void ppm$set(MemorySegment seg, long index, double x) {
sdrplay_api_DevParamsT.ppm$VH.set(seg.asSlice(index*sizeof()), x);
}
public static MemorySegment fsFreq$slice(MemorySegment seg) {
return seg.asSlice(8, 16);
}
public static MemorySegment syncUpdate$slice(MemorySegment seg) {
return seg.asSlice(24, 8);
}
public static MemorySegment resetFlags$slice(MemorySegment seg) {
return seg.asSlice(32, 3);
}
static final VarHandle mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("mode"));
public static VarHandle mode$VH() {
return sdrplay_api_DevParamsT.mode$VH;
private static final long fsFreq$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_FsFreqT fsFreq
* }
*/
public static final long fsFreq$offset() {
return fsFreq$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_TransferModeT mode;
* {@snippet lang=c :
* sdrplay_api_FsFreqT fsFreq
* }
*/
public static int mode$get(MemorySegment seg) {
return (int)sdrplay_api_DevParamsT.mode$VH.get(seg);
public static MemorySegment fsFreq(MemorySegment struct) {
return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_TransferModeT mode;
* {@snippet lang=c :
* sdrplay_api_FsFreqT fsFreq
* }
*/
public static void mode$set(MemorySegment seg, int x) {
sdrplay_api_DevParamsT.mode$VH.set(seg, x);
public static void fsFreq(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, fsFreq$OFFSET, fsFreq$LAYOUT.byteSize());
}
public static int mode$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DevParamsT.mode$VH.get(seg.asSlice(index*sizeof()));
private static final GroupLayout syncUpdate$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("syncUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_SyncUpdateT syncUpdate
* }
*/
public static final GroupLayout syncUpdate$layout() {
return syncUpdate$LAYOUT;
}
public static void mode$set(MemorySegment seg, long index, int x) {
sdrplay_api_DevParamsT.mode$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle samplesPerPkt$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("samplesPerPkt"));
public static VarHandle samplesPerPkt$VH() {
return sdrplay_api_DevParamsT.samplesPerPkt$VH;
private static final long syncUpdate$OFFSET = 24;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_SyncUpdateT syncUpdate
* }
*/
public static final long syncUpdate$offset() {
return syncUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned int samplesPerPkt;
* {@snippet lang=c :
* sdrplay_api_SyncUpdateT syncUpdate
* }
*/
public static int samplesPerPkt$get(MemorySegment seg) {
return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg);
public static MemorySegment syncUpdate(MemorySegment struct) {
return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet :
* unsigned int samplesPerPkt;
* {@snippet lang=c :
* sdrplay_api_SyncUpdateT syncUpdate
* }
*/
public static void samplesPerPkt$set(MemorySegment seg, int x) {
sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg, x);
public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize());
}
public static int samplesPerPkt$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg.asSlice(index*sizeof()));
private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_ResetFlagsT resetFlags
* }
*/
public static final GroupLayout resetFlags$layout() {
return resetFlags$LAYOUT;
}
public static void samplesPerPkt$set(MemorySegment seg, long index, int x) {
sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg.asSlice(index*sizeof()), x);
private static final long resetFlags$OFFSET = 32;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_ResetFlagsT resetFlags
* }
*/
public static final long resetFlags$offset() {
return resetFlags$OFFSET;
}
public static MemorySegment rsp1aParams$slice(MemorySegment seg) {
return seg.asSlice(44, 2);
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_ResetFlagsT resetFlags
* }
*/
public static MemorySegment resetFlags(MemorySegment struct) {
return struct.asSlice(resetFlags$OFFSET, resetFlags$LAYOUT.byteSize());
}
public static MemorySegment rsp2Params$slice(MemorySegment seg) {
return seg.asSlice(46, 1);
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_ResetFlagsT resetFlags
* }
*/
public static void resetFlags(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, resetFlags$OFFSET, resetFlags$LAYOUT.byteSize());
}
public static MemorySegment rspDuoParams$slice(MemorySegment seg) {
return seg.asSlice(48, 4);
private static final OfInt mode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mode"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_TransferModeT mode
* }
*/
public static final OfInt mode$layout() {
return mode$LAYOUT;
}
public static MemorySegment rspDxParams$slice(MemorySegment seg) {
return seg.asSlice(52, 12);
private static final long mode$OFFSET = 36;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_TransferModeT mode
* }
*/
public static final long mode$offset() {
return mode$OFFSET;
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_TransferModeT mode
* }
*/
public static int mode(MemorySegment struct) {
return struct.get(mode$LAYOUT, mode$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_TransferModeT mode
* }
*/
public static void mode(MemorySegment struct, int fieldValue) {
struct.set(mode$LAYOUT, mode$OFFSET, fieldValue);
}
private static final OfInt samplesPerPkt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("samplesPerPkt"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int samplesPerPkt
* }
*/
public static final OfInt samplesPerPkt$layout() {
return samplesPerPkt$LAYOUT;
}
private static final long samplesPerPkt$OFFSET = 40;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int samplesPerPkt
* }
*/
public static final long samplesPerPkt$offset() {
return samplesPerPkt$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* unsigned int samplesPerPkt
* }
*/
public static int samplesPerPkt(MemorySegment struct) {
return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* unsigned int samplesPerPkt
* }
*/
public static void samplesPerPkt(MemorySegment struct, int fieldValue) {
struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue);
}
private static final GroupLayout rsp1aParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_Rsp1aParamsT rsp1aParams
* }
*/
public static final GroupLayout rsp1aParams$layout() {
return rsp1aParams$LAYOUT;
}
private static final long rsp1aParams$OFFSET = 44;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_Rsp1aParamsT rsp1aParams
* }
*/
public static final long rsp1aParams$offset() {
return rsp1aParams$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_Rsp1aParamsT rsp1aParams
* }
*/
public static MemorySegment rsp1aParams(MemorySegment struct) {
return struct.asSlice(rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_Rsp1aParamsT rsp1aParams
* }
*/
public static void rsp1aParams(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize());
}
private static final GroupLayout rsp2Params$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2Params"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_Rsp2ParamsT rsp2Params
* }
*/
public static final GroupLayout rsp2Params$layout() {
return rsp2Params$LAYOUT;
}
private static final long rsp2Params$OFFSET = 46;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_Rsp2ParamsT rsp2Params
* }
*/
public static final long rsp2Params$offset() {
return rsp2Params$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_Rsp2ParamsT rsp2Params
* }
*/
public static MemorySegment rsp2Params(MemorySegment struct) {
return struct.asSlice(rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_Rsp2ParamsT rsp2Params
* }
*/
public static void rsp2Params(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize());
}
private static final GroupLayout rspDuoParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoParamsT rspDuoParams
* }
*/
public static final GroupLayout rspDuoParams$layout() {
return rspDuoParams$LAYOUT;
}
private static final long rspDuoParams$OFFSET = 48;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoParamsT rspDuoParams
* }
*/
public static final long rspDuoParams$offset() {
return rspDuoParams$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoParamsT rspDuoParams
* }
*/
public static MemorySegment rspDuoParams(MemorySegment struct) {
return struct.asSlice(rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoParamsT rspDuoParams
* }
*/
public static void rspDuoParams(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize());
}
private static final GroupLayout rspDxParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RspDxParamsT rspDxParams
* }
*/
public static final GroupLayout rspDxParams$layout() {
return rspDxParams$LAYOUT;
}
private static final long rspDxParams$OFFSET = 52;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RspDxParamsT rspDxParams
* }
*/
public static final long rspDxParams$offset() {
return rspDxParams$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_RspDxParamsT rspDxParams
* }
*/
public static MemorySegment rspDxParams(MemorySegment struct) {
return struct.asSlice(rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_RspDxParamsT rspDxParams
* }
*/
public static void rspDxParams(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize());
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,122 +21,218 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.AddressLayout;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* sdrplay_api_DevParamsT* devParams;
* sdrplay_api_RxChannelParamsT* rxChannelA;
* sdrplay_api_RxChannelParamsT* rxChannelB;
* };
* sdrplay_api_DevParamsT *devParams;
* sdrplay_api_RxChannelParamsT *rxChannelA;
* sdrplay_api_RxChannelParamsT *rxChannelB;
* }
* }
*/
public class sdrplay_api_DeviceParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_POINTER$LAYOUT.withName("devParams"),
Constants$root.C_POINTER$LAYOUT.withName("rxChannelA"),
Constants$root.C_POINTER$LAYOUT.withName("rxChannelB")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DeviceParamsT.$struct$LAYOUT;
sdrplay_api_DeviceParamsT() {
// Should not be called directly
}
static final VarHandle devParams$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("devParams"));
public static VarHandle devParams$VH() {
return sdrplay_api_DeviceParamsT.devParams$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_POINTER.withName("devParams"),
sdrplay_api_h.C_POINTER.withName("rxChannelA"),
sdrplay_api_h.C_POINTER.withName("rxChannelB")
).withName("$anon$153:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final AddressLayout devParams$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("devParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_DevParamsT *devParams
* }
*/
public static final AddressLayout devParams$layout() {
return devParams$LAYOUT;
}
private static final long devParams$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_DevParamsT *devParams
* }
*/
public static final long devParams$offset() {
return devParams$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_DevParamsT* devParams;
* {@snippet lang=c :
* sdrplay_api_DevParamsT *devParams
* }
*/
public static MemorySegment devParams$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg);
public static MemorySegment devParams(MemorySegment struct) {
return struct.get(devParams$LAYOUT, devParams$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_DevParamsT* devParams;
* {@snippet lang=c :
* sdrplay_api_DevParamsT *devParams
* }
*/
public static void devParams$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_DeviceParamsT.devParams$VH.set(seg, x);
public static void devParams(MemorySegment struct, MemorySegment fieldValue) {
struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue);
}
public static MemorySegment devParams$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg.asSlice(index*sizeof()));
private static final AddressLayout rxChannelA$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelA"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelA
* }
*/
public static final AddressLayout rxChannelA$layout() {
return rxChannelA$LAYOUT;
}
public static void devParams$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_DeviceParamsT.devParams$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle rxChannelA$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelA"));
public static VarHandle rxChannelA$VH() {
return sdrplay_api_DeviceParamsT.rxChannelA$VH;
private static final long rxChannelA$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelA
* }
*/
public static final long rxChannelA$offset() {
return rxChannelA$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_RxChannelParamsT* rxChannelA;
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelA
* }
*/
public static MemorySegment rxChannelA$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg);
public static MemorySegment rxChannelA(MemorySegment struct) {
return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_RxChannelParamsT* rxChannelA;
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelA
* }
*/
public static void rxChannelA$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg, x);
public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) {
struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue);
}
public static MemorySegment rxChannelA$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg.asSlice(index*sizeof()));
private static final AddressLayout rxChannelB$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelB"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelB
* }
*/
public static final AddressLayout rxChannelB$layout() {
return rxChannelB$LAYOUT;
}
public static void rxChannelA$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle rxChannelB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelB"));
public static VarHandle rxChannelB$VH() {
return sdrplay_api_DeviceParamsT.rxChannelB$VH;
private static final long rxChannelB$OFFSET = 16;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelB
* }
*/
public static final long rxChannelB$offset() {
return rxChannelB$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_RxChannelParamsT* rxChannelB;
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelB
* }
*/
public static MemorySegment rxChannelB$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg);
public static MemorySegment rxChannelB(MemorySegment struct) {
return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_RxChannelParamsT* rxChannelB;
* {@snippet lang=c :
* sdrplay_api_RxChannelParamsT *rxChannelB
* }
*/
public static void rxChannelB$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg, x);
public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) {
struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue);
}
public static MemorySegment rxChannelB$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void rxChannelB$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,15 +21,24 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.AddressLayout;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.foreign.SequenceLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfDouble;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* char SerNo[64];
* unsigned char hwVer;
@@ -37,173 +46,372 @@ import java.lang.invoke.VarHandle;
* sdrplay_api_RspDuoModeT rspDuoMode;
* double rspDuoSampleFreq;
* HANDLE dev;
* };
* }
* }
*/
public class sdrplay_api_DeviceT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(64, Constants$root.C_CHAR$LAYOUT).withName("SerNo"),
Constants$root.C_CHAR$LAYOUT.withName("hwVer"),
MemoryLayout.paddingLayout(24),
Constants$root.C_INT$LAYOUT.withName("tuner"),
Constants$root.C_INT$LAYOUT.withName("rspDuoMode"),
MemoryLayout.paddingLayout(32),
Constants$root.C_DOUBLE$LAYOUT.withName("rspDuoSampleFreq"),
Constants$root.C_POINTER$LAYOUT.withName("dev")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_DeviceT.$struct$LAYOUT;
sdrplay_api_DeviceT() {
// Should not be called directly
}
public static MemorySegment SerNo$slice(MemorySegment seg) {
return seg.asSlice(0, 64);
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(64, sdrplay_api_h.C_CHAR).withName("SerNo"),
sdrplay_api_h.C_CHAR.withName("hwVer"),
MemoryLayout.paddingLayout(3),
sdrplay_api_h.C_INT.withName("tuner"),
sdrplay_api_h.C_INT.withName("rspDuoMode"),
MemoryLayout.paddingLayout(4),
sdrplay_api_h.C_DOUBLE.withName("rspDuoSampleFreq"),
sdrplay_api_h.C_POINTER.withName("dev")
).withName("$anon$142:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
static final VarHandle hwVer$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hwVer"));
public static VarHandle hwVer$VH() {
return sdrplay_api_DeviceT.hwVer$VH;
private static final SequenceLayout SerNo$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("SerNo"));
/**
* Layout for field:
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static final SequenceLayout SerNo$layout() {
return SerNo$LAYOUT;
}
private static final long SerNo$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static final long SerNo$offset() {
return SerNo$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char hwVer;
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static byte hwVer$get(MemorySegment seg) {
return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg);
public static MemorySegment SerNo(MemorySegment struct) {
return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet :
* unsigned char hwVer;
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static void hwVer$set(MemorySegment seg, byte x) {
sdrplay_api_DeviceT.hwVer$VH.set(seg, x);
public static void SerNo(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, SerNo$OFFSET, SerNo$LAYOUT.byteSize());
}
public static byte hwVer$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg.asSlice(index*sizeof()));
private static long[] SerNo$DIMS = { 64 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static long[] SerNo$dimensions() {
return SerNo$DIMS;
}
public static void hwVer$set(MemorySegment seg, long index, byte x) {
sdrplay_api_DeviceT.hwVer$VH.set(seg.asSlice(index*sizeof()), x);
private static final VarHandle SerNo$ELEM_HANDLE = SerNo$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static byte SerNo(MemorySegment struct, long index0) {
return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0);
}
static final VarHandle tuner$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner"));
public static VarHandle tuner$VH() {
return sdrplay_api_DeviceT.tuner$VH;
/**
* Indexed setter for field:
* {@snippet lang=c :
* char SerNo[64]
* }
*/
public static void SerNo(MemorySegment struct, long index0, byte fieldValue) {
SerNo$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfByte hwVer$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hwVer"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char hwVer
* }
*/
public static final OfByte hwVer$layout() {
return hwVer$LAYOUT;
}
private static final long hwVer$OFFSET = 64;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char hwVer
* }
*/
public static final long hwVer$offset() {
return hwVer$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_TunerSelectT tuner;
* {@snippet lang=c :
* unsigned char hwVer
* }
*/
public static int tuner$get(MemorySegment seg) {
return (int)sdrplay_api_DeviceT.tuner$VH.get(seg);
public static byte hwVer(MemorySegment struct) {
return struct.get(hwVer$LAYOUT, hwVer$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_TunerSelectT tuner;
* {@snippet lang=c :
* unsigned char hwVer
* }
*/
public static void tuner$set(MemorySegment seg, int x) {
sdrplay_api_DeviceT.tuner$VH.set(seg, x);
public static void hwVer(MemorySegment struct, byte fieldValue) {
struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue);
}
public static int tuner$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DeviceT.tuner$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt tuner$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_TunerSelectT tuner
* }
*/
public static final OfInt tuner$layout() {
return tuner$LAYOUT;
}
public static void tuner$set(MemorySegment seg, long index, int x) {
sdrplay_api_DeviceT.tuner$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle rspDuoMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoMode"));
public static VarHandle rspDuoMode$VH() {
return sdrplay_api_DeviceT.rspDuoMode$VH;
private static final long tuner$OFFSET = 68;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_TunerSelectT tuner
* }
*/
public static final long tuner$offset() {
return tuner$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_RspDuoModeT rspDuoMode;
* {@snippet lang=c :
* sdrplay_api_TunerSelectT tuner
* }
*/
public static int rspDuoMode$get(MemorySegment seg) {
return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg);
public static int tuner(MemorySegment struct) {
return struct.get(tuner$LAYOUT, tuner$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_RspDuoModeT rspDuoMode;
* {@snippet lang=c :
* sdrplay_api_TunerSelectT tuner
* }
*/
public static void rspDuoMode$set(MemorySegment seg, int x) {
sdrplay_api_DeviceT.rspDuoMode$VH.set(seg, x);
public static void tuner(MemorySegment struct, int fieldValue) {
struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue);
}
public static int rspDuoMode$get(MemorySegment seg, long index) {
return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt rspDuoMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rspDuoMode"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeT rspDuoMode
* }
*/
public static final OfInt rspDuoMode$layout() {
return rspDuoMode$LAYOUT;
}
public static void rspDuoMode$set(MemorySegment seg, long index, int x) {
sdrplay_api_DeviceT.rspDuoMode$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle rspDuoSampleFreq$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoSampleFreq"));
public static VarHandle rspDuoSampleFreq$VH() {
return sdrplay_api_DeviceT.rspDuoSampleFreq$VH;
private static final long rspDuoMode$OFFSET = 72;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeT rspDuoMode
* }
*/
public static final long rspDuoMode$offset() {
return rspDuoMode$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* double rspDuoSampleFreq;
* {@snippet lang=c :
* sdrplay_api_RspDuoModeT rspDuoMode
* }
*/
public static double rspDuoSampleFreq$get(MemorySegment seg) {
return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg);
public static int rspDuoMode(MemorySegment struct) {
return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* double rspDuoSampleFreq;
* {@snippet lang=c :
* sdrplay_api_RspDuoModeT rspDuoMode
* }
*/
public static void rspDuoSampleFreq$set(MemorySegment seg, double x) {
sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg, x);
public static void rspDuoMode(MemorySegment struct, int fieldValue) {
struct.set(rspDuoMode$LAYOUT, rspDuoMode$OFFSET, fieldValue);
}
public static double rspDuoSampleFreq$get(MemorySegment seg, long index) {
return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg.asSlice(index*sizeof()));
private static final OfDouble rspDuoSampleFreq$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rspDuoSampleFreq"));
/**
* Layout for field:
* {@snippet lang=c :
* double rspDuoSampleFreq
* }
*/
public static final OfDouble rspDuoSampleFreq$layout() {
return rspDuoSampleFreq$LAYOUT;
}
public static void rspDuoSampleFreq$set(MemorySegment seg, long index, double x) {
sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle dev$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dev"));
public static VarHandle dev$VH() {
return sdrplay_api_DeviceT.dev$VH;
private static final long rspDuoSampleFreq$OFFSET = 80;
/**
* Offset for field:
* {@snippet lang=c :
* double rspDuoSampleFreq
* }
*/
public static final long rspDuoSampleFreq$offset() {
return rspDuoSampleFreq$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* HANDLE dev;
* {@snippet lang=c :
* double rspDuoSampleFreq
* }
*/
public static MemorySegment dev$get(MemorySegment seg) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg);
public static double rspDuoSampleFreq(MemorySegment struct) {
return struct.get(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* HANDLE dev;
* {@snippet lang=c :
* double rspDuoSampleFreq
* }
*/
public static void dev$set(MemorySegment seg, MemorySegment x) {
sdrplay_api_DeviceT.dev$VH.set(seg, x);
public static void rspDuoSampleFreq(MemorySegment struct, double fieldValue) {
struct.set(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET, fieldValue);
}
public static MemorySegment dev$get(MemorySegment seg, long index) {
return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg.asSlice(index*sizeof()));
private static final AddressLayout dev$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dev"));
/**
* Layout for field:
* {@snippet lang=c :
* HANDLE dev
* }
*/
public static final AddressLayout dev$layout() {
return dev$LAYOUT;
}
public static void dev$set(MemorySegment seg, long index, MemorySegment x) {
sdrplay_api_DeviceT.dev$VH.set(seg.asSlice(index*sizeof()), x);
private static final long dev$OFFSET = 88;
/**
* Offset for field:
* {@snippet lang=c :
* HANDLE dev
* }
*/
public static final long dev$offset() {
return dev$OFFSET;
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Getter for field:
* {@snippet lang=c :
* HANDLE dev
* }
*/
public static MemorySegment dev(MemorySegment struct) {
return struct.get(dev$LAYOUT, dev$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* HANDLE dev
* }
*/
public static void dev(MemorySegment struct, MemorySegment fieldValue) {
struct.set(dev$LAYOUT, dev$OFFSET, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,61 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_DisableHeartbeat_t)();
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void)
* }
*/
public interface sdrplay_api_DisableHeartbeat_t {
public class sdrplay_api_DisableHeartbeat_t {
int apply();
static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DisableHeartbeat_t_UP$MH, fi, constants$4.sdrplay_api_DisableHeartbeat_t$FUNC, scope);
sdrplay_api_DisableHeartbeat_t() {
// Should not be called directly
}
static sdrplay_api_DisableHeartbeat_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return () -> {
try {
return (int)constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$MH.invokeExact(symbol);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply();
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr) {
try {
return (int) DOWN$MH.invokeExact(funcPtr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,77 +21,366 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.foreign.SequenceLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* char file[256];
* char function[256];
* int line;
* char message[1024];
* };
* }
* }
*/
public class sdrplay_api_ErrorInfoT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("file"),
MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("function"),
Constants$root.C_INT$LAYOUT.withName("line"),
MemoryLayout.sequenceLayout(1024, Constants$root.C_CHAR$LAYOUT).withName("message")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_ErrorInfoT.$struct$LAYOUT;
sdrplay_api_ErrorInfoT() {
// Should not be called directly
}
public static MemorySegment file$slice(MemorySegment seg) {
return seg.asSlice(0, 256);
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"),
MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"),
sdrplay_api_h.C_INT.withName("line"),
MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message")
).withName("$anon$161:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
public static MemorySegment function$slice(MemorySegment seg) {
return seg.asSlice(256, 256);
private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file"));
/**
* Layout for field:
* {@snippet lang=c :
* char file[256]
* }
*/
public static final SequenceLayout file$layout() {
return file$LAYOUT;
}
static final VarHandle line$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("line"));
public static VarHandle line$VH() {
return sdrplay_api_ErrorInfoT.line$VH;
private static final long file$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* char file[256]
* }
*/
public static final long file$offset() {
return file$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int line;
* {@snippet lang=c :
* char file[256]
* }
*/
public static int line$get(MemorySegment seg) {
return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg);
public static MemorySegment file(MemorySegment struct) {
return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet :
* int line;
* {@snippet lang=c :
* char file[256]
* }
*/
public static void line$set(MemorySegment seg, int x) {
sdrplay_api_ErrorInfoT.line$VH.set(seg, x);
public static void file(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize());
}
public static int line$get(MemorySegment seg, long index) {
return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg.asSlice(index*sizeof()));
private static long[] file$DIMS = { 256 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char file[256]
* }
*/
public static long[] file$dimensions() {
return file$DIMS;
}
public static void line$set(MemorySegment seg, long index, int x) {
sdrplay_api_ErrorInfoT.line$VH.set(seg.asSlice(index*sizeof()), x);
private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char file[256]
* }
*/
public static byte file(MemorySegment struct, long index0) {
return (byte)file$ELEM_HANDLE.get(struct, 0L, index0);
}
public static MemorySegment message$slice(MemorySegment seg) {
return seg.asSlice(516, 1024);
/**
* Indexed setter for field:
* {@snippet lang=c :
* char file[256]
* }
*/
public static void file(MemorySegment struct, long index0, byte fieldValue) {
file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function"));
/**
* Layout for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static final SequenceLayout function$layout() {
return function$LAYOUT;
}
private static final long function$OFFSET = 256;
/**
* Offset for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static final long function$offset() {
return function$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static MemorySegment function(MemorySegment struct) {
return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static void function(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize());
}
private static long[] function$DIMS = { 256 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static long[] function$dimensions() {
return function$DIMS;
}
private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static byte function(MemorySegment struct, long index0) {
return (byte)function$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* char function[256]
* }
*/
public static void function(MemorySegment struct, long index0, byte fieldValue) {
function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line"));
/**
* Layout for field:
* {@snippet lang=c :
* int line
* }
*/
public static final OfInt line$layout() {
return line$LAYOUT;
}
private static final long line$OFFSET = 512;
/**
* Offset for field:
* {@snippet lang=c :
* int line
* }
*/
public static final long line$offset() {
return line$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* int line
* }
*/
public static int line(MemorySegment struct) {
return struct.get(line$LAYOUT, line$OFFSET);
}
/**
* Setter for field:
* {@snippet lang=c :
* int line
* }
*/
public static void line(MemorySegment struct, int fieldValue) {
struct.set(line$LAYOUT, line$OFFSET, fieldValue);
}
private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message"));
/**
* Layout for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static final SequenceLayout message$layout() {
return message$LAYOUT;
}
private static final long message$OFFSET = 516;
/**
* Offset for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static final long message$offset() {
return message$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static MemorySegment message(MemorySegment struct) {
return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static void message(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize());
}
private static long[] message$DIMS = { 1024 };
/**
* Dimensions for array field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static long[] message$dimensions() {
return message$DIMS;
}
private static final VarHandle message$ELEM_HANDLE = message$LAYOUT.varHandle(sequenceElement());
/**
* Indexed getter for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static byte message(MemorySegment struct, long index0) {
return (byte)message$ELEM_HANDLE.get(struct, 0L, index0);
}
/**
* Indexed setter for field:
* {@snippet lang=c :
* char message[1024]
* }
*/
public static void message(MemorySegment struct, long index0, byte fieldValue) {
message$ELEM_HANDLE.set(struct, 0L, index0, fieldValue);
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,65 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* void (*sdrplay_api_EventCallback_t)(enum eventId,enum tuner,union * params,void* cbContext);
* {@snippet lang=c :
* typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *)
* }
*/
public interface sdrplay_api_EventCallback_t {
public class sdrplay_api_EventCallback_t {
void apply(int eventId, int tuner, java.lang.foreign.MemorySegment params, java.lang.foreign.MemorySegment cbContext);
static MemorySegment allocate(sdrplay_api_EventCallback_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$0.sdrplay_api_EventCallback_t_UP$MH, fi, constants$0.sdrplay_api_EventCallback_t$FUNC, scope);
sdrplay_api_EventCallback_t() {
// Should not be called directly
}
static sdrplay_api_EventCallback_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (int _eventId, int _tuner, java.lang.foreign.MemorySegment _params, java.lang.foreign.MemorySegment _cbContext) -> {
try {
constants$0.sdrplay_api_EventCallback_t_DOWN$MH.invokeExact(symbol, _eventId, _tuner, _params, _cbContext);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) {
try {
DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,54 +21,217 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.UnionLayout;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
/**
* {@snippet :
* {@snippet lang=c :
* union {
* sdrplay_api_GainCbParamT gainParams;
* sdrplay_api_PowerOverloadCbParamT powerOverloadParams;
* sdrplay_api_RspDuoModeCbParamT rspDuoModeParams;
* };
* }
* }
*/
public class sdrplay_api_EventParamsT {
static final UnionLayout $union$LAYOUT = MemoryLayout.unionLayout(
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("gRdB"),
Constants$root.C_INT$LAYOUT.withName("lnaGRdB"),
Constants$root.C_DOUBLE$LAYOUT.withName("currGain")
).withName("gainParams"),
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType")
).withName("powerOverloadParams"),
MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("modeChangeType")
).withName("rspDuoModeParams")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_EventParamsT.$union$LAYOUT;
sdrplay_api_EventParamsT() {
// Should not be called directly
}
public static MemorySegment gainParams$slice(MemorySegment seg) {
return seg.asSlice(0, 16);
private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout(
sdrplay_api_GainCbParamT.layout().withName("gainParams"),
sdrplay_api_PowerOverloadCbParamT.layout().withName("powerOverloadParams"),
sdrplay_api_RspDuoModeCbParamT.layout().withName("rspDuoModeParams")
).withName("$anon$49:9");
/**
* The layout of this union
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
public static MemorySegment powerOverloadParams$slice(MemorySegment seg) {
return seg.asSlice(0, 4);
private static final GroupLayout gainParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_GainCbParamT gainParams
* }
*/
public static final GroupLayout gainParams$layout() {
return gainParams$LAYOUT;
}
public static MemorySegment rspDuoModeParams$slice(MemorySegment seg) {
return seg.asSlice(0, 4);
private static final long gainParams$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_GainCbParamT gainParams
* }
*/
public static final long gainParams$offset() {
return gainParams$OFFSET;
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_GainCbParamT gainParams
* }
*/
public static MemorySegment gainParams(MemorySegment union) {
return union.asSlice(gainParams$OFFSET, gainParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_GainCbParamT gainParams
* }
*/
public static void gainParams(MemorySegment union, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, union, gainParams$OFFSET, gainParams$LAYOUT.byteSize());
}
private static final GroupLayout powerOverloadParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("powerOverloadParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbParamT powerOverloadParams
* }
*/
public static final GroupLayout powerOverloadParams$layout() {
return powerOverloadParams$LAYOUT;
}
private static final long powerOverloadParams$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbParamT powerOverloadParams
* }
*/
public static final long powerOverloadParams$offset() {
return powerOverloadParams$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbParamT powerOverloadParams
* }
*/
public static MemorySegment powerOverloadParams(MemorySegment union) {
return union.asSlice(powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbParamT powerOverloadParams
* }
*/
public static void powerOverloadParams(MemorySegment union, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, union, powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize());
}
private static final GroupLayout rspDuoModeParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoModeParams"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeCbParamT rspDuoModeParams
* }
*/
public static final GroupLayout rspDuoModeParams$layout() {
return rspDuoModeParams$LAYOUT;
}
private static final long rspDuoModeParams$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeCbParamT rspDuoModeParams
* }
*/
public static final long rspDuoModeParams$offset() {
return rspDuoModeParams$OFFSET;
}
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeCbParamT rspDuoModeParams
* }
*/
public static MemorySegment rspDuoModeParams(MemorySegment union) {
return union.asSlice(rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize());
}
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_RspDuoModeCbParamT rspDuoModeParams
* }
*/
public static void rspDuoModeParams(MemorySegment union, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, union, rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize());
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this union
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,123 +21,220 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfDouble;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* double fsHz;
* unsigned char syncUpdate;
* unsigned char reCal;
* };
* }
* }
*/
public class sdrplay_api_FsFreqT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"),
Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("reCal"),
MemoryLayout.paddingLayout(48)
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_FsFreqT.$struct$LAYOUT;
sdrplay_api_FsFreqT() {
// Should not be called directly
}
static final VarHandle fsHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsHz"));
public static VarHandle fsHz$VH() {
return sdrplay_api_FsFreqT.fsHz$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_DOUBLE.withName("fsHz"),
sdrplay_api_h.C_CHAR.withName("syncUpdate"),
sdrplay_api_h.C_CHAR.withName("reCal"),
MemoryLayout.paddingLayout(6)
).withName("$anon$17:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz"));
/**
* Layout for field:
* {@snippet lang=c :
* double fsHz
* }
*/
public static final OfDouble fsHz$layout() {
return fsHz$LAYOUT;
}
private static final long fsHz$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* double fsHz
* }
*/
public static final long fsHz$offset() {
return fsHz$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* double fsHz;
* {@snippet lang=c :
* double fsHz
* }
*/
public static double fsHz$get(MemorySegment seg) {
return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg);
public static double fsHz(MemorySegment struct) {
return struct.get(fsHz$LAYOUT, fsHz$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* double fsHz;
* {@snippet lang=c :
* double fsHz
* }
*/
public static void fsHz$set(MemorySegment seg, double x) {
sdrplay_api_FsFreqT.fsHz$VH.set(seg, x);
public static void fsHz(MemorySegment struct, double fieldValue) {
struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue);
}
public static double fsHz$get(MemorySegment seg, long index) {
return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final OfByte syncUpdate$layout() {
return syncUpdate$LAYOUT;
}
public static void fsHz$set(MemorySegment seg, long index, double x) {
sdrplay_api_FsFreqT.fsHz$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate"));
public static VarHandle syncUpdate$VH() {
return sdrplay_api_FsFreqT.syncUpdate$VH;
private static final long syncUpdate$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final long syncUpdate$offset() {
return syncUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static byte syncUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg);
public static byte syncUpdate(MemorySegment struct) {
return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static void syncUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_FsFreqT.syncUpdate$VH.set(seg, x);
public static void syncUpdate(MemorySegment struct, byte fieldValue) {
struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue);
}
public static byte syncUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte reCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("reCal"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char reCal
* }
*/
public static final OfByte reCal$layout() {
return reCal$LAYOUT;
}
public static void syncUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_FsFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle reCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("reCal"));
public static VarHandle reCal$VH() {
return sdrplay_api_FsFreqT.reCal$VH;
private static final long reCal$OFFSET = 9;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char reCal
* }
*/
public static final long reCal$offset() {
return reCal$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char reCal;
* {@snippet lang=c :
* unsigned char reCal
* }
*/
public static byte reCal$get(MemorySegment seg) {
return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg);
public static byte reCal(MemorySegment struct) {
return struct.get(reCal$LAYOUT, reCal$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char reCal;
* {@snippet lang=c :
* unsigned char reCal
* }
*/
public static void reCal$set(MemorySegment seg, byte x) {
sdrplay_api_FsFreqT.reCal$VH.set(seg, x);
public static void reCal(MemorySegment struct, byte fieldValue) {
struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue);
}
public static byte reCal$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void reCal$set(MemorySegment seg, long index, byte x) {
sdrplay_api_FsFreqT.reCal$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,122 +21,219 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfDouble;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned int gRdB;
* unsigned int lnaGRdB;
* double currGain;
* };
* }
* }
*/
public class sdrplay_api_GainCbParamT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("gRdB"),
Constants$root.C_INT$LAYOUT.withName("lnaGRdB"),
Constants$root.C_DOUBLE$LAYOUT.withName("currGain")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_GainCbParamT.$struct$LAYOUT;
sdrplay_api_GainCbParamT() {
// Should not be called directly
}
static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB"));
public static VarHandle gRdB$VH() {
return sdrplay_api_GainCbParamT.gRdB$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_INT.withName("gRdB"),
sdrplay_api_h.C_INT.withName("lnaGRdB"),
sdrplay_api_h.C_DOUBLE.withName("currGain")
).withName("$anon$31:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int gRdB
* }
*/
public static final OfInt gRdB$layout() {
return gRdB$LAYOUT;
}
private static final long gRdB$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int gRdB
* }
*/
public static final long gRdB$offset() {
return gRdB$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned int gRdB;
* {@snippet lang=c :
* unsigned int gRdB
* }
*/
public static int gRdB$get(MemorySegment seg) {
return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg);
public static int gRdB(MemorySegment struct) {
return struct.get(gRdB$LAYOUT, gRdB$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned int gRdB;
* {@snippet lang=c :
* unsigned int gRdB
* }
*/
public static void gRdB$set(MemorySegment seg, int x) {
sdrplay_api_GainCbParamT.gRdB$VH.set(seg, x);
public static void gRdB(MemorySegment struct, int fieldValue) {
struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue);
}
public static int gRdB$get(MemorySegment seg, long index) {
return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt lnaGRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("lnaGRdB"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned int lnaGRdB
* }
*/
public static final OfInt lnaGRdB$layout() {
return lnaGRdB$LAYOUT;
}
public static void gRdB$set(MemorySegment seg, long index, int x) {
sdrplay_api_GainCbParamT.gRdB$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle lnaGRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("lnaGRdB"));
public static VarHandle lnaGRdB$VH() {
return sdrplay_api_GainCbParamT.lnaGRdB$VH;
private static final long lnaGRdB$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned int lnaGRdB
* }
*/
public static final long lnaGRdB$offset() {
return lnaGRdB$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned int lnaGRdB;
* {@snippet lang=c :
* unsigned int lnaGRdB
* }
*/
public static int lnaGRdB$get(MemorySegment seg) {
return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg);
public static int lnaGRdB(MemorySegment struct) {
return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned int lnaGRdB;
* {@snippet lang=c :
* unsigned int lnaGRdB
* }
*/
public static void lnaGRdB$set(MemorySegment seg, int x) {
sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg, x);
public static void lnaGRdB(MemorySegment struct, int fieldValue) {
struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue);
}
public static int lnaGRdB$get(MemorySegment seg, long index) {
return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg.asSlice(index*sizeof()));
private static final OfDouble currGain$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("currGain"));
/**
* Layout for field:
* {@snippet lang=c :
* double currGain
* }
*/
public static final OfDouble currGain$layout() {
return currGain$LAYOUT;
}
public static void lnaGRdB$set(MemorySegment seg, long index, int x) {
sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle currGain$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("currGain"));
public static VarHandle currGain$VH() {
return sdrplay_api_GainCbParamT.currGain$VH;
private static final long currGain$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* double currGain
* }
*/
public static final long currGain$offset() {
return currGain$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* double currGain;
* {@snippet lang=c :
* double currGain
* }
*/
public static double currGain$get(MemorySegment seg) {
return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg);
public static double currGain(MemorySegment struct) {
return struct.get(currGain$LAYOUT, currGain$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* double currGain;
* {@snippet lang=c :
* double currGain
* }
*/
public static void currGain$set(MemorySegment seg, double x) {
sdrplay_api_GainCbParamT.currGain$VH.set(seg, x);
public static void currGain(MemorySegment struct, double fieldValue) {
struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue);
}
public static double currGain$get(MemorySegment seg, long index) {
return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void currGain$set(MemorySegment seg, long index, double x) {
sdrplay_api_GainCbParamT.currGain$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,162 +21,312 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* int gRdB;
* unsigned char LNAstate;
* unsigned char syncUpdate;
* sdrplay_api_MinGainReductionT minGr;
* sdrplay_api_GainValuesT gainVals;
* };
* }
* }
*/
public class sdrplay_api_GainT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("gRdB"),
Constants$root.C_CHAR$LAYOUT.withName("LNAstate"),
Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"),
MemoryLayout.paddingLayout(16),
Constants$root.C_INT$LAYOUT.withName("minGr"),
MemoryLayout.structLayout(
Constants$root.C_FLOAT$LAYOUT.withName("curr"),
Constants$root.C_FLOAT$LAYOUT.withName("max"),
Constants$root.C_FLOAT$LAYOUT.withName("min")
).withName("gainVals")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_GainT.$struct$LAYOUT;
sdrplay_api_GainT() {
// Should not be called directly
}
static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB"));
public static VarHandle gRdB$VH() {
return sdrplay_api_GainT.gRdB$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_INT.withName("gRdB"),
sdrplay_api_h.C_CHAR.withName("LNAstate"),
sdrplay_api_h.C_CHAR.withName("syncUpdate"),
MemoryLayout.paddingLayout(2),
sdrplay_api_h.C_INT.withName("minGr"),
sdrplay_api_GainValuesT.layout().withName("gainVals")
).withName("$anon$60:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB"));
/**
* Layout for field:
* {@snippet lang=c :
* int gRdB
* }
*/
public static final OfInt gRdB$layout() {
return gRdB$LAYOUT;
}
private static final long gRdB$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* int gRdB
* }
*/
public static final long gRdB$offset() {
return gRdB$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* int gRdB;
* {@snippet lang=c :
* int gRdB
* }
*/
public static int gRdB$get(MemorySegment seg) {
return (int)sdrplay_api_GainT.gRdB$VH.get(seg);
public static int gRdB(MemorySegment struct) {
return struct.get(gRdB$LAYOUT, gRdB$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* int gRdB;
* {@snippet lang=c :
* int gRdB
* }
*/
public static void gRdB$set(MemorySegment seg, int x) {
sdrplay_api_GainT.gRdB$VH.set(seg, x);
public static void gRdB(MemorySegment struct, int fieldValue) {
struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue);
}
public static int gRdB$get(MemorySegment seg, long index) {
return (int)sdrplay_api_GainT.gRdB$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte LNAstate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("LNAstate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char LNAstate
* }
*/
public static final OfByte LNAstate$layout() {
return LNAstate$LAYOUT;
}
public static void gRdB$set(MemorySegment seg, long index, int x) {
sdrplay_api_GainT.gRdB$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle LNAstate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("LNAstate"));
public static VarHandle LNAstate$VH() {
return sdrplay_api_GainT.LNAstate$VH;
private static final long LNAstate$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char LNAstate
* }
*/
public static final long LNAstate$offset() {
return LNAstate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char LNAstate;
* {@snippet lang=c :
* unsigned char LNAstate
* }
*/
public static byte LNAstate$get(MemorySegment seg) {
return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg);
public static byte LNAstate(MemorySegment struct) {
return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char LNAstate;
* {@snippet lang=c :
* unsigned char LNAstate
* }
*/
public static void LNAstate$set(MemorySegment seg, byte x) {
sdrplay_api_GainT.LNAstate$VH.set(seg, x);
public static void LNAstate(MemorySegment struct, byte fieldValue) {
struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue);
}
public static byte LNAstate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final OfByte syncUpdate$layout() {
return syncUpdate$LAYOUT;
}
public static void LNAstate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_GainT.LNAstate$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate"));
public static VarHandle syncUpdate$VH() {
return sdrplay_api_GainT.syncUpdate$VH;
private static final long syncUpdate$OFFSET = 5;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final long syncUpdate$offset() {
return syncUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static byte syncUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg);
public static byte syncUpdate(MemorySegment struct) {
return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static void syncUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_GainT.syncUpdate$VH.set(seg, x);
public static void syncUpdate(MemorySegment struct, byte fieldValue) {
struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue);
}
public static byte syncUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg.asSlice(index*sizeof()));
private static final OfInt minGr$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minGr"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_MinGainReductionT minGr
* }
*/
public static final OfInt minGr$layout() {
return minGr$LAYOUT;
}
public static void syncUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_GainT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle minGr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("minGr"));
public static VarHandle minGr$VH() {
return sdrplay_api_GainT.minGr$VH;
private static final long minGr$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_MinGainReductionT minGr
* }
*/
public static final long minGr$offset() {
return minGr$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_MinGainReductionT minGr;
* {@snippet lang=c :
* sdrplay_api_MinGainReductionT minGr
* }
*/
public static int minGr$get(MemorySegment seg) {
return (int)sdrplay_api_GainT.minGr$VH.get(seg);
public static int minGr(MemorySegment struct) {
return struct.get(minGr$LAYOUT, minGr$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_MinGainReductionT minGr;
* {@snippet lang=c :
* sdrplay_api_MinGainReductionT minGr
* }
*/
public static void minGr$set(MemorySegment seg, int x) {
sdrplay_api_GainT.minGr$VH.set(seg, x);
public static void minGr(MemorySegment struct, int fieldValue) {
struct.set(minGr$LAYOUT, minGr$OFFSET, fieldValue);
}
public static int minGr$get(MemorySegment seg, long index) {
return (int)sdrplay_api_GainT.minGr$VH.get(seg.asSlice(index*sizeof()));
private static final GroupLayout gainVals$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainVals"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_GainValuesT gainVals
* }
*/
public static final GroupLayout gainVals$layout() {
return gainVals$LAYOUT;
}
public static void minGr$set(MemorySegment seg, long index, int x) {
sdrplay_api_GainT.minGr$VH.set(seg.asSlice(index*sizeof()), x);
private static final long gainVals$OFFSET = 12;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_GainValuesT gainVals
* }
*/
public static final long gainVals$offset() {
return gainVals$OFFSET;
}
public static MemorySegment gainVals$slice(MemorySegment seg) {
return seg.asSlice(12, 12);
/**
* Getter for field:
* {@snippet lang=c :
* sdrplay_api_GainValuesT gainVals
* }
*/
public static MemorySegment gainVals(MemorySegment struct) {
return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Setter for field:
* {@snippet lang=c :
* sdrplay_api_GainValuesT gainVals
* }
*/
public static void gainVals(MemorySegment struct, MemorySegment fieldValue) {
MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize());
}
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,122 +21,218 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfFloat;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* float curr;
* float max;
* float min;
* };
* }
* }
*/
public class sdrplay_api_GainValuesT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_FLOAT$LAYOUT.withName("curr"),
Constants$root.C_FLOAT$LAYOUT.withName("max"),
Constants$root.C_FLOAT$LAYOUT.withName("min")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_GainValuesT.$struct$LAYOUT;
sdrplay_api_GainValuesT() {
// Should not be called directly
}
static final VarHandle curr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("curr"));
public static VarHandle curr$VH() {
return sdrplay_api_GainValuesT.curr$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_FLOAT.withName("curr"),
sdrplay_api_h.C_FLOAT.withName("max"),
sdrplay_api_h.C_FLOAT.withName("min")
).withName("$anon$53:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr"));
/**
* Layout for field:
* {@snippet lang=c :
* float curr
* }
*/
public static final OfFloat curr$layout() {
return curr$LAYOUT;
}
private static final long curr$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* float curr
* }
*/
public static final long curr$offset() {
return curr$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* float curr;
* {@snippet lang=c :
* float curr
* }
*/
public static float curr$get(MemorySegment seg) {
return (float)sdrplay_api_GainValuesT.curr$VH.get(seg);
public static float curr(MemorySegment struct) {
return struct.get(curr$LAYOUT, curr$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* float curr;
* {@snippet lang=c :
* float curr
* }
*/
public static void curr$set(MemorySegment seg, float x) {
sdrplay_api_GainValuesT.curr$VH.set(seg, x);
public static void curr(MemorySegment struct, float fieldValue) {
struct.set(curr$LAYOUT, curr$OFFSET, fieldValue);
}
public static float curr$get(MemorySegment seg, long index) {
return (float)sdrplay_api_GainValuesT.curr$VH.get(seg.asSlice(index*sizeof()));
private static final OfFloat max$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("max"));
/**
* Layout for field:
* {@snippet lang=c :
* float max
* }
*/
public static final OfFloat max$layout() {
return max$LAYOUT;
}
public static void curr$set(MemorySegment seg, long index, float x) {
sdrplay_api_GainValuesT.curr$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle max$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("max"));
public static VarHandle max$VH() {
return sdrplay_api_GainValuesT.max$VH;
private static final long max$OFFSET = 4;
/**
* Offset for field:
* {@snippet lang=c :
* float max
* }
*/
public static final long max$offset() {
return max$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* float max;
* {@snippet lang=c :
* float max
* }
*/
public static float max$get(MemorySegment seg) {
return (float)sdrplay_api_GainValuesT.max$VH.get(seg);
public static float max(MemorySegment struct) {
return struct.get(max$LAYOUT, max$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* float max;
* {@snippet lang=c :
* float max
* }
*/
public static void max$set(MemorySegment seg, float x) {
sdrplay_api_GainValuesT.max$VH.set(seg, x);
public static void max(MemorySegment struct, float fieldValue) {
struct.set(max$LAYOUT, max$OFFSET, fieldValue);
}
public static float max$get(MemorySegment seg, long index) {
return (float)sdrplay_api_GainValuesT.max$VH.get(seg.asSlice(index*sizeof()));
private static final OfFloat min$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("min"));
/**
* Layout for field:
* {@snippet lang=c :
* float min
* }
*/
public static final OfFloat min$layout() {
return min$LAYOUT;
}
public static void max$set(MemorySegment seg, long index, float x) {
sdrplay_api_GainValuesT.max$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle min$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("min"));
public static VarHandle min$VH() {
return sdrplay_api_GainValuesT.min$VH;
private static final long min$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* float min
* }
*/
public static final long min$offset() {
return min$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* float min;
* {@snippet lang=c :
* float min
* }
*/
public static float min$get(MemorySegment seg) {
return (float)sdrplay_api_GainValuesT.min$VH.get(seg);
public static float min(MemorySegment struct) {
return struct.get(min$LAYOUT, min$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* float min;
* {@snippet lang=c :
* float min
* }
*/
public static void min$set(MemorySegment seg, float x) {
sdrplay_api_GainValuesT.min$VH.set(seg, x);
public static void min(MemorySegment struct, float fieldValue) {
struct.set(min$LAYOUT, min$OFFSET, fieldValue);
}
public static float min$get(MemorySegment seg, long index) {
return (float)sdrplay_api_GainValuesT.min$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void min$set(MemorySegment seg, long index, float x) {
sdrplay_api_GainValuesT.min$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,64 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_GetDeviceParams_t)(void* dev,struct ** deviceParams);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **)
* }
*/
public interface sdrplay_api_GetDeviceParams_t {
public class sdrplay_api_GetDeviceParams_t {
int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment deviceParams);
static MemorySegment allocate(sdrplay_api_GetDeviceParams_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$4.sdrplay_api_GetDeviceParams_t_UP$MH, fi, constants$4.sdrplay_api_GetDeviceParams_t$FUNC, scope);
sdrplay_api_GetDeviceParams_t() {
// Should not be called directly
}
static sdrplay_api_GetDeviceParams_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _deviceParams) -> {
try {
return (int)constants$4.sdrplay_api_GetDeviceParams_t_DOWN$MH.invokeExact(symbol, _dev, _deviceParams);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment dev, MemorySegment deviceParams);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,65 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_GetDevices_t)(struct * devices,unsigned int* numDevs,unsigned int maxDevs);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int)
* }
*/
public interface sdrplay_api_GetDevices_t {
public class sdrplay_api_GetDevices_t {
int apply(java.lang.foreign.MemorySegment devices, java.lang.foreign.MemorySegment numDevs, int maxDevs);
static MemorySegment allocate(sdrplay_api_GetDevices_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$2.sdrplay_api_GetDevices_t_UP$MH, fi, constants$2.sdrplay_api_GetDevices_t$FUNC, scope);
sdrplay_api_GetDevices_t() {
// Should not be called directly
}
static sdrplay_api_GetDevices_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _devices, java.lang.foreign.MemorySegment _numDevs, int _maxDevs) -> {
try {
return (int)constants$2.sdrplay_api_GetDevices_t_DOWN$MH.invokeExact(symbol, _devices, _numDevs, _maxDevs);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,63 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* char* (*sdrplay_api_GetErrorString_t)(enum err);
* {@snippet lang=c :
* typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT)
* }
*/
public interface sdrplay_api_GetErrorString_t {
public class sdrplay_api_GetErrorString_t {
java.lang.foreign.MemorySegment apply(int err);
static MemorySegment allocate(sdrplay_api_GetErrorString_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetErrorString_t_UP$MH, fi, constants$3.sdrplay_api_GetErrorString_t$FUNC, scope);
sdrplay_api_GetErrorString_t() {
// Should not be called directly
}
static sdrplay_api_GetErrorString_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (int _err) -> {
try {
return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetErrorString_t_DOWN$MH.invokeExact(symbol, _err);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
MemorySegment apply(int err);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_INT
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static MemorySegment invoke(MemorySegment funcPtr,int err) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,63 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* struct * (*sdrplay_api_GetLastError_t)(struct * device);
* {@snippet lang=c :
* typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *)
* }
*/
public interface sdrplay_api_GetLastError_t {
public class sdrplay_api_GetLastError_t {
java.lang.foreign.MemorySegment apply(java.lang.foreign.MemorySegment device);
static MemorySegment allocate(sdrplay_api_GetLastError_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetLastError_t_UP$MH, fi, constants$3.sdrplay_api_GetLastError_t$FUNC, scope);
sdrplay_api_GetLastError_t() {
// Should not be called directly
}
static sdrplay_api_GetLastError_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _device) -> {
try {
return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetLastError_t_DOWN$MH.invokeExact(symbol, _device);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
MemorySegment apply(MemorySegment device);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) {
try {
return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,65 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_Init_t)(void* dev,struct * callbackFns,void* cbContext);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *)
* }
*/
public interface sdrplay_api_Init_t {
public class sdrplay_api_Init_t {
int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment callbackFns, java.lang.foreign.MemorySegment cbContext);
static MemorySegment allocate(sdrplay_api_Init_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Init_t_UP$MH, fi, constants$5.sdrplay_api_Init_t$FUNC, scope);
sdrplay_api_Init_t() {
// Should not be called directly
}
static sdrplay_api_Init_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _callbackFns, java.lang.foreign.MemorySegment _cbContext) -> {
try {
return (int)constants$5.sdrplay_api_Init_t_DOWN$MH.invokeExact(symbol, _dev, _callbackFns, _cbContext);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,61 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_LockDeviceApi_t)();
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void)
* }
*/
public interface sdrplay_api_LockDeviceApi_t {
public class sdrplay_api_LockDeviceApi_t {
int apply();
static MemorySegment allocate(sdrplay_api_LockDeviceApi_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$1.sdrplay_api_LockDeviceApi_t_UP$MH, fi, constants$1.sdrplay_api_LockDeviceApi_t$FUNC, scope);
sdrplay_api_LockDeviceApi_t() {
// Should not be called directly
}
static sdrplay_api_LockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return () -> {
try {
return (int)constants$1.sdrplay_api_LockDeviceApi_t_DOWN$MH.invokeExact(symbol);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply();
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr) {
try {
return (int) DOWN$MH.invokeExact(funcPtr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,61 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_Open_t)();
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void)
* }
*/
public interface sdrplay_api_Open_t {
public class sdrplay_api_Open_t {
int apply();
static MemorySegment allocate(sdrplay_api_Open_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$0.sdrplay_api_Open_t_UP$MH, fi, constants$0.sdrplay_api_Open_t$FUNC, scope);
sdrplay_api_Open_t() {
// Should not be called directly
}
static sdrplay_api_Open_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return () -> {
try {
return (int)constants$0.sdrplay_api_Open_t_DOWN$MH.invokeExact(symbol);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply();
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr) {
try {
return (int) DOWN$MH.invokeExact(funcPtr);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,62 +21,126 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfInt;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType;
* };
* }
* }
*/
public class sdrplay_api_PowerOverloadCbParamT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_PowerOverloadCbParamT.$struct$LAYOUT;
sdrplay_api_PowerOverloadCbParamT() {
// Should not be called directly
}
static final VarHandle powerOverloadChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("powerOverloadChangeType"));
public static VarHandle powerOverloadChangeType$VH() {
return sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_INT.withName("powerOverloadChangeType")
).withName("$anon$38:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType"));
/**
* Layout for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType
* }
*/
public static final OfInt powerOverloadChangeType$layout() {
return powerOverloadChangeType$LAYOUT;
}
private static final long powerOverloadChangeType$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType
* }
*/
public static final long powerOverloadChangeType$offset() {
return powerOverloadChangeType$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType;
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType
* }
*/
public static int powerOverloadChangeType$get(MemorySegment seg) {
return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg);
public static int powerOverloadChangeType(MemorySegment struct) {
return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType;
* {@snippet lang=c :
* sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType
* }
*/
public static void powerOverloadChangeType$set(MemorySegment seg, int x) {
sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg, x);
public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) {
struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue);
}
public static int powerOverloadChangeType$get(MemorySegment seg, long index) {
return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void powerOverloadChangeType$set(MemorySegment seg, long index, int x) {
sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,30 +21,63 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.FunctionDescriptor;
import java.lang.foreign.Linker;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentScope;
import java.lang.invoke.MethodHandle;
/**
* {@snippet :
* enum (*sdrplay_api_ReleaseDevice_t)(struct * device);
* {@snippet lang=c :
* typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *)
* }
*/
public interface sdrplay_api_ReleaseDevice_t {
public class sdrplay_api_ReleaseDevice_t {
int apply(java.lang.foreign.MemorySegment currentSampleRate);
static MemorySegment allocate(sdrplay_api_ReleaseDevice_t fi, SegmentScope scope) {
return RuntimeHelper.upcallStub(constants$3.sdrplay_api_ReleaseDevice_t_UP$MH, fi, constants$3.sdrplay_api_ReleaseDevice_t$FUNC, scope);
sdrplay_api_ReleaseDevice_t() {
// Should not be called directly
}
static sdrplay_api_ReleaseDevice_t ofAddress(MemorySegment addr, SegmentScope scope) {
MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope);
return (java.lang.foreign.MemorySegment _currentSampleRate) -> {
try {
return (int)constants$3.sdrplay_api_ReleaseDevice_t_DOWN$MH.invokeExact(symbol, _currentSampleRate);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
};
/**
* The function pointer signature, expressed as a functional interface
*/
public interface Function {
int apply(MemorySegment device);
}
private static final FunctionDescriptor $DESC = FunctionDescriptor.of(
sdrplay_api_h.C_INT,
sdrplay_api_h.C_POINTER
);
/**
* The descriptor of this function pointer
*/
public static FunctionDescriptor descriptor() {
return $DESC;
}
private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC);
/**
* Allocates a new upcall stub, whose implementation is defined by {@code fi}.
* The lifetime of the returned segment is managed by {@code arena}
*/
public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) {
return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena);
}
private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC);
/**
* Invoke the upcall stub {@code funcPtr}, with given parameters
*/
public static int invoke(MemorySegment funcPtr,MemorySegment device) {
try {
return (int) DOWN$MH.invokeExact(funcPtr, device);
} catch (Throwable ex$) {
throw new AssertionError("should not reach here", ex$);
}
}
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,122 +21,218 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char resetGainUpdate;
* unsigned char resetRfUpdate;
* unsigned char resetFsUpdate;
* };
* }
* }
*/
public class sdrplay_api_ResetFlagsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"),
Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_ResetFlagsT.$struct$LAYOUT;
sdrplay_api_ResetFlagsT() {
// Should not be called directly
}
static final VarHandle resetGainUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetGainUpdate"));
public static VarHandle resetGainUpdate$VH() {
return sdrplay_api_ResetFlagsT.resetGainUpdate$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("resetGainUpdate"),
sdrplay_api_h.C_CHAR.withName("resetRfUpdate"),
sdrplay_api_h.C_CHAR.withName("resetFsUpdate")
).withName("$anon$30:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char resetGainUpdate
* }
*/
public static final OfByte resetGainUpdate$layout() {
return resetGainUpdate$LAYOUT;
}
private static final long resetGainUpdate$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char resetGainUpdate
* }
*/
public static final long resetGainUpdate$offset() {
return resetGainUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char resetGainUpdate;
* {@snippet lang=c :
* unsigned char resetGainUpdate
* }
*/
public static byte resetGainUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg);
public static byte resetGainUpdate(MemorySegment struct) {
return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char resetGainUpdate;
* {@snippet lang=c :
* unsigned char resetGainUpdate
* }
*/
public static void resetGainUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg, x);
public static void resetGainUpdate(MemorySegment struct, byte fieldValue) {
struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue);
}
public static byte resetGainUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte resetRfUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetRfUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char resetRfUpdate
* }
*/
public static final OfByte resetRfUpdate$layout() {
return resetRfUpdate$LAYOUT;
}
public static void resetGainUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle resetRfUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetRfUpdate"));
public static VarHandle resetRfUpdate$VH() {
return sdrplay_api_ResetFlagsT.resetRfUpdate$VH;
private static final long resetRfUpdate$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char resetRfUpdate
* }
*/
public static final long resetRfUpdate$offset() {
return resetRfUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char resetRfUpdate;
* {@snippet lang=c :
* unsigned char resetRfUpdate
* }
*/
public static byte resetRfUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg);
public static byte resetRfUpdate(MemorySegment struct) {
return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char resetRfUpdate;
* {@snippet lang=c :
* unsigned char resetRfUpdate
* }
*/
public static void resetRfUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg, x);
public static void resetRfUpdate(MemorySegment struct, byte fieldValue) {
struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue);
}
public static byte resetRfUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte resetFsUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetFsUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char resetFsUpdate
* }
*/
public static final OfByte resetFsUpdate$layout() {
return resetFsUpdate$LAYOUT;
}
public static void resetRfUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle resetFsUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetFsUpdate"));
public static VarHandle resetFsUpdate$VH() {
return sdrplay_api_ResetFlagsT.resetFsUpdate$VH;
private static final long resetFsUpdate$OFFSET = 2;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char resetFsUpdate
* }
*/
public static final long resetFsUpdate$offset() {
return resetFsUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char resetFsUpdate;
* {@snippet lang=c :
* unsigned char resetFsUpdate
* }
*/
public static byte resetFsUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg);
public static byte resetFsUpdate(MemorySegment struct) {
return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char resetFsUpdate;
* {@snippet lang=c :
* unsigned char resetFsUpdate
* }
*/
public static void resetFsUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg, x);
public static void resetFsUpdate(MemorySegment struct, byte fieldValue) {
struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue);
}
public static byte resetFsUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void resetFsUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,93 +21,174 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
import static java.lang.foreign.ValueLayout.OfDouble;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* double rfHz;
* unsigned char syncUpdate;
* };
* }
* }
*/
public class sdrplay_api_RfFreqT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"),
Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"),
MemoryLayout.paddingLayout(56)
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_RfFreqT.$struct$LAYOUT;
sdrplay_api_RfFreqT() {
// Should not be called directly
}
static final VarHandle rfHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfHz"));
public static VarHandle rfHz$VH() {
return sdrplay_api_RfFreqT.rfHz$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_DOUBLE.withName("rfHz"),
sdrplay_api_h.C_CHAR.withName("syncUpdate"),
MemoryLayout.paddingLayout(7)
).withName("$anon$69:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz"));
/**
* Layout for field:
* {@snippet lang=c :
* double rfHz
* }
*/
public static final OfDouble rfHz$layout() {
return rfHz$LAYOUT;
}
private static final long rfHz$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* double rfHz
* }
*/
public static final long rfHz$offset() {
return rfHz$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* double rfHz;
* {@snippet lang=c :
* double rfHz
* }
*/
public static double rfHz$get(MemorySegment seg) {
return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg);
public static double rfHz(MemorySegment struct) {
return struct.get(rfHz$LAYOUT, rfHz$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* double rfHz;
* {@snippet lang=c :
* double rfHz
* }
*/
public static void rfHz$set(MemorySegment seg, double x) {
sdrplay_api_RfFreqT.rfHz$VH.set(seg, x);
public static void rfHz(MemorySegment struct, double fieldValue) {
struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue);
}
public static double rfHz$get(MemorySegment seg, long index) {
return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final OfByte syncUpdate$layout() {
return syncUpdate$LAYOUT;
}
public static void rfHz$set(MemorySegment seg, long index, double x) {
sdrplay_api_RfFreqT.rfHz$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate"));
public static VarHandle syncUpdate$VH() {
return sdrplay_api_RfFreqT.syncUpdate$VH;
private static final long syncUpdate$OFFSET = 8;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static final long syncUpdate$offset() {
return syncUpdate$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static byte syncUpdate$get(MemorySegment seg) {
return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg);
public static byte syncUpdate(MemorySegment struct) {
return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char syncUpdate;
* {@snippet lang=c :
* unsigned char syncUpdate
* }
*/
public static void syncUpdate$set(MemorySegment seg, byte x) {
sdrplay_api_RfFreqT.syncUpdate$VH.set(seg, x);
public static void syncUpdate(MemorySegment struct, byte fieldValue) {
struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue);
}
public static byte syncUpdate$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void syncUpdate$set(MemorySegment seg, long index, byte x) {
sdrplay_api_RfFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,92 +21,172 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char rfNotchEnable;
* unsigned char rfDabNotchEnable;
* };
* }
* }
*/
public class sdrplay_api_Rsp1aParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"),
Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_Rsp1aParamsT.$struct$LAYOUT;
sdrplay_api_Rsp1aParamsT() {
// Should not be called directly
}
static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable"));
public static VarHandle rfNotchEnable$VH() {
return sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("rfNotchEnable"),
sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable")
).withName("$anon$11:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char rfNotchEnable
* }
*/
public static final OfByte rfNotchEnable$layout() {
return rfNotchEnable$LAYOUT;
}
private static final long rfNotchEnable$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char rfNotchEnable
* }
*/
public static final long rfNotchEnable$offset() {
return rfNotchEnable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char rfNotchEnable;
* {@snippet lang=c :
* unsigned char rfNotchEnable
* }
*/
public static byte rfNotchEnable$get(MemorySegment seg) {
return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg);
public static byte rfNotchEnable(MemorySegment struct) {
return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char rfNotchEnable;
* {@snippet lang=c :
* unsigned char rfNotchEnable
* }
*/
public static void rfNotchEnable$set(MemorySegment seg, byte x) {
sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg, x);
public static void rfNotchEnable(MemorySegment struct, byte fieldValue) {
struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue);
}
public static byte rfNotchEnable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof()));
private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char rfDabNotchEnable
* }
*/
public static final OfByte rfDabNotchEnable$layout() {
return rfDabNotchEnable$LAYOUT;
}
public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x);
}
static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable"));
public static VarHandle rfDabNotchEnable$VH() {
return sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH;
private static final long rfDabNotchEnable$OFFSET = 1;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char rfDabNotchEnable
* }
*/
public static final long rfDabNotchEnable$offset() {
return rfDabNotchEnable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char rfDabNotchEnable;
* {@snippet lang=c :
* unsigned char rfDabNotchEnable
* }
*/
public static byte rfDabNotchEnable$get(MemorySegment seg) {
return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg);
public static byte rfDabNotchEnable(MemorySegment struct) {
return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char rfDabNotchEnable;
* {@snippet lang=c :
* unsigned char rfDabNotchEnable
* }
*/
public static void rfDabNotchEnable$set(MemorySegment seg, byte x) {
sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg, x);
public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) {
struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue);
}
public static byte rfDabNotchEnable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,62 +21,126 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.Arena;
import java.lang.foreign.GroupLayout;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.util.function.Consumer;
import static java.lang.foreign.MemoryLayout.PathElement.groupElement;
import static java.lang.foreign.ValueLayout.OfByte;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char biasTEnable;
* };
* }
* }
*/
public class sdrplay_api_Rsp1aTunerParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("biasTEnable")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_Rsp1aTunerParamsT.$struct$LAYOUT;
sdrplay_api_Rsp1aTunerParamsT() {
// Should not be called directly
}
static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable"));
public static VarHandle biasTEnable$VH() {
return sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("biasTEnable")
).withName("$anon$17:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char biasTEnable
* }
*/
public static final OfByte biasTEnable$layout() {
return biasTEnable$LAYOUT;
}
private static final long biasTEnable$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char biasTEnable
* }
*/
public static final long biasTEnable$offset() {
return biasTEnable$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char biasTEnable;
* {@snippet lang=c :
* unsigned char biasTEnable
* }
*/
public static byte biasTEnable$get(MemorySegment seg) {
return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg);
public static byte biasTEnable(MemorySegment struct) {
return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char biasTEnable;
* {@snippet lang=c :
* unsigned char biasTEnable
* }
*/
public static void biasTEnable$set(MemorySegment seg, byte x) {
sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg, x);
public static void biasTEnable(MemorySegment struct, byte fieldValue) {
struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue);
}
public static byte biasTEnable$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void biasTEnable$set(MemorySegment seg, long index, byte x) {
sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

View File

@@ -1,6 +1,6 @@
/*
* *****************************************************************************
* Copyright (C) 2014-2023 Dennis Sheirer
* Copyright (C) 2014-2024 Dennis Sheirer
*
* 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
@@ -21,62 +21,122 @@
package io.github.dsheirer.source.tuner.sdrplay.api.v3_07;
import java.lang.foreign.MemoryLayout;
import java.lang.foreign.MemorySegment;
import java.lang.foreign.SegmentAllocator;
import java.lang.foreign.SegmentScope;
import java.lang.foreign.StructLayout;
import java.lang.invoke.VarHandle;
import java.lang.foreign.*;
import java.util.function.*;
import static java.lang.foreign.ValueLayout.*;
import static java.lang.foreign.MemoryLayout.PathElement.*;
/**
* {@snippet :
* {@snippet lang=c :
* struct {
* unsigned char extRefOutputEn;
* };
* }
* }
*/
public class sdrplay_api_Rsp2ParamsT {
static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout(
Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn")
);
public static MemoryLayout $LAYOUT() {
return sdrplay_api_Rsp2ParamsT.$struct$LAYOUT;
sdrplay_api_Rsp2ParamsT() {
// Should not be called directly
}
static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn"));
public static VarHandle extRefOutputEn$VH() {
return sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH;
private static final GroupLayout $LAYOUT = MemoryLayout.structLayout(
sdrplay_api_h.C_CHAR.withName("extRefOutputEn")
).withName("$anon$22:9");
/**
* The layout of this struct
*/
public static final GroupLayout layout() {
return $LAYOUT;
}
private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn"));
/**
* Layout for field:
* {@snippet lang=c :
* unsigned char extRefOutputEn
* }
*/
public static final OfByte extRefOutputEn$layout() {
return extRefOutputEn$LAYOUT;
}
private static final long extRefOutputEn$OFFSET = 0;
/**
* Offset for field:
* {@snippet lang=c :
* unsigned char extRefOutputEn
* }
*/
public static final long extRefOutputEn$offset() {
return extRefOutputEn$OFFSET;
}
/**
* Getter for field:
* {@snippet :
* unsigned char extRefOutputEn;
* {@snippet lang=c :
* unsigned char extRefOutputEn
* }
*/
public static byte extRefOutputEn$get(MemorySegment seg) {
return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg);
public static byte extRefOutputEn(MemorySegment struct) {
return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET);
}
/**
* Setter for field:
* {@snippet :
* unsigned char extRefOutputEn;
* {@snippet lang=c :
* unsigned char extRefOutputEn
* }
*/
public static void extRefOutputEn$set(MemorySegment seg, byte x) {
sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg, x);
public static void extRefOutputEn(MemorySegment struct, byte fieldValue) {
struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue);
}
public static byte extRefOutputEn$get(MemorySegment seg, long index) {
return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof()));
/**
* Obtains a slice of {@code arrayParam} which selects the array element at {@code index}.
* The returned segment has address {@code arrayParam.address() + index * layout().byteSize()}
*/
public static MemorySegment asSlice(MemorySegment array, long index) {
return array.asSlice(layout().byteSize() * index);
}
public static void extRefOutputEn$set(MemorySegment seg, long index, byte x) {
sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x);
/**
* The size (in bytes) of this struct
*/
public static long sizeof() { return layout().byteSize(); }
/**
* Allocate a segment of size {@code layout().byteSize()} using {@code allocator}
*/
public static MemorySegment allocate(SegmentAllocator allocator) {
return allocator.allocate(layout());
}
public static long sizeof() { return $LAYOUT().byteSize(); }
public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); }
public static MemorySegment allocateArray(long len, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT()));
/**
* Allocate an array of size {@code elementCount} using {@code allocator}.
* The returned segment has size {@code elementCount * layout().byteSize()}.
*/
public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) {
return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout()));
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer<MemorySegment> cleanup) {
return reinterpret(addr, 1, arena, cleanup);
}
/**
* Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any).
* The returned segment has size {@code elementCount * layout().byteSize()}
*/
public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer<MemorySegment> cleanup) {
return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup);
}
public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); }
}

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