#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

@@ -22,10 +22,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 20
- name: Set up JDK 22
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '22'
distribution: 'liberica'
java-package: 'jdk+fx'
- name: Build with Gradle

View File

@@ -15,10 +15,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 20
- name: Set up JDK 22
uses: actions/setup-java@v3
with:
java-version: '20'
java-version: '22'
distribution: 'liberica'
java-package: 'jdk+fx'

2
.idea/misc.xml generated
View File

@@ -4,7 +4,7 @@
<component name="FrameworkDetectionExcludesConfiguration">
<file type="web" url="file://$PROJECT_DIR$" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_20_PREVIEW" project-jdk-name="liberica-20" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_22_PREVIEW" project-jdk-name="liberica-22" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

View File

@@ -1,40 +0,0 @@
Auto-generating Java code from SDRPlay API using jextract.
Note: the api headers in the 3.11 folder are equivalent to the 3.08 headers. The only
difference from the 3.07 headers is the addition of the boolean 'valid' flag to DeviceT structure.
1. Download JDK19 compatible build of jextract JDK: https://jdk.java.net/jextract/
2. If generating on windows platform, modify the sdrplay_api.h to remove the windows
pieces of the file. Specifically:
2a. Comment out these lines but leave the *HANDLE typedef:
//#if defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64)
//#include "windows.h"
//#elif defined (__GNUC__)
typedef void *HANDLE;
//#endif
//#ifndef _SDRPLAY_DLL_QUALIFIER
//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64))
//#define _SDRPLAY_DLL_QUALIFIER __declspec(dllimport)
//#elif defined(STATIC_LIB) || defined(__GNUC__)
//#define _SDRPLAY_DLL_QUALIFIER
//#endif
//#endif // _SDRPLAY_DLL_QUALIFIER
2b. Remove the '_SDRPLAY_DLL_QUALIFIER' from in front of the method declarations
2c. Change the 3.11 version string to 3.08 either in the header file, or in the generated java class
3. Open command prompt to the root source code where the generated files should be placed:
..\SDRtrunk\sdrplay-api\src\main\java
4. Generate the code:
Windows:
c:\Users\Denny\Downloads\jdk-19-ea2-panama\bin\jextract "C:\Users\Denny\git\sdrtrunk\sdrplay-api\api\v3_11\sdrplay_api.h" -l libsdrplay_api --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_14
Linux:
~/Downloads/jextract-20/bin/jextract ~/IdeaProjects/sdrtrunk/artifacts/sdrplay-api-headers/v3_14/sdrplay_api.h -l libsdrplay_api --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_14
5. Compare the 3.07 header files to the newest version header files. Delete any auto-generated files that have not
changed and then update the factory class to construct variation classes where there are differences.

View File

@@ -1,230 +0,0 @@
#ifndef SDRPLAY_API_H
#define SDRPLAY_API_H
#include "sdrplay_api_dev.h"
#include "sdrplay_api_rx_channel.h"
#include "sdrplay_api_callback.h"
//#if defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64)
//#include "windows.h"
//#elif defined (__GNUC__)
typedef void *HANDLE;
//#endif
//#ifndef _SDRPLAY_DLL_QUALIFIER
//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64))
//#define _SDRPLAY_DLL_QUALIFIER __declspec(dllimport)
//#elif defined(STATIC_LIB) || defined(__GNUC__)
//#define _SDRPLAY_DLL_QUALIFIER
//#endif
//#endif // _SDRPLAY_DLL_QUALIFIER
// Application code should check that it is compiled against the same API version
// sdrplay_api_ApiVersion() returns the API version
#define SDRPLAY_API_VERSION (float)(3.11)
// API Constants
#define SDRPLAY_MAX_DEVICES (16)
#define SDRPLAY_MAX_TUNERS_PER_DEVICE (2)
#define SDRPLAY_MAX_SER_NO_LEN (64)
#define SDRPLAY_MAX_ROOT_NM_LEN (32)
#define SDRPLAY_RSP1_ID (1)
#define SDRPLAY_RSP1A_ID (255)
#define SDRPLAY_RSP2_ID (2)
#define SDRPLAY_RSPduo_ID (3)
#define SDRPLAY_RSPdx_ID (4)
// Enum types
typedef enum
{
sdrplay_api_Success = 0,
sdrplay_api_Fail = 1,
sdrplay_api_InvalidParam = 2,
sdrplay_api_OutOfRange = 3,
sdrplay_api_GainUpdateError = 4,
sdrplay_api_RfUpdateError = 5,
sdrplay_api_FsUpdateError = 6,
sdrplay_api_HwError = 7,
sdrplay_api_AliasingError = 8,
sdrplay_api_AlreadyInitialised = 9,
sdrplay_api_NotInitialised = 10,
sdrplay_api_NotEnabled = 11,
sdrplay_api_HwVerError = 12,
sdrplay_api_OutOfMemError = 13,
sdrplay_api_ServiceNotResponding = 14,
sdrplay_api_StartPending = 15,
sdrplay_api_StopPending = 16,
sdrplay_api_InvalidMode = 17,
sdrplay_api_FailedVerification1 = 18,
sdrplay_api_FailedVerification2 = 19,
sdrplay_api_FailedVerification3 = 20,
sdrplay_api_FailedVerification4 = 21,
sdrplay_api_FailedVerification5 = 22,
sdrplay_api_FailedVerification6 = 23,
sdrplay_api_InvalidServiceVersion = 24
} sdrplay_api_ErrT;
typedef enum
{
sdrplay_api_Update_None = 0x00000000,
// Reasons for master only mode
sdrplay_api_Update_Dev_Fs = 0x00000001,
sdrplay_api_Update_Dev_Ppm = 0x00000002,
sdrplay_api_Update_Dev_SyncUpdate = 0x00000004,
sdrplay_api_Update_Dev_ResetFlags = 0x00000008,
sdrplay_api_Update_Rsp1a_BiasTControl = 0x00000010,
sdrplay_api_Update_Rsp1a_RfNotchControl = 0x00000020,
sdrplay_api_Update_Rsp1a_RfDabNotchControl = 0x00000040,
sdrplay_api_Update_Rsp2_BiasTControl = 0x00000080,
sdrplay_api_Update_Rsp2_AmPortSelect = 0x00000100,
sdrplay_api_Update_Rsp2_AntennaControl = 0x00000200,
sdrplay_api_Update_Rsp2_RfNotchControl = 0x00000400,
sdrplay_api_Update_Rsp2_ExtRefControl = 0x00000800,
sdrplay_api_Update_RspDuo_ExtRefControl = 0x00001000,
sdrplay_api_Update_Master_Spare_1 = 0x00002000,
sdrplay_api_Update_Master_Spare_2 = 0x00004000,
// Reasons for master and slave mode
// Note: sdrplay_api_Update_Tuner_Gr MUST be the first value defined in this section!
sdrplay_api_Update_Tuner_Gr = 0x00008000,
sdrplay_api_Update_Tuner_GrLimits = 0x00010000,
sdrplay_api_Update_Tuner_Frf = 0x00020000,
sdrplay_api_Update_Tuner_BwType = 0x00040000,
sdrplay_api_Update_Tuner_IfType = 0x00080000,
sdrplay_api_Update_Tuner_DcOffset = 0x00100000,
sdrplay_api_Update_Tuner_LoMode = 0x00200000,
sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 0x00400000,
sdrplay_api_Update_Ctrl_Decimation = 0x00800000,
sdrplay_api_Update_Ctrl_Agc = 0x01000000,
sdrplay_api_Update_Ctrl_AdsbMode = 0x02000000,
sdrplay_api_Update_Ctrl_OverloadMsgAck = 0x04000000,
sdrplay_api_Update_RspDuo_BiasTControl = 0x08000000,
sdrplay_api_Update_RspDuo_AmPortSelect = 0x10000000,
sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 0x20000000,
sdrplay_api_Update_RspDuo_RfNotchControl = 0x40000000,
sdrplay_api_Update_RspDuo_RfDabNotchControl = 0x80000000,
} sdrplay_api_ReasonForUpdateT;
typedef enum
{
sdrplay_api_Update_Ext1_None = 0x00000000,
// Reasons for master only mode
sdrplay_api_Update_RspDx_HdrEnable = 0x00000001,
sdrplay_api_Update_RspDx_BiasTControl = 0x00000002,
sdrplay_api_Update_RspDx_AntennaControl = 0x00000004,
sdrplay_api_Update_RspDx_RfNotchControl = 0x00000008,
sdrplay_api_Update_RspDx_RfDabNotchControl = 0x00000010,
sdrplay_api_Update_RspDx_HdrBw = 0x00000020,
// Reasons for master and slave mode
} sdrplay_api_ReasonForUpdateExtension1T;
typedef enum
{
sdrplay_api_DbgLvl_Disable = 0,
sdrplay_api_DbgLvl_Verbose = 1,
sdrplay_api_DbgLvl_Warning = 2,
sdrplay_api_DbgLvl_Error = 3,
sdrplay_api_DbgLvl_Message = 4,
} sdrplay_api_DbgLvl_t;
// Device structure
typedef struct
{
char SerNo[SDRPLAY_MAX_SER_NO_LEN];
unsigned char hwVer;
sdrplay_api_TunerSelectT tuner;
sdrplay_api_RspDuoModeT rspDuoMode;
unsigned char valid;
double rspDuoSampleFreq;
HANDLE dev;
} sdrplay_api_DeviceT;
// Device parameter structure
typedef struct
{
sdrplay_api_DevParamsT *devParams;
sdrplay_api_RxChannelParamsT *rxChannelA;
sdrplay_api_RxChannelParamsT *rxChannelB;
} sdrplay_api_DeviceParamsT;
// Extended error message structure
typedef struct
{
char file[256];
char function[256];
int line;
char message[1024];
} sdrplay_api_ErrorInfoT;
// Comman API function types
typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void);
typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void);
typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *apiVer);
typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void);
typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void);
typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *device);
typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *device);
typedef const char* (*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT err);
typedef sdrplay_api_ErrorInfoT* (*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *device);
typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void);
// Device API function types
typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE dev, sdrplay_api_DbgLvl_t dbgLvl);
typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams);
typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext);
typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE dev);
typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1);
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE dev, sdrplay_api_TunerSelectT *tuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *currentSampleRate, double newSampleRate);
typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams,
sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner,
sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
// API function definitions
#ifdef __cplusplus
extern "C"
{
#endif
// Comman API function definitions
sdrplay_api_ErrT sdrplay_api_Open(void);
sdrplay_api_ErrT sdrplay_api_Close(void);
sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer);
sdrplay_api_ErrT sdrplay_api_LockDeviceApi(void);
sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(void);
sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs);
sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device);
sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device);
const char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err);
sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT *device);
sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(void); // Must be called before sdrplay_api_SelectDevice()
// Device API function definitions
sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable);
sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams);
sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext);
sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev);
sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1);
sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate);
sdrplay_api_ErrT sdrplay_api_SwapRspDuoMode(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams,
sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner,
sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel);
#ifdef __cplusplus
}
#endif
#endif //SDRPLAY_API_H

View File

@@ -1,40 +0,0 @@
#ifndef SDRPLAY_API_RSPduo_H
#define SDRPLAY_API_RSPduo_H
#define RSPDUO_NUM_LNA_STATES 10
#define RSPDUO_NUM_LNA_STATES_AMPORT 5
#define RSPDUO_NUM_LNA_STATES_AM 7
#define RSPDUO_NUM_LNA_STATES_LBAND 9
// RSPduo parameter enums
typedef enum
{
sdrplay_api_RspDuoMode_Unknown = 0,
sdrplay_api_RspDuoMode_Single_Tuner = 1,
sdrplay_api_RspDuoMode_Dual_Tuner = 2,
sdrplay_api_RspDuoMode_Master = 4,
sdrplay_api_RspDuoMode_Slave = 8,
} sdrplay_api_RspDuoModeT;
typedef enum
{
sdrplay_api_RspDuo_AMPORT_1 = 1,
sdrplay_api_RspDuo_AMPORT_2 = 0,
} sdrplay_api_RspDuo_AmPortSelectT;
// RSPduo parameter structs
typedef struct
{
int extRefOutputEn; // default: 0
} sdrplay_api_RspDuoParamsT;
typedef struct
{
unsigned char biasTEnable; // default: 0
sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; // default: sdrplay_api_RspDuo_AMPORT_2
unsigned char tuner1AmNotchEnable; // default: 0
unsigned char rfNotchEnable; // default: 0
unsigned char rfDabNotchEnable; // default: 0
} sdrplay_api_RspDuoTunerParamsT;
#endif //SDRPLAY_API_RSPduo_H

View File

@@ -1,79 +0,0 @@
#ifndef SDRPLAY_API_CALLBACK_H
#define SDRPLAY_API_CALLBACK_H
// Event callback enums
typedef enum
{
sdrplay_api_Overload_Detected = 0,
sdrplay_api_Overload_Corrected = 1,
} sdrplay_api_PowerOverloadCbEventIdT;
typedef enum
{
sdrplay_api_MasterInitialised = 0,
sdrplay_api_SlaveAttached = 1,
sdrplay_api_SlaveDetached = 2,
sdrplay_api_SlaveInitialised = 3,
sdrplay_api_SlaveUninitialised = 4,
sdrplay_api_MasterDllDisappeared = 5,
sdrplay_api_SlaveDllDisappeared = 6,
} sdrplay_api_RspDuoModeCbEventIdT;
typedef enum
{
sdrplay_api_GainChange = 0,
sdrplay_api_PowerOverloadChange = 1,
sdrplay_api_DeviceRemoved = 2,
sdrplay_api_RspDuoModeChange = 3,
sdrplay_api_DeviceFailure = 4,
} sdrplay_api_EventT;
// Event callback parameter structs
typedef struct
{
unsigned int gRdB;
unsigned int lnaGRdB;
double currGain;
} sdrplay_api_GainCbParamT;
typedef struct
{
sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType;
} sdrplay_api_PowerOverloadCbParamT;
typedef struct
{
sdrplay_api_RspDuoModeCbEventIdT modeChangeType;
} sdrplay_api_RspDuoModeCbParamT;
// Event parameters overlay
typedef union
{
sdrplay_api_GainCbParamT gainParams;
sdrplay_api_PowerOverloadCbParamT powerOverloadParams;
sdrplay_api_RspDuoModeCbParamT rspDuoModeParams;
} sdrplay_api_EventParamsT;
// Stream callback parameter structs
typedef struct
{
unsigned int firstSampleNum;
int grChanged;
int rfChanged;
int fsChanged;
unsigned int numSamples;
} sdrplay_api_StreamCbParamsT;
// Callback function prototypes
typedef void (*sdrplay_api_StreamCallback_t)(short *xi, short *xq, sdrplay_api_StreamCbParamsT *params, unsigned int numSamples, unsigned int reset, void *cbContext);
typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT eventId, sdrplay_api_TunerSelectT tuner, sdrplay_api_EventParamsT *params, void *cbContext);
// Callback function struct
typedef struct
{
sdrplay_api_StreamCallback_t StreamACbFn;
sdrplay_api_StreamCallback_t StreamBCbFn;
sdrplay_api_EventCallback_t EventCbFn;
} sdrplay_api_CallbackFnsT;
#endif //SDRPLAY_API_CALLBACK_H

View File

@@ -1,55 +0,0 @@
#ifndef SDRPLAY_API_CONTROL_H
#define SDRPLAY_API_CONTROL_H
// Control parameter enums
typedef enum
{
sdrplay_api_AGC_DISABLE = 0,
sdrplay_api_AGC_100HZ = 1,
sdrplay_api_AGC_50HZ = 2,
sdrplay_api_AGC_5HZ = 3,
sdrplay_api_AGC_CTRL_EN = 4
} sdrplay_api_AgcControlT;
typedef enum
{
sdrplay_api_ADSB_DECIMATION = 0,
sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1,
sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2,
sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3
} sdrplay_api_AdsbModeT;
// Control parameter structs
typedef struct
{
unsigned char DCenable; // default: 1
unsigned char IQenable; // default: 1
} sdrplay_api_DcOffsetT;
typedef struct
{
unsigned char enable; // default: 0
unsigned char decimationFactor; // default: 1
unsigned char wideBandSignal; // default: 0
} sdrplay_api_DecimationT;
typedef struct
{
sdrplay_api_AgcControlT enable; // default: sdrplay_api_AGC_50HZ
int setPoint_dBfs; // default: -60
unsigned short attack_ms; // default: 0
unsigned short decay_ms; // default: 0
unsigned short decay_delay_ms; // default: 0
unsigned short decay_threshold_dB; // default: 0
int syncUpdate; // default: 0
} sdrplay_api_AgcT;
typedef struct
{
sdrplay_api_DcOffsetT dcOffset;
sdrplay_api_DecimationT decimation;
sdrplay_api_AgcT agc;
sdrplay_api_AdsbModeT adsbMode; //default: sdrplay_api_ADSB_DECIMATION
} sdrplay_api_ControlParamsT;
#endif //SDRPLAY_API_CONTROL_H

View File

@@ -1,51 +0,0 @@
#ifndef SDRPLAY_API_DEV_H
#define SDRPLAY_API_DEV_H
#include "sdrplay_api_rsp1a.h"
#include "sdrplay_api_rsp2.h"
#include "sdrplay_api_rspDuo.h"
#include "sdrplay_api_rspDx.h"
// Dev parameter enums
typedef enum
{
sdrplay_api_ISOCH = 0,
sdrplay_api_BULK = 1
} sdrplay_api_TransferModeT;
// Dev parameter structs
typedef struct
{
double fsHz; // default: 2000000.0
unsigned char syncUpdate; // default: 0
unsigned char reCal; // default: 0
} sdrplay_api_FsFreqT;
typedef struct
{
unsigned int sampleNum; // default: 0
unsigned int period; // default: 0
} sdrplay_api_SyncUpdateT;
typedef struct
{
unsigned char resetGainUpdate; // default: 0
unsigned char resetRfUpdate; // default: 0
unsigned char resetFsUpdate; // default: 0
} sdrplay_api_ResetFlagsT;
typedef struct
{
double ppm; // default: 0.0
sdrplay_api_FsFreqT fsFreq;
sdrplay_api_SyncUpdateT syncUpdate;
sdrplay_api_ResetFlagsT resetFlags;
sdrplay_api_TransferModeT mode; // default: sdrplay_api_ISOCH
unsigned int samplesPerPkt; // default: 0 (output param)
sdrplay_api_Rsp1aParamsT rsp1aParams;
sdrplay_api_Rsp2ParamsT rsp2Params;
sdrplay_api_RspDuoParamsT rspDuoParams;
sdrplay_api_RspDxParamsT rspDxParams;
} sdrplay_api_DevParamsT;
#endif //SDRPLAY_API_DEV_H

View File

@@ -1,22 +0,0 @@
#ifndef SDRPLAY_API_RSP1A_H
#define SDRPLAY_API_RSP1A_H
#define RSPIA_NUM_LNA_STATES 10
#define RSPIA_NUM_LNA_STATES_AM 7
#define RSPIA_NUM_LNA_STATES_LBAND 9
// RSP1A parameter enums
// RSP1A parameter structs
typedef struct
{
unsigned char rfNotchEnable; // default: 0
unsigned char rfDabNotchEnable; // default: 0
} sdrplay_api_Rsp1aParamsT;
typedef struct
{
unsigned char biasTEnable; // default: 0
} sdrplay_api_Rsp1aTunerParamsT;
#endif //SDRPLAY_API_RSP1A_H

View File

@@ -1,35 +0,0 @@
#ifndef SDRPLAY_API_RSP2_H
#define SDRPLAY_API_RSP2_H
#define RSPII_NUM_LNA_STATES 9
#define RSPII_NUM_LNA_STATES_AMPORT 5
#define RSPII_NUM_LNA_STATES_420MHZ 6
// RSP2 parameter enums
typedef enum
{
sdrplay_api_Rsp2_ANTENNA_A = 5,
sdrplay_api_Rsp2_ANTENNA_B = 6,
} sdrplay_api_Rsp2_AntennaSelectT;
typedef enum
{
sdrplay_api_Rsp2_AMPORT_1 = 1,
sdrplay_api_Rsp2_AMPORT_2 = 0,
} sdrplay_api_Rsp2_AmPortSelectT;
// RSP2 parameter structs
typedef struct
{
unsigned char extRefOutputEn; // default: 0
} sdrplay_api_Rsp2ParamsT;
typedef struct
{
unsigned char biasTEnable; // default: 0
sdrplay_api_Rsp2_AmPortSelectT amPortSel; // default: sdrplay_api_Rsp2_AMPORT_2
sdrplay_api_Rsp2_AntennaSelectT antennaSel; // default: sdrplay_api_Rsp2_ANTENNA_A
unsigned char rfNotchEnable; // default: 0
} sdrplay_api_Rsp2TunerParamsT;
#endif //SDRPLAY_API_RSP2_H

View File

@@ -1,46 +0,0 @@
#ifndef SDRPLAY_API_RSPDX_H
#define SDRPLAY_API_RSPDX_H
#include "sdrplay_api_tuner.h"
#define RSPDX_NUM_LNA_STATES 28 // Number of LNA states in all bands (except where defined differently below)
#define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 // Number of LNA states when using AM Port 2 between 0 and 12MHz
#define RSPDX_NUM_LNA_STATES_AMPORT2_12_50 20 // Number of LNA states when using AM Port 2 between 12 and 50MHz
#define RSPDX_NUM_LNA_STATES_AMPORT2_50_60 25 // Number of LNA states when using AM Port 2 between 50 and 60MHz
#define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 // Number of LNA states in VHF and Band3
#define RSPDX_NUM_LNA_STATES_420MHZ 21 // Number of LNA states in 420MHz band
#define RSPDX_NUM_LNA_STATES_LBAND 19 // Number of LNA states in L-band
#define RSPDX_NUM_LNA_STATES_DX 22 // Number of LNA states in DX path
// RSPdx parameter enums
typedef enum
{
sdrplay_api_RspDx_ANTENNA_A = 0,
sdrplay_api_RspDx_ANTENNA_B = 1,
sdrplay_api_RspDx_ANTENNA_C = 2,
} sdrplay_api_RspDx_AntennaSelectT;
typedef enum
{
sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0,
sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1,
sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2,
sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3,
} sdrplay_api_RspDx_HdrModeBwT;
// RSPdx parameter structs
typedef struct
{
unsigned char hdrEnable; // default: 0
unsigned char biasTEnable; // default: 0
sdrplay_api_RspDx_AntennaSelectT antennaSel; // default: sdrplay_api_RspDx_ANTENNA_A
unsigned char rfNotchEnable; // default: 0
unsigned char rfDabNotchEnable; // default: 0
} sdrplay_api_RspDxParamsT;
typedef struct
{
sdrplay_api_RspDx_HdrModeBwT hdrBw; // default: sdrplay_api_RspDx_HDRMODE_BW_1_700
} sdrplay_api_RspDxTunerParamsT;
#endif //SDRPLAY_API_RSPDX_H

View File

@@ -1,21 +0,0 @@
#ifndef SDRPLAY_API_RX_CHANNEL_H
#define SDRPLAY_API_RX_CHANNEL_H
#include "sdrplay_api_tuner.h"
#include "sdrplay_api_control.h"
#include "sdrplay_api_rsp1a.h"
#include "sdrplay_api_rsp2.h"
#include "sdrplay_api_rspDuo.h"
#include "sdrplay_api_rspDx.h"
typedef struct
{
sdrplay_api_TunerParamsT tunerParams;
sdrplay_api_ControlParamsT ctrlParams;
sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams;
sdrplay_api_Rsp2TunerParamsT rsp2TunerParams;
sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams;
sdrplay_api_RspDxTunerParamsT rspDxTunerParams;
} sdrplay_api_RxChannelParamsT;
#endif //SDRPLAY_API_RX_CHANNEL_H

View File

@@ -1,93 +0,0 @@
#ifndef SDRPLAY_API_TUNER_H
#define SDRPLAY_API_TUNER_H
#define MAX_BB_GR (59)
// Tuner parameter enums
typedef enum
{
sdrplay_api_BW_Undefined = 0,
sdrplay_api_BW_0_200 = 200,
sdrplay_api_BW_0_300 = 300,
sdrplay_api_BW_0_600 = 600,
sdrplay_api_BW_1_536 = 1536,
sdrplay_api_BW_5_000 = 5000,
sdrplay_api_BW_6_000 = 6000,
sdrplay_api_BW_7_000 = 7000,
sdrplay_api_BW_8_000 = 8000
} sdrplay_api_Bw_MHzT;
typedef enum
{
sdrplay_api_IF_Undefined = -1,
sdrplay_api_IF_Zero = 0,
sdrplay_api_IF_0_450 = 450,
sdrplay_api_IF_1_620 = 1620,
sdrplay_api_IF_2_048 = 2048
} sdrplay_api_If_kHzT;
typedef enum
{
sdrplay_api_LO_Undefined = 0,
sdrplay_api_LO_Auto = 1,
sdrplay_api_LO_120MHz = 2,
sdrplay_api_LO_144MHz = 3,
sdrplay_api_LO_168MHz = 4
} sdrplay_api_LoModeT;
typedef enum
{
sdrplay_api_EXTENDED_MIN_GR = 0,
sdrplay_api_NORMAL_MIN_GR = 20
} sdrplay_api_MinGainReductionT;
typedef enum
{
sdrplay_api_Tuner_Neither = 0,
sdrplay_api_Tuner_A = 1,
sdrplay_api_Tuner_B = 2,
sdrplay_api_Tuner_Both = 3,
} sdrplay_api_TunerSelectT;
// Tuner parameter structs
typedef struct
{
float curr;
float max;
float min;
} sdrplay_api_GainValuesT;
typedef struct
{
int gRdB; // default: 50
unsigned char LNAstate; // default: 0
unsigned char syncUpdate; // default: 0
sdrplay_api_MinGainReductionT minGr; // default: sdrplay_api_NORMAL_MIN_GR
sdrplay_api_GainValuesT gainVals; // output parameter
} sdrplay_api_GainT;
typedef struct
{
double rfHz; // default: 200000000.0
unsigned char syncUpdate; // default: 0
} sdrplay_api_RfFreqT;
typedef struct
{
unsigned char dcCal; // default: 3 (Periodic mode)
unsigned char speedUp; // default: 0 (No speedup)
int trackTime; // default: 1 (=> time in uSec = (72 * 3 * trackTime) / 24e6 = 9uSec)
int refreshRateTime; // default: 2048 (=> time in uSec = (72 * 3 * refreshRateTime) / 24e6 = 18432uSec)
} sdrplay_api_DcOffsetTunerT;
typedef struct
{
sdrplay_api_Bw_MHzT bwType; // default: sdrplay_api_BW_0_200
sdrplay_api_If_kHzT ifType; // default: sdrplay_api_IF_Zero
sdrplay_api_LoModeT loMode; // default: sdrplay_api_LO_Auto
sdrplay_api_GainT gain;
sdrplay_api_RfFreqT rfFreq;
sdrplay_api_DcOffsetTunerT dcOffsetTuner;
} sdrplay_api_TunerParamsT;
#endif //SDRPLAY_API_TUNER_H

View File

@@ -21,7 +21,7 @@ typedef void *HANDLE;
// Application code should check that it is compiled against the same API version
// sdrplay_api_ApiVersion() returns the API version
#define SDRPLAY_API_VERSION (float)(3.14)
#define SDRPLAY_API_VERSION (float)(3.15)
// API Constants
#define SDRPLAY_MAX_DEVICES (16)
@@ -36,6 +36,7 @@ typedef void *HANDLE;
#define SDRPLAY_RSPduo_ID (3)
#define SDRPLAY_RSPdx_ID (4)
#define SDRPLAY_RSP1B_ID (6)
#define SDRPLAY_RSPdxR2_ID (7)
// Enum types
typedef enum

View File

@@ -25,8 +25,8 @@ import java.text.SimpleDateFormat
* Instructions for building/compiling the sdrtrunk application.
*
* Prerequisites:
* Install and configure an OpenJDK version 19+ that includes the JavaFX modules (e.g. Bellsoft Liberica JDK)
* - Optional: install and configure Gradle 7.6+
* Install and configure an OpenJDK version 22+ that includes the JavaFX modules (e.g. Bellsoft Liberica JDK)
* - Optional: install and configure Gradle 8.10+
*
* Scenario 1: run the application via gradle command line from the source code root directory:
* command: ./gradlew run
@@ -58,10 +58,10 @@ repositories {
//Version is defined in gradle.properties so that we can CLI override it for nightly builds.
version = project.findProperty('projectVersion')
//Java 20 is required for this version of the Project Panama preview/incubator feature
//Java 22 is required for this version of the Project Panama preview/incubator feature
java {
toolchain {
languageVersion = JavaLanguageVersion.of(20)
languageVersion = JavaLanguageVersion.of(22)
}
}
@@ -90,8 +90,8 @@ dependencies {
implementation 'com.github.nwaldispuehl:java-lame:v3.98.4'
//mavenCentral/jcenter imports
implementation 'ch.qos.logback:logback-classic:1.4.5'
implementation 'ch.qos.logback:logback-core:1.4.5'
implementation 'ch.qos.logback:logback-classic:1.4.12'
implementation 'ch.qos.logback:logback-core:1.4.14'
implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.0'
implementation 'com.fazecast:jSerialComm:2.9.3'
implementation 'com.github.jiconfont:jiconfont-font_awesome:4.7.0.1'
@@ -99,7 +99,7 @@ dependencies {
implementation 'com.github.jiconfont:jiconfont-swing:1.0.1'
implementation 'com.github.wendykierp:JTransforms:3.1'
implementation 'com.google.code.gson:gson:2.10'
implementation 'com.google.guava:guava:31.1-jre'
implementation 'com.google.guava:guava:33.3.0-jre'
implementation 'com.jidesoft:jide-oss:3.6.18'
implementation 'com.miglayout:miglayout-swing:11.0'
implementation 'com.mpatric:mp3agic:0.9.1'
@@ -108,7 +108,7 @@ dependencies {
implementation 'io.github.dsheirer:radio-reference-api:18.0.0'
implementation 'javax.usb:usb-api:1.0.2'
implementation 'net.coderazzi:tablefilter-swing:5.5.4'
implementation 'org.apache.commons:commons-compress:1.21'
implementation 'org.apache.commons:commons-compress:1.26.0'
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation 'org.apache.commons:commons-math3:3.6.1'
implementation 'org.apache.commons:commons-csv:1.9.0'
@@ -127,11 +127,11 @@ dependencies {
def os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem
/**
* This is needed for the JDK19 panama and vector API ... until it moves out of incubation or preview
* This is needed for the JDK22 vector API ... until it moves out of incubation or preview
*/
tasks.withType(JavaCompile) {
options.compilerArgs.add("--enable-preview") //Panama Foreign Function/Memory is preview in JDK 19
options.compilerArgs.add("--add-modules=jdk.incubator.vector") //Needed while Panama Vector API remains in incubator
options.compilerArgs.add("--enable-preview") //Project Panama Vector API is still in incubator
options.compilerArgs.add("--add-modules=jdk.incubator.vector") //Project Panama Vector API is still in incubator
}
/**
@@ -140,10 +140,10 @@ tasks.withType(JavaCompile) {
def jvmArgsWindows =
['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED', //Needed for controls-fx.jar
'--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED', //windows users for JIDE
'--add-modules=jdk.incubator.vector', //Needed while Project Panama API is still in incubator
'--enable-preview', //Project Panama Vector & Foreign Function APIs remain in incubator
'--enable-native-access=ALL-UNNAMED',
'-Djava.library.path=c:\\Program Files\\SDRplay\\API\\x64'] //Allows Project Panama Foreign Function access to system library
'--add-modules=jdk.incubator.vector', //Project Panama Vector API is still in incubator
'--enable-preview', //Project Panama Vector API is still in incubator
'--enable-native-access=ALL-UNNAMED', //Suppress unsafe warnings for FFM API Foreign Memory calls
'-Djava.library.path=c:\\Program Files\\SDRplay\\API\\x64'] //SDRPlay API library path
/**
* JVM Arguments for running the application on Linux.
@@ -152,8 +152,7 @@ def jvmArgsLinux =
['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED', //Needed for controls-fx.jar
'--add-modules=jdk.incubator.vector', //Needed while Project Panama API is still in incubator
'--enable-preview', //Project Panama Vector & Foreign Function APIs remain in incubator
'--enable-native-access=ALL-UNNAMED',
'-Djava.library.path=/usr/local/lib'] //Allows Project Panama Foreign Function access to system library
'--enable-native-access=ALL-UNNAMED'] //SDRPlay API library path
application {
mainClassName = "io.github.dsheirer.gui.SDRTrunk"
@@ -200,16 +199,16 @@ String targetWindowsX86_64 = 'windows-x86_64-v' + version
* author's development environment, but can be changed to your environment if you want to use this build pattern.
*/
String jdk_base = '/home/denny/java_jdks/'
String jdk_linux_aarch64 = jdk_base + 'linux-arm64/jdk-20.0.1-full'
String jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-20.0.1-full'
String jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-20.0.1-full.jdk'
String jdk_osx_aarch64 = jdk_base + 'osx-arm64/jdk-20.0.1-full.jdk'
String jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-20.0.1-full'
String jdk_linux_aarch64 = jdk_base + 'linux-arm64/jdk-22.0.2-full'
String jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-22.0.2-full'
String jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-22.0.2-full.jdk'
String jdk_osx_aarch64 = jdk_base + 'osx-arm64/jdk-22.0.2-full.jdk'
String jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-22.0.2-full'
/**
* Download URLs to download the JDK as part of the gradle build packaging process
*/
def jdk_download_base = "https://download.bell-sw.com/java/20.0.1+10/bellsoft-jdk20.0.1+10-"
def jdk_download_base = "https://download.bell-sw.com/java/22.0.2+11/bellsoft-jdk22.0.2+11-"
def jdk_download_suffix = "-full.tar.gz"
def jdk_download_linux_aarch64 = jdk_download_base + "linux-aarch64" + jdk_download_suffix
def jdk_download_linux_x86_64 = jdk_download_base + "linux-amd64" + jdk_download_suffix

View File

@@ -28,4 +28,4 @@
# tag name, specifically the dashes inserted before and after the alpha/beta labels.
# See: https://github.com/DSheirer/sdrtrunk/issues/1651
projectVersion=0.6.1-beta-1
projectVersion=0.6.1-beta-2

Binary file not shown.

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
@@ -19,7 +19,8 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

18
gradlew vendored
View File

@@ -2,7 +2,7 @@
#
# ******************************************************************************
# Copyright (C) 2014-2022 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
@@ -88,9 +88,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@@ -136,10 +133,13 @@ location of your Java installation."
fi
else
JAVACMD=java
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
if ! command -v java >/dev/null 2>&1
then
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
fi
# Increase the maximum file descriptors if we can.
@@ -147,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@@ -155,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@@ -200,6 +200,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

View File

@@ -55,6 +55,7 @@ import io.github.dsheirer.source.tuner.Tuner;
import io.github.dsheirer.source.tuner.TunerEvent;
import io.github.dsheirer.source.tuner.manager.DiscoveredTuner;
import io.github.dsheirer.source.tuner.manager.TunerManager;
import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayLibraryHelper;
import io.github.dsheirer.source.tuner.ui.TunerSpectralDisplayManager;
import io.github.dsheirer.spectrum.DisableSpectrumWaterfallMenuItem;
import io.github.dsheirer.spectrum.ShowTunerMenuItem;
@@ -152,6 +153,14 @@ public class SDRTrunk implements Listener<TunerEvent>
mApplicationLog = new ApplicationLog(mUserPreferences);
mApplicationLog.start();
//Note: invoke this early in the application lifecycle, before the TunerManager causes the sdrplay classes
//to be loaded since the jextract auto-generated code attempts to load the library by name and that can fail
//when the library was not installed into a normal/default location, particularly on windows OS systems.
if(SDRPlayLibraryHelper.LOADED)
{
mLog.info("SDRPlay API native library preemptively loaded");
}
mResourceMonitor = new ResourceMonitor(mUserPreferences);
String operatingSystem = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH);

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$);
}
}
}

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