diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api.h deleted file mode 100644 index 321b8a51..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api.h +++ /dev/null @@ -1,229 +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) -//#include "windows.h" -//#elif defined (__GNUC__) -typedef void *HANDLE; -//#endif - -//#ifndef _SDRPLAY_DLL_QUALIFIER -//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86)) -//#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.07) - -// 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; - 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); -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); - 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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_callback.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_callback.h deleted file mode 100644 index 88d56049..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_callback.h +++ /dev/null @@ -1,78 +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_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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_control.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_control.h deleted file mode 100644 index 5a52a104..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_control.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_dev.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_dev.h deleted file mode 100644 index 5ac99ae2..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_dev.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp1a.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp1a.h deleted file mode 100644 index 3affbcc3..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp1a.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp2.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp2.h deleted file mode 100644 index 930d3e95..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rsp2.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDuo.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDuo.h deleted file mode 100644 index 3c456635..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDuo.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDx.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDx.h deleted file mode 100644 index 14cad9dc..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rspDx.h +++ /dev/null @@ -1,45 +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_60 20 // Number of LNA states when using AM Port 2 between 12 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 26 // 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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rx_channel.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rx_channel.h deleted file mode 100644 index 01008040..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_rx_channel.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_tuner.h b/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_tuner.h deleted file mode 100644 index a5c446d6..00000000 --- a/artifacts/sdrplay-api-headers/v3_07/sdrplay_api_tuner.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api.h deleted file mode 100644 index 3a33b796..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api.h +++ /dev/null @@ -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) -//#include "windows.h" -//#elif defined (__GNUC__) -typedef void *HANDLE; -//#endif -// -//#ifndef _SDRPLAY_DLL_QUALIFIER -//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86)) -//#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.08) - -// 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_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Open(void); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Close(void); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_LockDeviceApi(void); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(void); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device); -// _SDRPLAY_DLL_QUALIFIER const char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT *device); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(void); // Must be called before sdrplay_api_SelectDevice() -// -// // Device API function definitions -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); -// _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate); -// _SDRPLAY_DLL_QUALIFIER 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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_callback.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_callback.h deleted file mode 100644 index 88d56049..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_callback.h +++ /dev/null @@ -1,78 +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_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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_control.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_control.h deleted file mode 100644 index 5a52a104..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_control.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_dev.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_dev.h deleted file mode 100644 index 5ac99ae2..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_dev.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp1a.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp1a.h deleted file mode 100644 index 3affbcc3..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp1a.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp2.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp2.h deleted file mode 100644 index 930d3e95..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rsp2.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDuo.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDuo.h deleted file mode 100644 index 3c456635..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDuo.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDx.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDx.h deleted file mode 100644 index 14cad9dc..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rspDx.h +++ /dev/null @@ -1,45 +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_60 20 // Number of LNA states when using AM Port 2 between 12 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 26 // 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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rx_channel.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rx_channel.h deleted file mode 100644 index 01008040..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_rx_channel.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_tuner.h b/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_tuner.h deleted file mode 100644 index a5c446d6..00000000 --- a/artifacts/sdrplay-api-headers/v3_08/sdrplay_api_tuner.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h deleted file mode 100644 index 2844e21a..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h +++ /dev/null @@ -1,235 +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.15) - -// 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) -#define SDRPLAY_RSP1B_ID (6) -#define SDRPLAY_RSPdxR2_ID (7) - -// 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, - sdrplay_api_Update_RspDuo_ResetSlaveFlags = 0x00000040, - - // 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_ErrorInfoT* (*sdrplay_api_GetLastErrorByType_t)(sdrplay_api_DeviceT *device, int type, unsigned long long *time); -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_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Open(void); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Close(void); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_LockDeviceApi(void); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(void); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device); - _SDRPLAY_DLL_QUALIFIER const char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT *device); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrorInfoT* sdrplay_api_GetLastErrorByType(sdrplay_api_DeviceT *device, int type, unsigned long long *time); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(void); // Must be called before sdrplay_api_SelectDevice() - - // Device API function definitions - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); - _SDRPLAY_DLL_QUALIFIER sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate); - _SDRPLAY_DLL_QUALIFIER 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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_callback.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_callback.h deleted file mode 100644 index 0da80502..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_callback.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_control.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_control.h deleted file mode 100644 index 5a52a104..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_control.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_dev.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_dev.h deleted file mode 100644 index 5ac99ae2..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_dev.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp1a.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp1a.h deleted file mode 100644 index 3affbcc3..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp1a.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp2.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp2.h deleted file mode 100644 index 930d3e95..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp2.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDuo.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDuo.h deleted file mode 100644 index 609cf7c6..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDuo.h +++ /dev/null @@ -1,47 +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 resetGainUpdate; // default: 0 - unsigned char resetRfUpdate; // default: 0 -} sdrplay_api_RspDuo_ResetSlaveFlagsT; - -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_RspDuo_ResetSlaveFlagsT resetSlaveFlags; -} sdrplay_api_RspDuoTunerParamsT; - -#endif //SDRPLAY_API_RSPduo_H diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDx.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDx.h deleted file mode 100644 index 0528de96..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDx.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rx_channel.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rx_channel.h deleted file mode 100644 index 01008040..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rx_channel.h +++ /dev/null @@ -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 diff --git a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_tuner.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_tuner.h deleted file mode 100644 index a5c446d6..00000000 --- a/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_tuner.h +++ /dev/null @@ -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 diff --git a/build.gradle b/build.gradle index a3deeacb..46f7aa86 100644 --- a/build.gradle +++ b/build.gradle @@ -129,6 +129,7 @@ dependencies { implementation 'io.github.dsheirer:jbladerf:2.6.0' //bladeRF tuners - GitHub release, see settings.gradle implementation 'io.github.dsheirer:jhydrasdr:1.1.4' //HydraSDR tuners - GitHub release, see settings.gradle implementation 'io.github.dsheirer:jrtl:1.4.0.1' //RTL-SDR tuners - GitHub release, see settings.gradle + implementation 'io.github.dsheirer:jsdrplay:3.15.3' //SDRplay RSP tuners - GitHub release, see settings.gradle implementation 'io.github.dsheirer:radio-reference-api:18.0.0' implementation 'io.github.dsheirer:usb4java-native-libraries:1.3.3' //OSX & Windows aarch64 native libs implementation 'io.github.dsheirer:usb4java:1.3.5' //Fork with Loader support for OSX Multi-Version @@ -168,8 +169,7 @@ def jvmArgsWindows = '--enable-preview', //Project Panama Vector API is still in incubator '--enable-native-access=ALL-UNNAMED', //Suppress unsafe warnings for FFM API Foreign Memory calls '--enable-native-access=javafx.graphics', //JDK24 - suppress restricted java.lang.System calls - '--sun-misc-unsafe-memory-access=allow', //JDK24 - suppress sun.misc.Unsafe::allocateMemory warning - '-Djava.library.path=c:\\Program Files\\SDRplay\\API\\x64'] //SDRPlay API library path + '--sun-misc-unsafe-memory-access=allow'] //JDK24 - suppress sun.misc.Unsafe::allocateMemory warning /** * JVM Arguments for running the application on Linux. @@ -180,7 +180,7 @@ def jvmArgsLinux = '--enable-preview', //Project Panama Vector & Foreign Function APIs remain in incubator '--sun-misc-unsafe-memory-access=allow', //JDK24 - suppress sun.misc.Unsafe::allocateMemory warning '--enable-native-access=javafx.graphics', //JDK24 - suppress restricted java.lang.System calls - '--enable-native-access=ALL-UNNAMED'] //SDRPlay API library path + '--enable-native-access=ALL-UNNAMED'] //Suppress warnings for FFM API native calls (tuner libraries) application { mainClass = "io.github.dsheirer.gui.SDRTrunk" diff --git a/settings.gradle b/settings.gradle index 718e25f3..0bd37ccf 100644 --- a/settings.gradle +++ b/settings.gradle @@ -41,6 +41,15 @@ dependencyResolutionManagement { content { includeModule 'io.github.dsheirer', 'jhydrasdr' } } + //jsdrplay is published as a GitHub release. The jar does not contain the SDRplay API native library, which + //users install separately from sdrplay.com + ivy { + url = 'https://github.com/DSheirer/jsdrplay/releases/download' + patternLayout { artifact 'v[revision]/[artifact]-[revision].[ext]' } + metadataSources { artifact() } + content { includeModule 'io.github.dsheirer', 'jsdrplay' } + } + //jBladeRF is published as a GitHub release, with the native libraries for all platforms in the jar ivy { url = 'https://github.com/DSheirer/jBladeRF/releases/download' diff --git a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java index 137b4f21..d3adc4cc 100644 --- a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java +++ b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java @@ -56,7 +56,6 @@ 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; @@ -154,14 +153,6 @@ public class SDRTrunk implements Listener 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); ThreadPool.logSettings(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java b/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java index 02a814a2..b5e7817b 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java +++ b/src/main/java/io/github/dsheirer/source/tuner/TunerFactory.java @@ -22,6 +22,8 @@ package io.github.dsheirer.source.tuner; import io.github.dsheirer.gui.preference.tuner.RspDuoSelectionMode; import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.source.ChannelizerType; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.RspModel; import io.github.dsheirer.source.SourceException; import io.github.dsheirer.source.mixer.MixerManager; import io.github.dsheirer.source.tuner.airspy.AirspyTuner; @@ -68,17 +70,8 @@ import io.github.dsheirer.source.tuner.rtl.r8x.r820t.R820TTunerConfiguration; import io.github.dsheirer.source.tuner.rtl.r8x.r828d.R828DTunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1aDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1bDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp2Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDxDevice; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import io.github.dsheirer.source.tuner.sdrplay.rsp1.ControlRsp1; import io.github.dsheirer.source.tuner.sdrplay.rsp1.DiscoveredRsp1Tuner; import io.github.dsheirer.source.tuner.sdrplay.rsp1.IControlRsp1; @@ -150,7 +143,7 @@ public class TunerFactory { List tuners = new ArrayList<>(); - switch(deviceInfo.getDeviceType()) + switch(deviceInfo.model()) { case RSP1: tuners.add(new DiscoveredRsp1Tuner(deviceInfo, channelizerType)); @@ -164,181 +157,119 @@ public class TunerFactory case RSP2: tuners.add(new DiscoveredRsp2Tuner(deviceInfo, channelizerType)); break; - case RSPdx: - case RSPdxR2: + case RSPDX: + case RSPDX_R2: tuners.add(new DiscoveredRspDxTuner(deviceInfo, channelizerType)); break; - case RSPduo: + case RSPDUO: switch(selectionMode) { case SINGLE_1: - deviceInfo.setDeviceSelectionMode(DeviceSelectionMode.SINGLE_TUNER_1); tuners.add(new DiscoveredRspDuoTuner1(deviceInfo, channelizerType)); break; case SINGLE_2: - deviceInfo.setDeviceSelectionMode(DeviceSelectionMode.SINGLE_TUNER_2); tuners.add(new DiscoveredRspDuoTuner2(deviceInfo, channelizerType)); break; case DUAL: MasterSlaveBridge bridge = new MasterSlaveBridge(); - deviceInfo.setDeviceSelectionMode(DeviceSelectionMode.MASTER_TUNER_1); tuners.add(new DiscoveredRspDuoTuner1(deviceInfo, channelizerType, bridge)); - - DeviceInfo deviceInfoTuner2 = deviceInfo.clone(); - deviceInfoTuner2.setDeviceSelectionMode(DeviceSelectionMode.SLAVE_TUNER_2); - tuners.add(new DiscoveredRspDuoTuner2(deviceInfoTuner2, channelizerType, bridge)); + tuners.add(new DiscoveredRspDuoTuner2(deviceInfo, channelizerType, bridge)); break; } break; default: - mLog.warn("SDRPlay API returned an unknown tuner type [" + deviceInfo.getDeviceType() + - "] with serial number [" + deviceInfo.getSerialNumber() + "]"); + mLog.warn("SDRPlay API returned an unknown tuner type [" + deviceInfo.model() + + "] with serial number [" + deviceInfo.serialNumber() + "]"); } return tuners; } /** - * Locates the matching RSP device described by the device info object and creates an RSP tuner instance. + * Creates an RSP tuner instance for the RSP device described by the device info object. The device is selected + * from the SDRplay API when the tuner is started. * @param deviceInfo to match + * @param selectionMode for the device (RSPduo single tuner 1 or 2, or single tuner 1 for all others). * @param channelizerType for the tuner * @param tunerErrorListener to monitor the tuner's status * @return constructed RSP tuner instance - * @throws SDRPlayException if the device is not available or is not supported + * @throws RspException if the device is not supported */ - public static RspTuner getRspTuner(DeviceInfo deviceInfo, ChannelizerType channelizerType, - ITunerErrorListener tunerErrorListener) throws SDRPlayException + public static RspTuner getRspTuner(DeviceInfo deviceInfo, DeviceSelectionMode selectionMode, + ChannelizerType channelizerType, ITunerErrorListener tunerErrorListener) + throws RspException { - //API instance is retained across the lifecycle of the constructed device, so we only close it if we don't get - //a device from it. - SDRplay api = null; - - try + switch(deviceInfo.model()) { - api = new SDRplay(); + case RSP1: + Rsp1TunerController rsp1TunerController = new Rsp1TunerController(new ControlRsp1(deviceInfo), tunerErrorListener); + return new RspTuner(rsp1TunerController, tunerErrorListener, channelizerType); + case RSP1A: + Rsp1aTunerController rsp1aTunerController = new Rsp1aTunerController(new ControlRsp1a(deviceInfo), tunerErrorListener); + return new RspTuner(rsp1aTunerController, tunerErrorListener, channelizerType); + case RSP1B: + Rsp1bTunerController rsp1bTunerController = new Rsp1bTunerController(new ControlRsp1b(deviceInfo), tunerErrorListener); + return new RspTuner(rsp1bTunerController, tunerErrorListener, channelizerType); + case RSP2: + Rsp2TunerController rsp2TunerController = new Rsp2TunerController(new ControlRsp2(deviceInfo), tunerErrorListener); + return new RspTuner(rsp2TunerController, tunerErrorListener, channelizerType); + case RSPDX: + case RSPDX_R2: + RspDxTunerController rspDxTunerController = new RspDxTunerController(new ControlRspDx(deviceInfo), tunerErrorListener); + return new RspTuner(rspDxTunerController, tunerErrorListener, channelizerType); + case RSPDUO: + switch(selectionMode) + { + case SINGLE_TUNER_1: + IControlRspDuoTuner1 controlRspDuoTuner1 = new ControlRspDuoTuner1Single(deviceInfo); + RspDuoTuner1Controller rspDuoTuner1Controller = new RspDuoTuner1Controller(controlRspDuoTuner1, tunerErrorListener); + return new RspTuner(rspDuoTuner1Controller, tunerErrorListener, channelizerType); + case SINGLE_TUNER_2: + IControlRspDuoTuner2 controlRspDuoTuner2 = new ControlRspDuoTuner2Single(deviceInfo); + RspDuoTuner2Controller rspDuoTuner2Controller = new RspDuoTuner2Controller(controlRspDuoTuner2, tunerErrorListener); + return new RspTuner(rspDuoTuner2Controller, tunerErrorListener, channelizerType); + default: + throw new RspException("This method only supports RSPduo single tuner configurations"); + } + default: + mLog.warn("Unrecognized SDRplay RSP Device Type: " + deviceInfo.model() + " SER#: " + deviceInfo.serialNumber()); + throw new RspException("Unsupported RSP device: " + deviceInfo); } - catch(SDRPlayException se) - { - mLog.info("Caught the exception here ...", se); - api = null; - } - - if(api != null && api.isAvailable()) - { - Device device = api.getDevice(deviceInfo); - - switch(device.getDeviceType()) - { - case RSP1: - if(device instanceof Rsp1Device rsp1Device) - { - IControlRsp1 controlRsp1 = new ControlRsp1(rsp1Device); - Rsp1TunerController rsp1TunerController = new Rsp1TunerController(controlRsp1, tunerErrorListener); - return new RspTuner(rsp1TunerController, tunerErrorListener, channelizerType); - } - break; - case RSP1A: - if(device instanceof Rsp1aDevice rsp1aDevice) - { - IControlRsp1a controlRsp1a = new ControlRsp1a(rsp1aDevice); - Rsp1aTunerController rsp1aTunerController = new Rsp1aTunerController(controlRsp1a, tunerErrorListener); - return new RspTuner(rsp1aTunerController, tunerErrorListener, channelizerType); - } - break; - case RSP1B: - if(device instanceof Rsp1bDevice rsp1bDevice) - { - IControlRsp1b controlRsp1b = new ControlRsp1b(rsp1bDevice); - Rsp1bTunerController rsp1bTunerController = new Rsp1bTunerController(controlRsp1b, tunerErrorListener); - return new RspTuner(rsp1bTunerController, tunerErrorListener, channelizerType); - } - break; - case RSP2: - if(device instanceof Rsp2Device rsp2Device) - { - IControlRsp2 controlRsp2 = new ControlRsp2(rsp2Device); - Rsp2TunerController rsp2TunerController = new Rsp2TunerController(controlRsp2, tunerErrorListener); - return new RspTuner(rsp2TunerController, tunerErrorListener, channelizerType); - } - break; - case RSPdx: - case RSPdxR2: - if(device instanceof RspDxDevice rspDxDevice) - { - IControlRspDx controlRspDx = new ControlRspDx(rspDxDevice); - RspDxTunerController rspDxTunerController = new RspDxTunerController(controlRspDx, tunerErrorListener); - return new RspTuner(rspDxTunerController, tunerErrorListener, channelizerType); - } - break; - case RSPduo: - if(device instanceof RspDuoDevice rspDuoDevice) - { - switch(deviceInfo.getDeviceSelectionMode()) - { - case SINGLE_TUNER_1: - IControlRspDuoTuner1 controlRspDuoTuner1 = new ControlRspDuoTuner1Single(rspDuoDevice); - RspDuoTuner1Controller rspDuoTuner1Controller = new RspDuoTuner1Controller(controlRspDuoTuner1, tunerErrorListener); - return new RspTuner(rspDuoTuner1Controller, tunerErrorListener, channelizerType); - case SINGLE_TUNER_2: - IControlRspDuoTuner2 controlRspDuoTuner2 = new ControlRspDuoTuner2Single(rspDuoDevice); - RspDuoTuner2Controller rspDuoTuner2Controller = new RspDuoTuner2Controller(controlRspDuoTuner2, tunerErrorListener); - return new RspTuner(rspDuoTuner2Controller, tunerErrorListener, channelizerType); - default: - throw new SDRPlayException("This method only supports RSPduo single tuner configurations"); - } - } - break; - default: - mLog.warn("Unrecognized SDRplay RSP Device Type: " + device.getDeviceType() + " SER#: " + device.getSerialNumber()); - break; - } - } - - throw new SDRPlayException("Unable to obtain RSP tuner"); } /** - * Locates the matching RSP device described by the device info object and creates an RSP tuner instance. + * Creates an RSPduo master (tuner 1) or slave (tuner 2) tuner instance for the device described by the device + * info object. The device is selected from the SDRplay API when the tuner is started. * @param deviceInfo to match + * @param selectionMode master tuner 1 or slave tuner 2 * @param channelizerType for the tuner * @param tunerErrorListener to monitor the tuner's status * @param bridge to link master/slave instances together * @return constructed RSP tuner instance - * @throws SDRPlayException if the device is not available or is not supported + * @throws RspException if the device is not an RSPduo or the selection mode is not master or slave */ - public static RspTuner getRspDuoTuner(DeviceInfo deviceInfo, ChannelizerType channelizerType, - ITunerErrorListener tunerErrorListener, MasterSlaveBridge bridge) throws SDRPlayException + public static RspTuner getRspDuoTuner(DeviceInfo deviceInfo, DeviceSelectionMode selectionMode, + ChannelizerType channelizerType, ITunerErrorListener tunerErrorListener, + MasterSlaveBridge bridge) throws RspException { - SDRplay api = new SDRplay(); - - if(api.isAvailable()) + if(deviceInfo.model() != RspModel.RSPDUO) { - Device device = api.getDevice(deviceInfo); - - switch(device.getDeviceType()) - { - case RSPduo: - if(device instanceof RspDuoDevice rspDuoDevice) - { - switch(deviceInfo.getDeviceSelectionMode()) - { - case MASTER_TUNER_1: - IControlRspDuoTuner1 controlRspDuoTuner1 = new ControlRspDuoTuner1Master(rspDuoDevice, bridge); - RspDuoTuner1Controller rspDuoTuner1Controller = new RspDuoTuner1Controller(controlRspDuoTuner1, tunerErrorListener); - return new RspTuner(rspDuoTuner1Controller, tunerErrorListener, channelizerType); - case SLAVE_TUNER_2: - IControlRspDuoTuner2 controlRspDuoTuner2 = new ControlRspDuoTuner2Slave(rspDuoDevice, bridge); - RspDuoTuner2Controller rspDuoTuner2Controller = new RspDuoTuner2Controller(controlRspDuoTuner2, tunerErrorListener); - return new RspTuner(rspDuoTuner2Controller, tunerErrorListener, channelizerType); - default: - throw new SDRPlayException("This method only supports RSPduo single tuner configurations"); - } - } - break; - } + throw new RspException("Device is not an RSPduo: " + deviceInfo); } - throw new SDRPlayException("Unable to obtain RSPduo tuner"); + switch(selectionMode) + { + case MASTER_TUNER_1: + IControlRspDuoTuner1 controlRspDuoTuner1 = new ControlRspDuoTuner1Master(deviceInfo, bridge); + RspDuoTuner1Controller rspDuoTuner1Controller = new RspDuoTuner1Controller(controlRspDuoTuner1, tunerErrorListener); + return new RspTuner(rspDuoTuner1Controller, tunerErrorListener, channelizerType); + case SLAVE_TUNER_2: + IControlRspDuoTuner2 controlRspDuoTuner2 = new ControlRspDuoTuner2Slave(deviceInfo, bridge); + RspDuoTuner2Controller rspDuoTuner2Controller = new RspDuoTuner2Controller(controlRspDuoTuner2, tunerErrorListener); + return new RspTuner(rspDuoTuner2Controller, tunerErrorListener, channelizerType); + default: + throw new RspException("This method only supports RSPduo master/slave configurations"); + } } /** @@ -470,7 +401,7 @@ public class TunerFactory case RSP: if(discoveredTuner instanceof DiscoveredRspTuner discoveredRspTuner) { - switch(discoveredRspTuner.getDeviceType()) + switch(discoveredRspTuner.getModel()) { case RSP1: return new Rsp1TunerEditor(userPreferences, tunerManager, discoveredRspTuner); @@ -480,10 +411,10 @@ public class TunerFactory return new Rsp1bTunerEditor(userPreferences, tunerManager, discoveredRspTuner); case RSP2: return new Rsp2TunerEditor(userPreferences, tunerManager, discoveredRspTuner); - case RSPdx: - case RSPdxR2: + case RSPDX: + case RSPDX_R2: return new RspDxTunerEditor(userPreferences, tunerManager, discoveredRspTuner); - case RSPduo: + case RSPDUO: if(discoveredRspTuner instanceof DiscoveredRspDuoTuner1 duoTuner1) { return new RspDuoTuner1Editor(userPreferences, tunerManager, duoTuner1); @@ -499,7 +430,7 @@ public class TunerFactory } case UNKNOWN: throw new IllegalArgumentException("Unrecognized RSP device type: " + - discoveredRspTuner.getDeviceType()); + discoveredRspTuner.getModel()); } } throw new IllegalArgumentException("Unrecognized discovered RSP tuner class: " + diff --git a/src/main/java/io/github/dsheirer/source/tuner/manager/TunerManager.java b/src/main/java/io/github/dsheirer/source/tuner/manager/TunerManager.java index cc61e0ee..5690984b 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/manager/TunerManager.java +++ b/src/main/java/io/github/dsheirer/source/tuner/manager/TunerManager.java @@ -22,6 +22,9 @@ package io.github.dsheirer.source.tuner.manager; import io.github.dsheirer.gui.preference.tuner.RspDuoSelectionMode; import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.preference.source.ChannelizerType; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.SDRplay; +import io.github.dsheirer.sdrplay.SDRplayException; import io.github.dsheirer.source.Source; import io.github.dsheirer.source.SourceException; import io.github.dsheirer.source.config.SourceConfigTuner; @@ -39,9 +42,6 @@ import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.configuration.TunerConfigurationManager; import io.github.dsheirer.source.tuner.recording.RecordingTunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; import io.github.dsheirer.source.tuner.sdrplay.rspDuo.DiscoveredRspDuoTuner1; import io.github.dsheirer.source.tuner.ui.DiscoveredTunerModel; import io.github.dsheirer.util.ThreadPool; @@ -181,11 +181,7 @@ public class TunerManager implements IDiscoveredTunerStatusListener mDiscoveredTunerModel.releaseDiscoveredTuners(); //Shutdown SDRplay API instance - if(mSDRplay != null) - { - mSDRplay.close(); - mSDRplay = null; - } + closeSDRplay(); //Shutdown LibUsb if(mLibUsbInitialized) @@ -360,31 +356,36 @@ public class TunerManager implements IDiscoveredTunerStatusListener ChannelizerType channelizerType = mUserPreferences.getTunerPreference().getChannelizerType(); RspDuoSelectionMode duoSelectionMode = mUserPreferences.getTunerPreference().getRspDuoTunerMode(); - //Note: we have to keep this first API instance open while we use any RSP tuners, otherwise the additional API - //instance(s) used by the individual tuners become unresponsive. Note sure why. + if(!SDRplay.isInstalled()) + { + mLog.info("SDRplay API is not installed - RSP tuners are not available"); + return; + } + //Note: this session stays open while RSP tuners are in use. Each RSP tuner opens its own session and the + //sessions share a single connection to the SDRplay API service, which closes when the last session closes. try { - mSDRplay = new SDRplay(); + mSDRplay = SDRplay.open(); + mLog.info("SDRplay API version [" + mSDRplay.apiVersion() + "] loaded from [" + mSDRplay.location() + "]"); } - catch(SDRPlayException se) + catch(SDRplayException se) { - mLog.error("Couldn't load SDRPlay API"); + mLog.error("Couldn't open SDRplay API - " + se.getMessage()); mSDRplay = null; } - if(mSDRplay != null && mSDRplay.isAvailable()) + if(mSDRplay != null) { try { - List deviceInfos = mSDRplay.getDeviceInfos(); + List deviceInfos = mSDRplay.devices(); mLog.info("Discovered [" + deviceInfos.size() + "] RSP devices from SDRplay API"); if(deviceInfos.isEmpty()) { - mSDRplay.close(); - mSDRplay = null; + closeSDRplay(); return; } @@ -398,17 +399,28 @@ public class TunerManager implements IDiscoveredTunerStatusListener } } } - catch(SDRPlayException se) + catch(SDRplayException se) { - mLog.info("Unable to get list of devices from SDRplay API"); + mLog.info("Unable to get list of devices from SDRplay API - " + se.getMessage()); } } - else + } + + /** + * Closes the SDRplay API discovery session. + */ + private void closeSDRplay() + { + if(mSDRplay != null) { - if(mSDRplay != null) + try { mSDRplay.close(); } + catch(SDRplayException se) + { + mLog.warn("Error closing SDRplay API - " + se.getMessage()); + } mSDRplay = null; } @@ -459,7 +471,7 @@ public class TunerManager implements IDiscoveredTunerStatusListener } //Special handling for RSPduo to auto-update enabled state for slave device when configured for master/slave operation - if(discoveredTuner instanceof DiscoveredRspDuoTuner1 rspDuoTuner1 && rspDuoTuner1.getDeviceInfo().getDeviceSelectionMode().isMasterMode()) + if(discoveredTuner instanceof DiscoveredRspDuoTuner1 rspDuoTuner1 && rspDuoTuner1.getDeviceSelectionMode().isMasterMode()) { String id = rspDuoTuner1.getId(); id = id.replace(DiscoveredRspDuoTuner1.RSP_DUO_ID_PREFIX + "1", DiscoveredRspDuoTuner1.RSP_DUO_ID_PREFIX + "2"); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ControlRsp.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ControlRsp.java index f7a5b3a9..b3dc59d7 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ControlRsp.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ControlRsp.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,17 +19,18 @@ package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.Status; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IDeviceEventListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamListener; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; -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.sdrplay.DeviceEvent; +import io.github.dsheirer.sdrplay.DeviceEventListener; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.IfMode; +import io.github.dsheirer.sdrplay.LoMode; +import io.github.dsheirer.sdrplay.RspDevice; +import io.github.dsheirer.sdrplay.RxChannel; +import io.github.dsheirer.sdrplay.SDRplay; +import io.github.dsheirer.sdrplay.SDRplayError; +import io.github.dsheirer.sdrplay.SDRplayException; +import io.github.dsheirer.sdrplay.SampleListener; +import io.github.dsheirer.sdrplay.Tuner; import io.github.dsheirer.util.ThreadPool; import java.lang.ref.WeakReference; import java.util.concurrent.locks.ReentrantLock; @@ -37,17 +38,25 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** - * Base RSP control implementation + * Base RSP control implementation using the jsdrplay library. + * + * The device is selected from the SDRplay API when start() is invoked and released when stop() is invoked. Each + * control opens its own jsdrplay session, which shares the single process-wide connection to the API service. + * + * @param jsdrplay device type for the RSP model */ -public abstract class ControlRsp implements IControlRsp +public abstract class ControlRsp implements IControlRsp { private static final Logger mLog = LoggerFactory.getLogger(ControlRsp.class); - private T mDevice; + private final DeviceInfo mDeviceInfo; + private final Class mDeviceClass; + private SDRplay mSession; + private volatile T mDevice; protected RspSampleRate mSampleRate = RspSampleRate.RATE_8_000; protected int mLNA; protected int mBasebandGainReduction; - private IDeviceEventListener mDeviceEventListener; - private IStreamListener mStreamListener; + private DeviceEventListener mDeviceEventListener; + private SampleListener mSampleListener; protected WeakReference mGainOverloadReference; //Streaming control lock and boolean status indicator. Access to the boolean indicator is protected by the lock. @@ -56,48 +65,161 @@ public abstract class ControlRsp implements IControlRsp /** * Constructs an instance - * @param device for the device, obtained from the API + * @param deviceInfo for the device, obtained from the API + * @param deviceClass jsdrplay device class that the API returns for this RSP model */ - public ControlRsp(T device) + public ControlRsp(DeviceInfo deviceInfo, Class deviceClass) { - mDevice = device; + mDeviceInfo = deviceInfo; + mDeviceClass = deviceClass; } @Override - public TunerSelect getTunerSelect() + public DeviceInfo getDeviceInfo() { - return TunerSelect.TUNER_1; + return mDeviceInfo; } @Override - public void start() throws SDRPlayException + public Tuner getSdrplayTuner() + { + return Tuner.A; + } + + @Override + public DeviceSelectionMode getDeviceSelectionMode() + { + //Default device selection mode for all tuners except the RSPduo + return DeviceSelectionMode.SINGLE_TUNER_1; + } + + /** + * Selects the device from the API. Subclasses override this to select the RSPduo in a specific mode. + * @param session to select from + * @param deviceInfo current device info from the API + * @return selected device + * @throws SDRplayException if the API can't select the device + */ + protected RspDevice select(SDRplay session, DeviceInfo deviceInfo) throws SDRplayException + { + return session.select(deviceInfo); + } + + /** + * IF mode to use for the selected tuner. + */ + protected IfMode getIfMode() + { + return IfMode.ZERO; + } + + @Override + public void start() throws RspException { if(hasDevice()) { - getDevice().select(); - - //Enable automatic DC and I/Q correction - getDevice().getCompositeParameters().getControlAParameters().getDcOffset().setDC(true); - getDevice().getCompositeParameters().getControlAParameters().getDcOffset().setIQ(true); - - //Setup IF & LO Mode - getDevice().setIfMode(IfMode.IF_ZERO); - getDevice().setLoMode(LoMode.AUTO); + return; } - else + + SDRplay session = null; + + try { - throw new SDRPlayException("Unable to start - device is null"); + session = SDRplay.open(); + RspDevice device = select(session, getCurrentDeviceInfo(session)); + + if(!mDeviceClass.isInstance(device)) + { + device.close(); + throw new RspException("Unexpected SDRplay device class [" + device.getClass().getSimpleName() + + "] for " + mDeviceInfo); + } + + //Enable automatic DC and I/Q correction and setup IF and LO mode + RxChannel channel = device.channel(); + channel.setDcOffsetCorrection(true); + channel.setIqCorrection(true); + channel.setIfMode(getIfMode()); + channel.setLoMode(LoMode.AUTO); + + mSession = session; + mDevice = mDeviceClass.cast(device); + } + catch(SDRplayException | RuntimeException e) + { + //Closing the session also closes any device selected through it + closeQuietly(session); + throw new RspException("Unable to select " + mDeviceInfo + " - " + e.getMessage(), e); + } + catch(RspException re) + { + closeQuietly(session); + throw re; } } - @Override - public void stop() throws SDRPlayException + /** + * Finds the current device info from the API for this device. The API lists only devices (or RSPduo tuners) + * that are not in use and the RSPduo modes that are currently available. + * @param session to query + * @return current device info + * @throws RspException if the device is not available + */ + private DeviceInfo getCurrentDeviceInfo(SDRplay session) throws SDRplayException, RspException { - if(hasDevice()) + for(DeviceInfo deviceInfo: session.devices()) { - stopStream(); - getDevice().release(); - clearDevice(); + if(deviceInfo.serialNumber().equals(mDeviceInfo.serialNumber())) + { + return deviceInfo; + } + } + + throw new RspException("Device is not available - it may be in use by another application"); + } + + @Override + public void stop() throws RspException + { + stopStream(); + + T device = mDevice; + SDRplay session = mSession; + mDevice = null; + mSession = null; + + try + { + if(device != null) + { + device.close(); + } + } + catch(SDRplayException | RuntimeException e) + { + throw new RspException("Error releasing " + mDeviceInfo, e); + } + finally + { + closeQuietly(session); + } + } + + /** + * Closes the session, ignoring and logging any errors. + */ + private void closeQuietly(SDRplay session) + { + if(session != null) + { + try + { + session.close(); + } + catch(Exception e) + { + mLog.warn("Error closing SDRplay API session - " + e.getMessage()); + } } } @@ -108,27 +230,25 @@ public abstract class ControlRsp implements IControlRsp try { - if(hasDevice()) + if(!mStreaming) { - if(!mStreaming) - { - getDevice().initStreamA(getDeviceEventListener(), getStreamListener()); - mStreaming = true; - } - } - else - { - mLog.error("Unable to start RSP device sample stream - device not started"); + getDevice().start(mSampleListener, mDeviceEventListener); + mStreaming = true; } } - catch(SDRPlayException se) + catch(RspException re) { - if(se.getStatus() == Status.FAIL) + mLog.error("Unable to start RSP device sample stream - device not started"); + } + catch(SDRplayException se) + { + if(se.error() == SDRplayError.FAIL) { mLog.error("Unable to start RSP streaming - device may have been unplugged - removing."); + if(mDeviceEventListener != null) { - mDeviceEventListener.processDeviceRemoval(getTunerSelect()); + mDeviceEventListener.onEvent(new DeviceEvent.DeviceRemoved(getSdrplayTuner())); } } else @@ -136,6 +256,10 @@ public abstract class ControlRsp implements IControlRsp mLog.error("Unable to initialize/start streaming for RSP device", se); } } + catch(RuntimeException re) + { + mLog.error("Unable to initialize/start streaming for RSP device", re); + } finally { mStreamingLock.unlock(); @@ -149,14 +273,16 @@ public abstract class ControlRsp implements IControlRsp try { - if(hasDevice() && mStreaming) + T device = mDevice; + + if(mStreaming && device != null && !device.isClosed()) { - getDevice().uninitialize(); + device.stop(); } } - catch(SDRPlayException se) + catch(SDRplayException | RuntimeException e) { - mLog.error("Unable to uninitialize/stop streaming for RSP device"); + mLog.error("Unable to uninitialize/stop streaming for RSP device - " + e.getMessage()); } finally { @@ -165,85 +291,124 @@ public abstract class ControlRsp implements IControlRsp } } - @Override - public DeviceSelectionMode getDeviceSelectionMode() - { - //Default device selection mode for all tuners except the RSPduo - return DeviceSelectionMode.SINGLE_TUNER_1; - } - /** - * Device descriptor for this device + * Started device. + * @return device + * @throws RspException if the device is not started or was closed. */ - public T getDevice() + protected T getDevice() throws RspException { - return mDevice; + T device = mDevice; + + if(device == null || device.isClosed()) + { + throw new RspException("RSP device is not started"); + } + + return device; } /** - * RSP device was unplugged from USB bus. Clear the device and do not attempt any further interaction with the - * device via the API. + * RSP device was unplugged from USB bus. Close the device to release it from the API. */ @Override public void deviceRemoved() { - clearDevice(); + try + { + stop(); + } + catch(RspException re) + { + mLog.info("Error releasing removed RSP device " + mDeviceInfo + " - " + re.getMessage()); + } + } - mStreamingLock.lock(); + @Override + public boolean hasDevice() + { + T device = mDevice; + return device != null && !device.isClosed(); + } + + /** + * Command that is applied to the device. + */ + @FunctionalInterface + protected interface DeviceCommand + { + void apply(D device) throws SDRplayException; + } + + /** + * Query that is applied to the device. + */ + @FunctionalInterface + protected interface DeviceQuery + { + R get(D device) throws SDRplayException; + } + + /** + * Applies the command to the started device, converting library and API errors to RspException. + * @param description of the command for error messages + * @param command to apply + * @throws RspException if the device is not started or the command fails + */ + protected void command(String description, DeviceCommand command) throws RspException + { + T device = getDevice(); try { - mStreaming = false; + command.apply(device); } - finally + catch(SDRplayException | RuntimeException e) { - mStreamingLock.unlock(); + throw new RspException("Unable to " + description + " - " + e.getMessage(), e); } } /** - * Clears/nullifies the device. This should be invoked after stopping the device to prevent reuse. + * Applies the query to the started device, converting library and API errors to RspException. + * @param description of the query for error messages + * @param query to apply + * @return query result + * @throws RspException if the device is not started or the query fails */ - public void clearDevice() + protected R query(String description, DeviceQuery query) throws RspException { - mDevice = null; - } + T device = getDevice(); - /** - * Indicates if this control has a non-null device. - * @return true if non-null device. - */ - public boolean hasDevice() - { - return getDevice() != null; + try + { + return query.get(device); + } + catch(SDRplayException | RuntimeException e) + { + throw new RspException("Unable to " + description + " - " + e.getMessage(), e); + } } /** * Sets the sample rate * @param sampleRate enumeration value. - * @throws SDRPlayException + * @throws RspException if the device is not started or the API rejects the sample rate */ @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException + public void setSampleRate(RspSampleRate sampleRate) throws RspException { - if(hasDevice()) - { - mSampleRate = sampleRate; - getDevice().getTuner().setBandwidth(sampleRate.getBandwidth()); - getDevice().getCompositeParameters().getDeviceParameters().getSamplingFrequency() - .setSampleRate(sampleRate.getSampleRate()); - getDevice().update(getTunerSelect(), UpdateReason.DEVICE_SAMPLE_RATE); - getDevice().getCompositeParameters().getControlAParameters().getDecimation().setWideBandSignal(true); - getDevice().setDecimation(sampleRate.getDecimation()); - } - else - { - throw new SDRPlayException("RSP tuner has not been started - can't apply sample rate"); - } + command("set sample rate " + sampleRate, device -> { + device.channel().setBandwidth(sampleRate.getBandwidth()); + device.setSampleRate(sampleRate.getSampleRate()); + device.channel().setDecimation(sampleRate.getDecimation(), true); + }); + + mSampleRate = sampleRate; } @Override - public void setGain(int lna, int gr) throws SDRPlayException + public void setGain(int lna, int gr) throws RspException { int lnaLimited = Math.max(lna, 0); lnaLimited = Math.min(lnaLimited, getMaximumLNASetting()); @@ -255,15 +420,18 @@ public abstract class ControlRsp implements IControlRsp { mLog.warn("Setting gain - adjusted LNA from [" + lna + "] to [" + lnaLimited + "] and GR from [" + gr + "] to [" + grLimited + "]"); } - getDevice().getTuner().setGain(lnaLimited, grLimited); + + final int lnaState = lnaLimited; + final int gainReduction = grLimited; + command("set gain", device -> device.channel().setGain(gainReduction, lnaState)); mLNA = lnaLimited; mBasebandGainReduction = grLimited; } @Override - public float getCurrentGain() throws SDRPlayException + public float getCurrentGain() throws RspException { - return getDevice().getTuner().getGain().getGainValues().getCurrent(); + return query("get current gain", device -> device.channel().gainValues().current()); } /** @@ -281,64 +449,43 @@ public abstract class ControlRsp implements IControlRsp mGainOverloadReference = new WeakReference<>(listener); } - @Override - public void acknowledgePowerOverload(TunerSelect tunerSelect) throws SDRPlayException + /** + * Optional weakly referenced tuner status listener. + * @return listener or null. + */ + protected ITunerStatusListener getTunerStatusListener() { - if(hasDevice()) - { - getDevice().acknowledgePowerOverload(tunerSelect); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return mGainOverloadReference != null ? mGainOverloadReference.get() : null; + } - //Notify an optional weakly referenced, registered listener that gain overload has been acknowledged. - if(mGainOverloadReference != null) - { - ITunerStatusListener listener = mGainOverloadReference.get(); + @Override + public void processPowerOverload(Tuner tuner) + { + ITunerStatusListener listener = getTunerStatusListener(); - if(listener != null) - { - ThreadPool.CACHED.submit(() -> listener.notifyGainOverload(tunerSelect)); - } + if(listener != null) + { + ThreadPool.CACHED.submit(() -> listener.notifyGainOverload(tuner)); } } @Override - public long getTunedFrequency() throws SDRPlayException + public long getTunedFrequency() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().getFrequency(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get frequency", device -> (long)device.channel().frequency()); } @Override - public void setTunedFrequency(long frequency) throws SDRPlayException + public void setTunedFrequency(long frequency) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setFrequency(frequency); + command("set frequency " + frequency, device -> device.channel().setFrequency(frequency)); - //Notify an optional weakly referenced, registered listener that gain overload has been acknowledged. - if(mGainOverloadReference != null) - { - ITunerStatusListener listener = mGainOverloadReference.get(); + //Notify an optional weakly referenced, registered listener that the frequency changed. + ITunerStatusListener listener = getTunerStatusListener(); - if(listener != null) - { - ThreadPool.CACHED.submit(() -> listener.frequencyUpdated()); - } - } - } - else + if(listener != null) { - throw new SDRPlayException("Device is not initialized"); + ThreadPool.CACHED.submit(listener::frequencyUpdated); } } @@ -382,12 +529,19 @@ public abstract class ControlRsp implements IControlRsp /** * Current IF AGC mode setting. - * @return AGC mode. + * @return AGC mode or null if the device is not started. */ @Override - public AgcMode getAgcMode() + public RspAgcMode getAgcMode() { - return getDevice().getCompositeParameters().getControlAParameters().getAgc().getAgcMode(); + try + { + return query("get AGC mode", device -> RspAgcMode.fromAgcMode(device.channel().agcMode())); + } + catch(RspException re) + { + return null; + } } /** @@ -395,39 +549,20 @@ public abstract class ControlRsp implements IControlRsp * @param mode to set. */ @Override - public void setAgcMode(AgcMode mode) throws SDRPlayException + public void setAgcMode(RspAgcMode mode) throws RspException { - getDevice().getCompositeParameters().getControlAParameters().getAgc().setAgcMode(mode); - getDevice().update(getTunerSelect(), UpdateReason.CONTROL_AGC); + command("set AGC mode " + mode, device -> device.channel().setAgc(mode.getAgcMode())); } /** * Registers listeners to receive device events and sample streams. * @param deviceEventListener to receive device events - * @param streamListener to receive sample stream and related parameters. + * @param sampleListener to receive sample stream. */ @Override - public void resister(IDeviceEventListener deviceEventListener, IStreamListener streamListener) + public void register(DeviceEventListener deviceEventListener, SampleListener sampleListener) { mDeviceEventListener = deviceEventListener; - mStreamListener = streamListener; - } - - /** - * Registered device event listener - * @return device event listener or null if a listener has not been registered. - */ - protected IDeviceEventListener getDeviceEventListener() - { - return mDeviceEventListener; - } - - /** - * Registered stream listener - * @return stream listener or null if a listener has not been registered. - */ - protected IStreamListener getStreamListener() - { - return mStreamListener; + mSampleListener = sampleListener; } } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/DeviceSelectionMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DeviceSelectionMode.java similarity index 52% rename from src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/DeviceSelectionMode.java rename to src/main/java/io/github/dsheirer/source/tuner/sdrplay/DeviceSelectionMode.java index ddf1d453..cf455e7f 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/DeviceSelectionMode.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DeviceSelectionMode.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2026 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 @@ -17,47 +17,33 @@ * **************************************************************************** */ -package io.github.dsheirer.source.tuner.sdrplay.api; +package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoMode; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import java.util.EnumSet; +import io.github.dsheirer.sdrplay.RspDuoMode; +import io.github.dsheirer.sdrplay.Tuner; /** - * Enumeration of modes that indicate how each SDRplay RSP device can be selected + * RSP device selection mode. All RSP devices use single tuner 1, except the RSPduo which can use either tuner as a + * single tuner, or both tuners with tuner 1 as master and tuner 2 as slave. */ public enum DeviceSelectionMode { - //All RSP devices - SINGLE_TUNER_1("Single Tuner 1", RspDuoMode.SINGLE_TUNER, TunerSelect.TUNER_1), - SINGLE_TUNER_2("Single Tuner 2", RspDuoMode.SINGLE_TUNER, TunerSelect.TUNER_2), - MASTER_TUNER_1("Master - Tuner 1", RspDuoMode.MASTER, TunerSelect.TUNER_1), - SLAVE_TUNER_2("Slave - Tuner 2", RspDuoMode.SLAVE, TunerSelect.TUNER_2); + SINGLE_TUNER_1("Single Tuner 1", RspDuoMode.SINGLE_TUNER, Tuner.A), + SINGLE_TUNER_2("Single Tuner 2", RspDuoMode.SINGLE_TUNER, Tuner.B), + MASTER_TUNER_1("Master - Tuner 1", RspDuoMode.MASTER, Tuner.A), + SLAVE_TUNER_2("Slave - Tuner 2", RspDuoMode.SLAVE, Tuner.B); - private String mDescription; - private RspDuoMode mRspDuoMode; - private TunerSelect mTunerSelect; + private final String mDescription; + private final RspDuoMode mRspDuoMode; + private final Tuner mTuner; - /** - * Private constructor - * @param description of the mode - * @param rspDuoMode that corresponds to the mode - * @param tunerSelect tuner(s) that correspond to the mode - */ - DeviceSelectionMode(String description, RspDuoMode rspDuoMode, TunerSelect tunerSelect) + DeviceSelectionMode(String description, RspDuoMode rspDuoMode, Tuner tuner) { mDescription = description; mRspDuoMode = rspDuoMode; - mTunerSelect = tunerSelect; + mTuner = tuner; } - /** - * Set of all selection modes available for the RSPduo - */ - public static final EnumSet MASTER_MODES = EnumSet.of(MASTER_TUNER_1); - public static final EnumSet SLAVE_MODES = EnumSet.of(SLAVE_TUNER_2); - public static final EnumSet SINGLE_TUNER_MODES = EnumSet.of(SINGLE_TUNER_1, SINGLE_TUNER_2); - /** * RSPduo mode associated with the selection mode */ @@ -66,12 +52,20 @@ public enum DeviceSelectionMode return mRspDuoMode; } + /** + * Tuner associated with the selection mode + */ + public Tuner getTuner() + { + return mTuner; + } + /** * Indicates if this mode is designated as a master mode. */ public boolean isMasterMode() { - return MASTER_MODES.contains(this); + return this == MASTER_TUNER_1; } /** @@ -79,7 +73,7 @@ public enum DeviceSelectionMode */ public boolean isSlaveMode() { - return SLAVE_MODES.contains(this); + return this == SLAVE_TUNER_2; } /** @@ -87,15 +81,7 @@ public enum DeviceSelectionMode */ public boolean isSingleTunerMode() { - return SINGLE_TUNER_MODES.contains(this); - } - - /** - * Tuner(s) associated with the selection mode - */ - public TunerSelect getTunerSelect() - { - return mTunerSelect; + return this == SINGLE_TUNER_1 || this == SINGLE_TUNER_2; } @Override diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DiscoveredRspTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DiscoveredRspTuner.java index 51109b91..cad97694 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DiscoveredRspTuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/DiscoveredRspTuner.java @@ -23,8 +23,8 @@ import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.TunerClass; import io.github.dsheirer.source.tuner.TunerFactory; import io.github.dsheirer.source.tuner.manager.DiscoveredTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.RspModel; /** * Discovered SDRplay RSP tuner @@ -32,16 +32,31 @@ import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; public abstract class DiscoveredRspTuner extends DiscoveredTuner { private final DeviceInfo mDeviceInfo; + private final DeviceSelectionMode mDeviceSelectionMode; private final ChannelizerType mChannelizerType; /** * Constructs an instance * @param deviceInfo to select the device from the API + * @param deviceSelectionMode for selecting the device from the API + * @param channelizerType to use for the tuner + */ + public DiscoveredRspTuner(DeviceInfo deviceInfo, DeviceSelectionMode deviceSelectionMode, + ChannelizerType channelizerType) + { + mDeviceInfo = deviceInfo; + mDeviceSelectionMode = deviceSelectionMode; + mChannelizerType = channelizerType; + } + + /** + * Constructs an instance for single tuner 1 selection mode. + * @param deviceInfo to select the device from the API + * @param channelizerType to use for the tuner */ public DiscoveredRspTuner(DeviceInfo deviceInfo, ChannelizerType channelizerType) { - mDeviceInfo = deviceInfo; - mChannelizerType = channelizerType; + this(deviceInfo, DeviceSelectionMode.SINGLE_TUNER_1, channelizerType); } /** @@ -53,6 +68,14 @@ public abstract class DiscoveredRspTuner extends Discover return mDeviceInfo; } + /** + * Device selection mode for the discovered tuner + */ + public DeviceSelectionMode getDeviceSelectionMode() + { + return mDeviceSelectionMode; + } + /** * Channelizer type to use for the tuner */ @@ -68,11 +91,32 @@ public abstract class DiscoveredRspTuner extends Discover } /** - * Type of RSP tuner device + * RSP model */ - public DeviceType getDeviceType() + public RspModel getModel() { - return mDeviceInfo.getDeviceType(); + return mDeviceInfo.model(); + } + + /** + * Model name used in tuner IDs and display names. Note: these names are used for tuner configuration IDs and + * must not change. + * @param model of RSP + * @return model name + */ + public static String getModelName(RspModel model) + { + return switch(model) + { + case RSP1 -> "RSP1"; + case RSP1A -> "RSP1A"; + case RSP1B -> "RSP1B"; + case RSP2 -> "RSP2"; + case RSPDUO -> "RSPduo"; + case RSPDX -> "RSPdx"; + case RSPDX_R2 -> "RSPdxR2"; + default -> "UNKNOWN"; + }; } /** @@ -85,11 +129,11 @@ public abstract class DiscoveredRspTuner extends Discover { try { - mTuner = TunerFactory.getRspTuner(getDeviceInfo(), getChannelizerType(), this); + mTuner = TunerFactory.getRspTuner(getDeviceInfo(), getDeviceSelectionMode(), getChannelizerType(), this); } catch(Exception se) { - setErrorMessage("Tuner unavailable [" + getId() + "]"); + setErrorMessage("Tuner unavailable [" + getId() + "] - " + se.getMessage()); mTuner = null; } @@ -101,7 +145,7 @@ public abstract class DiscoveredRspTuner extends Discover } catch(Exception se) { - setErrorMessage("Error starting tuner [" + getId() + "]"); + setErrorMessage("Error starting tuner [" + getId() + "] - " + se.getMessage()); mTuner = null; } } @@ -111,7 +155,7 @@ public abstract class DiscoveredRspTuner extends Discover @Override public String getId() { - return getDeviceType().name() + " SER#" + getDeviceInfo().getSerialNumber(); + return getModelName(getModel()) + " SER#" + getDeviceInfo().serialNumber(); } @Override diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/IControlRsp.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/IControlRsp.java index 44bf43c5..06a2d7a6 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/IControlRsp.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/IControlRsp.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,55 +19,62 @@ package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IDeviceEventListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamListener; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; +import io.github.dsheirer.sdrplay.DeviceEventListener; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.SampleListener; +import io.github.dsheirer.sdrplay.Tuner; /** * Control interface for base RSP device */ public interface IControlRsp { + /** + * Device selection mode for this RSP. All RSP devices use single tuner 1, except the RSPduo. + */ DeviceSelectionMode getDeviceSelectionMode(); /** - * Device descriptor for this RSP - * @return device descriptor + * Device information (model and serial number) for this RSP, as discovered from the API. + * @return device info */ - Device getDevice(); + DeviceInfo getDeviceInfo(); /** - * Process an RSP device removal. Device memory resources should be nullified and the software should not attempt - * any further interaction with the device via the API. + * Indicates if the device is started (selected from the API) and available for control. + */ + boolean hasDevice(); + + /** + * Process an RSP device removal. Closes the device and releases it from the API. Note: this method must not + * be invoked from an SDRplay API callback (stream or event listener) thread. */ void deviceRemoved(); /** - * Selected tuner for this RSP. + * Selected tuner for this RSP: tuner A for all RSP devices, except the RSPduo. * @return selected tuner. */ - TunerSelect getTunerSelect(); + Tuner getSdrplayTuner(); /** - * Starts the device + * Starts the device: selects the device from the API for exclusive use. + * @throws RspException if the device is not available or can't be selected */ - void start() throws SDRPlayException; + void start() throws RspException; /** - * Stops the device + * Stops the device: stops streaming and releases the device back to the API. + * @throws RspException if there is an error */ - void stop() throws SDRPlayException; + void stop() throws RspException; /** * Registers listeners to receive device events and streaming samples when startStream() is invoked. * @param deviceEventListener to receive device events - * @param streamListener to receive sample stream and related parameters. + * @param sampleListener to receive sample stream. */ - void resister(IDeviceEventListener deviceEventListener, IStreamListener streamListener); + void register(DeviceEventListener deviceEventListener, SampleListener sampleListener); /** * Starts the sample stream and delivers the samples to the registered listener. @@ -80,22 +87,22 @@ public interface IControlRsp void stopStream(); /** - * Callback to acknowledge a power overload event. - * @param tunerSelect identifies the tuner where the power overload is happening. + * Process a power overload detected event from the API. The jsdrplay library acknowledges the event to the API. + * @param tuner where the power overload is happening. */ - void acknowledgePowerOverload(TunerSelect tunerSelect) throws SDRPlayException; + void processPowerOverload(Tuner tuner); /** * Current center tune frequency * @return frequency in Hertz */ - long getTunedFrequency() throws SDRPlayException; + long getTunedFrequency() throws RspException; /** * Sets the center tune frequency * @param frequency in Hertz */ - void setTunedFrequency(long frequency) throws SDRPlayException; + void setTunedFrequency(long frequency) throws RspException; /** * Current sample rate enumeration value @@ -107,7 +114,7 @@ public interface IControlRsp * Sets the sample rate. * @param rspSampleRate enumeration value. */ - void setSampleRate(RspSampleRate rspSampleRate) throws SDRPlayException; + void setSampleRate(RspSampleRate rspSampleRate) throws RspException; /** * Current sample rate value. @@ -119,15 +126,15 @@ public interface IControlRsp * Set the lna state and gain reduction dB values separately. * @param lna state (varies by tuner and frequency range) * @param basebandGainReduction setting (20-59) - * @throws SDRPlayException + * @throws RspException if the device is not started or the API rejects the setting. */ - void setGain(int lna, int basebandGainReduction) throws SDRPlayException; + void setGain(int lna, int basebandGainReduction) throws RspException; /** * Current gain setting as reported by the device. * @return gain value in decibels */ - float getCurrentGain() throws SDRPlayException; + float getCurrentGain() throws RspException; /** * Current LNA gain index value @@ -149,18 +156,18 @@ public interface IControlRsp /** * Current IF AGC mode setting. - * @return IF agc mode + * @return IF agc mode, or null if the device is not started. */ - AgcMode getAgcMode(); + RspAgcMode getAgcMode(); /** * Sets the IF AGC mode * @param mode to set. */ - void setAgcMode(AgcMode mode) throws SDRPlayException; + void setAgcMode(RspAgcMode mode) throws RspException; /** - * Registers a listener to receive notifications of gain overload. + * Registers a listener to receive notifications of gain overload and frequency changes. * @param listener to register */ void setGainOverloadListener(ITunerStatusListener listener); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ITunerStatusListener.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ITunerStatusListener.java index 9b173035..ac38d5cb 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ITunerStatusListener.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/ITunerStatusListener.java @@ -19,7 +19,7 @@ package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; +import io.github.dsheirer.sdrplay.Tuner; /** * Listener interface to receive notifications of gain overload in the RSP device. @@ -28,9 +28,9 @@ public interface ITunerStatusListener { /** * Notify that there is a gain overload event in the specified tuner - * @param tunerSelect to id the tuner + * @param tuner to id the tuner */ - void notifyGainOverload(TunerSelect tunerSelect); + void notifyGainOverload(Tuner tuner); /** * Notify that the tuner's frequency has changed. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AmPort.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspAgcMode.java similarity index 51% rename from src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AmPort.java rename to src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspAgcMode.java index f3c82453..289972ec 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AmPort.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspAgcMode.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2026 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 @@ -17,51 +17,43 @@ * **************************************************************************** */ -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; +package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; +import io.github.dsheirer.sdrplay.AgcMode; /** - * RSP-2 AM Port + * IF AGC mode for RSP tuners. Entry names are persisted in tuner configurations. */ -public enum Rsp2AmPort +public enum RspAgcMode { - PORT_1_HIGH_Z(sdrplay_api_h.sdrplay_api_Rsp2_AMPORT_1(), "HIGH-Z"), - PORT_2_SMA(sdrplay_api_h.sdrplay_api_Rsp2_AMPORT_2(), "SMA"); + DISABLE(AgcMode.DISABLED, "DISABLE"), + ENABLE(AgcMode.CONTROL_ENABLED, "ENABLE"); - private int mValue; - private String mDescription; + private final AgcMode mAgcMode; + private final String mDescription; - Rsp2AmPort(int value, String description) + RspAgcMode(AgcMode agcMode, String description) { - mValue = value; + mAgcMode = agcMode; mDescription = description; } /** - * Numeric value + * SDRplay API AGC mode for this entry */ - public int getValue() + public AgcMode getAgcMode() { - return mValue; + return mAgcMode; } /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or PORT 2 if the code is not recognized + * Lookup the entry that matches the SDRplay API AGC mode. + * @param agcMode from the API + * @return ENABLE for any of the enabled AGC modes, or DISABLE */ - public static Rsp2AmPort fromValue(int value) + public static RspAgcMode fromAgcMode(AgcMode agcMode) { - for(Rsp2AmPort status: Rsp2AmPort.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return PORT_2_SMA; + return agcMode == null || agcMode == AgcMode.DISABLED ? DISABLE : ENABLE; } @Override diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1DeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspException.java similarity index 58% rename from src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1DeviceParameters.java rename to src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspException.java index b0d80e9a..7b899526 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1DeviceParameters.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspException.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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 @@ -17,21 +17,30 @@ * **************************************************************************** */ -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import java.lang.foreign.MemorySegment; +package io.github.dsheirer.source.tuner.sdrplay; /** - * RSP-1 Device Parameters structure + * Error while controlling an SDRplay RSP device. Wraps errors reported by the jsdrplay library and the SDRplay API, + * and errors for a device that is not started. */ -public class Rsp1DeviceParameters extends DeviceParameters +public class RspException extends Exception { /** * Constructs an instance - * @param devParams for an allocated sdrplay_api_DevParamsT structure + * @param message describing the error */ - public Rsp1DeviceParameters(MemorySegment devParams) + public RspException(String message) { - super(devParams); + super(message); + } + + /** + * Constructs an instance + * @param message describing the error + * @param cause of the error + */ + public RspException(String message, Throwable cause) + { + super(message, cause); } } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspSampleRate.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspSampleRate.java index d2750102..f3b1e1aa 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspSampleRate.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspSampleRate.java @@ -19,8 +19,7 @@ package io.github.dsheirer.source.tuner.sdrplay; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Decimate; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Bandwidth; +import io.github.dsheirer.sdrplay.Bandwidth; import java.util.EnumSet; /** @@ -30,35 +29,35 @@ import java.util.EnumSet; */ public enum RspSampleRate { - RATE_0_250(8_000_000, 16_000, Bandwidth.BW_0_300, Decimate.X32, "0.250 MHz (0.234 usable)"), - RATE_0_500(8_000_000, 24_000, Bandwidth.BW_0_600, Decimate.X16, "0.500 MHz (0.476 usable)"), - RATE_1_000(8_000_000, 100_000, Bandwidth.BW_1_536, Decimate.X8, "1.000 MHz (0.900 usable)"), - RATE_1_500(6_000_000, 140_000, Bandwidth.BW_1_536, Decimate.X4, "1.500 MHz (1.360 usable)"), - RATE_2_048(8_192_000, 248_000, Bandwidth.BW_1_536, Decimate.X4, "2.048 MHz (1.800 usable)"), - RATE_3_000(6_000_000, 300_000, Bandwidth.BW_5_000, Decimate.X2, "3.000 MHz (2.700 usable)"), - RATE_4_000(8_000_000, 340_000, Bandwidth.BW_5_000, Decimate.X2, "4.000 MHz (3.560 usable)"), - RATE_5_000(5_000_000, 880_000, Bandwidth.BW_5_000, Decimate.X1, "5.000 MHz (4.120 usable)"), - RATE_6_000(6_000_000, 800_000, Bandwidth.BW_6_000, Decimate.X1, "6.000 MHz (5.200 usable)"), - RATE_7_000(7_000_000, 1_040_000, Bandwidth.BW_7_000, Decimate.X1, "7.000 MHz (5.960 usable)"), - RATE_8_000(8_000_000, 1_060_000, Bandwidth.BW_8_000, Decimate.X1, "8.000 MHz (6.940 usable)"), - RATE_9_000(9_000_000, 1_620_000, Bandwidth.BW_8_000, Decimate.X1, "9.000 MHz (7.380 usable)"), - RATE_10_000(10_000_000, 1_500_000, Bandwidth.BW_8_000, Decimate.X1, "10.000 MHz (8.500 usable)"), + RATE_0_250(8_000_000, 16_000, Bandwidth.KHZ_300, 32, "0.250 MHz (0.234 usable)"), + RATE_0_500(8_000_000, 24_000, Bandwidth.KHZ_600, 16, "0.500 MHz (0.476 usable)"), + RATE_1_000(8_000_000, 100_000, Bandwidth.KHZ_1536, 8, "1.000 MHz (0.900 usable)"), + RATE_1_500(6_000_000, 140_000, Bandwidth.KHZ_1536, 4, "1.500 MHz (1.360 usable)"), + RATE_2_048(8_192_000, 248_000, Bandwidth.KHZ_1536, 4, "2.048 MHz (1.800 usable)"), + RATE_3_000(6_000_000, 300_000, Bandwidth.MHZ_5, 2, "3.000 MHz (2.700 usable)"), + RATE_4_000(8_000_000, 340_000, Bandwidth.MHZ_5, 2, "4.000 MHz (3.560 usable)"), + RATE_5_000(5_000_000, 880_000, Bandwidth.MHZ_5, 1, "5.000 MHz (4.120 usable)"), + RATE_6_000(6_000_000, 800_000, Bandwidth.MHZ_6, 1, "6.000 MHz (5.200 usable)"), + RATE_7_000(7_000_000, 1_040_000, Bandwidth.MHZ_7, 1, "7.000 MHz (5.960 usable)"), + RATE_8_000(8_000_000, 1_060_000, Bandwidth.MHZ_8, 1, "8.000 MHz (6.940 usable)"), + RATE_9_000(9_000_000, 1_620_000, Bandwidth.MHZ_8, 1, "9.000 MHz (7.380 usable)"), + RATE_10_000(10_000_000, 1_500_000, Bandwidth.MHZ_8, 1, "10.000 MHz (8.500 usable)"), /** * Note: in dual tuner mode, available sample rates are 6 or 8 MHz with an effective output rate of * 2 MHz. Decimation is applied against the final 2 MHz rate, not the original 6/8 sampling rate. */ - DUO_RATE_0_500(8_000_000, 50_000, Bandwidth.BW_8_000, Decimate.X4, "0.500 MHz (0.450 usable)"), - DUO_RATE_1_000(8_000_000, 50_000, Bandwidth.BW_8_000, Decimate.X2, "1.000 MHz (0.950 usable)"), - DUO_RATE_1_500(6_000_000, 0, Bandwidth.BW_6_000, Decimate.X1, "1.500 MHz (1.500 usable)"), - DUO_RATE_2_000(8_000_000, 0, Bandwidth.BW_8_000, Decimate.X1, "2.000 MHz (2.000 usable)"), + DUO_RATE_0_500(8_000_000, 50_000, Bandwidth.MHZ_8, 4, "0.500 MHz (0.450 usable)"), + DUO_RATE_1_000(8_000_000, 50_000, Bandwidth.MHZ_8, 2, "1.000 MHz (0.950 usable)"), + DUO_RATE_1_500(6_000_000, 0, Bandwidth.MHZ_6, 1, "1.500 MHz (1.500 usable)"), + DUO_RATE_2_000(8_000_000, 0, Bandwidth.MHZ_8, 1, "2.000 MHz (2.000 usable)"), - UNDEFINED(0, 0, Bandwidth.UNDEFINED, Decimate.X1, "UNDEFINED"); + UNDEFINED(0, 0, Bandwidth.UNDEFINED, 1, "UNDEFINED"); private final long mSampleRate; private final long mUnusable; private final Bandwidth mBandwidth; - private final Decimate mDecimation; + private final int mDecimation; private final String mDescription; /** @@ -66,10 +65,11 @@ public enum RspSampleRate * @param sampleRate in hertz * @param unusable bandwidth (total) in Hertz due to IF or decimation filter roll-off at spectrum edges * @param bandwidth of the frequency spectrum - * @param decimation to be applied to the original sample rate to achieve the effective sample rate + * @param decimation factor (1, 2, 4, 8, 16 or 32) to be applied to the original sample rate to achieve the + * effective sample rate * @param description for UI display */ - RspSampleRate(long sampleRate, long unusable, Bandwidth bandwidth, Decimate decimation, String description) + RspSampleRate(long sampleRate, long unusable, Bandwidth bandwidth, int decimation, String description) { mSampleRate = sampleRate; mUnusable = unusable; @@ -84,9 +84,18 @@ public enum RspSampleRate public static final EnumSet SINGLE_TUNER_SAMPLE_RATES = EnumSet.range(RATE_0_250, RATE_10_000); /** - * RSPduo dual-tuner mode sample rates + * RSPduo dual-tuner mode sample rates. Note: DUO_RATE_1_500 is not supported. It requires a 6 MHz master sample + * rate, which is fixed when the master tuner is selected, and the SDRplay API rejects changing it before streaming + * starts or while the slave tuner is streaming. The entry is retained so that existing tuner configurations load, + * and the RSPduo tuner controllers replace it with the default dual tuner sample rate. */ - public static final EnumSet DUAL_TUNER_SAMPLE_RATES = EnumSet.range(DUO_RATE_0_500, DUO_RATE_2_000); + public static final EnumSet DUAL_TUNER_SAMPLE_RATES = EnumSet.of(DUO_RATE_0_500, DUO_RATE_1_000, + DUO_RATE_2_000); + + /** + * All RSPduo dual-tuner mode sample rate entries, including unsupported entries. + */ + private static final EnumSet DUAL_TUNER_ENTRIES = EnumSet.range(DUO_RATE_0_500, DUO_RATE_2_000); /** * Sample Rate @@ -116,7 +125,7 @@ public enum RspSampleRate */ public boolean isDualTunerSampleRate() { - return DUAL_TUNER_SAMPLE_RATES.contains(this); + return DUAL_TUNER_ENTRIES.contains(this); } /** @@ -125,14 +134,21 @@ public enum RspSampleRate */ public int getSampleSize() { - return mDecimation.getSampleSize(); + //Effective sample size by decimation factor (same values as the legacy SDRplay API wrapper) + return switch(mDecimation) + { + case 4, 8 -> 17; + case 16 -> 18; + case 32 -> 20; + default -> 16; + }; } /** - * Decimation rate to be applied against sample rate. - * @return decimation value + * Decimation factor to be applied against sample rate. + * @return decimation factor: 1 (none), 2, 4, 8, 16 or 32 */ - public Decimate getDecimation() + public int getDecimation() { return mDecimation; } @@ -148,11 +164,11 @@ public enum RspSampleRate { //Dual tuner sample rate is specified at 8 MHz, but there is an inherent x4 decimation to 2 MHz //on top of the user specified decimation rate. - return getSampleRate() / getDecimation().getValue() / 4; + return getSampleRate() / getDecimation() / 4; } else { - return getSampleRate() / getDecimation().getValue(); + return getSampleRate() / getDecimation(); } } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTuner.java index 8e339a44..445aee57 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTuner.java @@ -20,6 +20,7 @@ package io.github.dsheirer.source.tuner.sdrplay; import io.github.dsheirer.preference.source.ChannelizerType; +import io.github.dsheirer.sdrplay.DeviceInfo; import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.Tuner; import io.github.dsheirer.source.tuner.TunerClass; @@ -52,7 +53,7 @@ public class RspTuner extends Tuner @Override public String getUniqueID() { - return getRspTunerController().getControlRsp().getDevice().getSerialNumber(); + return getRspTunerController().getControlRsp().getDeviceInfo().serialNumber(); } @Override @@ -72,28 +73,20 @@ public class RspTuner extends Tuner @Override public String getPreferredName() { - if(getRspTunerController().getControlRsp() instanceof IControlRspDuoTuner1 && - getRspTunerController().getControlRsp().getDevice() != null) + IControlRsp controlRsp = getRspTunerController().getControlRsp(); + DeviceInfo deviceInfo = controlRsp.getDeviceInfo(); + String name = DiscoveredRspTuner.getModelName(deviceInfo.model()) + " SER:" + deviceInfo.serialNumber(); + + if(controlRsp instanceof IControlRspDuoTuner1) { - return getRspTunerController().getControlRsp().getDevice().getDeviceType() + - " SER:" + getRspTunerController().getControlRsp().getDevice().getSerialNumber() + " Tuner 1"; + return name + " Tuner 1"; } - else if(getRspTunerController().getControlRsp() instanceof IControlRspDuoTuner2 && - getRspTunerController().getControlRsp().getDevice() != null) + else if(controlRsp instanceof IControlRspDuoTuner2) { - return getRspTunerController().getControlRsp().getDevice().getDeviceType() + - " SER:" + getRspTunerController().getControlRsp().getDevice().getSerialNumber() + " Tuner 2"; - } - else if(getRspTunerController().getControlRsp() instanceof IControlRsp && - getRspTunerController().getControlRsp().getDevice() != null) - { - return getRspTunerController().getControlRsp().getDevice().getDeviceType() + - " SER:" + getRspTunerController().getControlRsp().getDevice().getSerialNumber(); - } - else - { - return "RSP Tuner - Device Not Available"; + return name + " Tuner 2"; } + + return name; } @Override diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerConfiguration.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerConfiguration.java index 28769c3e..07612a19 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerConfiguration.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerConfiguration.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.annotation.JsonSubTypes; import com.fasterxml.jackson.annotation.JsonTypeInfo; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; import io.github.dsheirer.source.tuner.sdrplay.rsp1.Rsp1TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.rsp1a.Rsp1aTunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.rsp1b.Rsp1bTunerConfiguration; @@ -53,7 +52,7 @@ public abstract class RspTunerConfiguration extends TunerConfiguration private RspSampleRate mRspSampleRate = DEFAULT_SINGLE_TUNER_SAMPLE_RATE; private int mLNA = 0; private int mBasebandGainReduction = 50; - private AgcMode mAgcMode = AgcMode.ENABLE; + private RspAgcMode mAgcMode = RspAgcMode.ENABLE; /** * JAXB Constructor @@ -132,7 +131,7 @@ public abstract class RspTunerConfiguration extends TunerConfiguration * @return mode */ @JacksonXmlProperty(isAttribute = true, localName = "agcMode") - public AgcMode getAgcMode() + public RspAgcMode getAgcMode() { return mAgcMode; } @@ -141,7 +140,7 @@ public abstract class RspTunerConfiguration extends TunerConfiguration * Sets the IF AGC mode * @param mode to set */ - public void setAgcMode(AgcMode mode) + public void setAgcMode(RspAgcMode mode) { mAgcMode = mode; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerController.java index 2599d25c..eff2478c 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerController.java @@ -25,15 +25,12 @@ import io.github.dsheirer.source.SourceException; import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerController; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IDeviceEventListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.StreamCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.EventType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.GainCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.PowerOverloadCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.RspDuoModeCallbackParameters; +import io.github.dsheirer.sdrplay.DeviceEvent; +import io.github.dsheirer.sdrplay.DeviceEventListener; +import io.github.dsheirer.sdrplay.SampleBuffer; +import io.github.dsheirer.sdrplay.SampleListener; +import io.github.dsheirer.sdrplay.Tuner; +import io.github.dsheirer.util.ThreadPool; import java.util.List; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -42,7 +39,7 @@ import org.slf4j.LoggerFactory; * Abstract/Base RSP tuner controller */ public abstract class RspTunerController extends TunerController - implements IDeviceEventListener, IStreamListener + implements DeviceEventListener, SampleListener { private static final Logger mLog = LoggerFactory.getLogger(RspTunerController.class); protected static final long MINIMUM_TUNABLE_FREQUENCY_HZ = 100_000; @@ -64,7 +61,7 @@ public abstract class RspTunerController extends TunerCon mControlRsp = controlRsp; //Register this controller to receive device events and sample streams when startStream() is invoked. - mControlRsp.resister(this, this); + mControlRsp.register(this, this); setMinimumFrequency(MINIMUM_TUNABLE_FREQUENCY_HZ); setMaximumFrequency(MAXIMUM_TUNABLE_FREQUENCY_HZ); @@ -84,7 +81,7 @@ public abstract class RspTunerController extends TunerCon { setSampleRate(rtc.getSampleRate()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP sample rate to " + rtc.getSampleRate(), se); } @@ -95,7 +92,7 @@ public abstract class RspTunerController extends TunerCon int gr = rtc.getBasebandGainReduction(); getControlRsp().setGain(lna, gr); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP LNA [" + rtc.getLNA() + "] and baseband [" + rtc.getBasebandGainReduction() + "]"); } @@ -110,41 +107,54 @@ public abstract class RspTunerController extends TunerCon return mControlRsp; } - @Override - public TunerSelect getTunerSelect() + /** + * SDRplay tuner (A or B) for this controller. + */ + public Tuner getSdrplayTuner() { - return mControlRsp.getTunerSelect(); + return mControlRsp.getSdrplayTuner(); } + /** + * Processes samples from the API. Invoked on the API's stream callback thread. + * @param sampleBuffer containing the samples, valid only until this method returns. + */ @Override - public void processStream(short[] inphase, short[] quadrature, - StreamCallbackParameters parameters, boolean reset) + public void onSamples(SampleBuffer sampleBuffer) { - //The native buffer factory repackages the samples into buffers with the largest power-of-2 length that is - //smaller than the incoming buffer length and no smaller than 128 to ensure that down-stream vector optimized + //The native buffer factory repackages the samples into buffers with the smallest power-of-2 length that is + //no smaller than the incoming buffer length (minimum 128) to ensure that down-stream vector optimized //functions can process the data. - List buffers = mNativeBufferFactory.get(inphase, quadrature, System.currentTimeMillis()); + List buffers = mNativeBufferFactory.get(sampleBuffer.copyI(), sampleBuffer.copyQ(), + System.currentTimeMillis()); for(RspNativeBuffer buffer: buffers) { mNativeBufferBroadcaster.broadcast(buffer); } + } - if(reset) + /** + * Processes device events from the API. Invoked on the API's event callback thread. The jsdrplay library + * acknowledges power overload events to the API before invoking this method. + * @param event from the API + */ + @Override + public void onEvent(DeviceEvent event) + { + switch(event) { -// mLog.info(getControlRsp().getDeviceDescriptor().getDeviceType() + " - sample stream was reset"); - } - if(parameters.isGainReductionChanged()) - { -// mLog.info("^^^ Got a gain reduction change"); - } - if(parameters.isRfFrequencyChanged()) - { -// mLog.info("^^^ Got a frequency changed"); - } - if(parameters.isSampleRateChanged()) - { -// mLog.info("^^^ Got a sample rate changed"); + case DeviceEvent.PowerOverload overload -> + { + if(overload.overloaded()) + { + getControlRsp().processPowerOverload(overload.tuner()); + } + } + //The device can't be closed from an API callback thread, so process the removal on another thread + case DeviceEvent.DeviceRemoved removed -> ThreadPool.CACHED.submit(() -> processDeviceRemoval(removed.tuner())); + case DeviceEvent.DeviceFailure failure -> ThreadPool.CACHED.submit(() -> processDeviceRemoval(failure.tuner())); + default -> {} //Ignore gain change and RSPduo mode change events } } @@ -159,9 +169,9 @@ public abstract class RspTunerController extends TunerCon { mControlRsp.start(); } - catch(SDRPlayException se) + catch(RspException se) { - throw new SourceException("Unable to select tuner - in use"); + throw new SourceException("Unable to select tuner - " + se.getMessage(), se); } } @@ -172,7 +182,7 @@ public abstract class RspTunerController extends TunerCon { mControlRsp.stop(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error releasing RSP tuner device", se); } @@ -238,7 +248,7 @@ public abstract class RspTunerController extends TunerCon { return getControlRsp().getTunedFrequency(); } - catch(SDRPlayException se) + catch(RspException se) { throw new SourceException("Error setting tuned frequency", se); } @@ -256,7 +266,7 @@ public abstract class RspTunerController extends TunerCon { getControlRsp().setTunedFrequency(frequency); } - catch(SDRPlayException se) + catch(RspException se) { throw new SourceException("Unable to set center frequency [" + frequency + "]", se); } @@ -265,9 +275,9 @@ public abstract class RspTunerController extends TunerCon /** * Sets the sample rate * @param rspSampleRate to apply - * @throws SDRPlayException if there is an error + * @throws RspException if there is an error */ - public void setSampleRate(RspSampleRate rspSampleRate) throws SDRPlayException + public void setSampleRate(RspSampleRate rspSampleRate) throws RspException { getControlRsp().setSampleRate(rspSampleRate); @@ -297,34 +307,14 @@ public abstract class RspTunerController extends TunerCon return 128; } - //Device Event Listener interface methods ... - @Override - public void processEvent(EventType eventType, TunerSelect tunerSelect) {} - @Override - public void processGainChange(TunerSelect tunerSelect, GainCallbackParameters parameters) {} - @Override - public void processRspDuoModeChange(TunerSelect tunerSelect, RspDuoModeCallbackParameters parameters) {} - @Override - public void processPowerOverload(TunerSelect tunerSelect, PowerOverloadCallbackParameters parameters) + /** + * Processes a device removal (or failure) event. + * @param tuner that was removed + */ + public void processDeviceRemoval(Tuner tuner) { - if(getControlRsp() != null) - { - try - { - getControlRsp().acknowledgePowerOverload(tunerSelect); - } - catch(SDRPlayException se) - { - mLog.error("Unable to acknowledge power overload for [" + tunerSelect + "]", se); - } - } - } - - @Override - public void processDeviceRemoval(TunerSelect tunerSelect) - { - mLog.info("Processing device removal for tuner [" + tunerSelect + "] controller class [" + getClass().getSimpleName() + "]"); - //Command the control RSP to nullify the device so that we cease all attempts to control the device via the API + mLog.info("Processing device removal for tuner [" + tuner + "] controller class [" + getClass().getSimpleName() + "]"); + //Command the control RSP to release the device so that we cease all attempts to control the device via the API if(getControlRsp() != null) { getControlRsp().deviceRemoved(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java index d70f1393..d88eb4a2 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/RspTunerEditor.java @@ -21,9 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay; import io.github.dsheirer.preference.UserPreferences; import io.github.dsheirer.source.tuner.manager.TunerManager; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; +import io.github.dsheirer.sdrplay.Tuner; import io.github.dsheirer.source.tuner.ui.TunerEditor; import io.github.dsheirer.util.ThreadPool; import java.awt.Color; @@ -133,10 +131,10 @@ public abstract class RspTunerEditor extends Tu { try { - getTunerController().getControlRsp().setAgcMode(mAgcButton.isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getTunerController().getControlRsp().setAgcMode(mAgcButton.isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); updateGainLabel(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting AGC mode on RSP device"); } @@ -175,9 +173,9 @@ public abstract class RspTunerEditor extends Tu } @Override - public void notifyGainOverload(TunerSelect tunerSelect) + public void notifyGainOverload(Tuner tuner) { - if(hasTuner() && getTuner().getRspTunerController().getTunerSelect() == tunerSelect) + if(hasTuner() && getTuner().getRspTunerController().getSdrplayTuner() == tuner) { //Set overload alert EventQueue.invokeLater(() -> setGainOverloadAlert(true)); @@ -291,7 +289,7 @@ public abstract class RspTunerEditor extends Tu float currentGain = getTunerController().getControlRsp().getCurrentGain(); getGainValueLabel().setText((int)currentGain + " dB"); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error accessing current gain value from RSP tuner", se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/README b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/README deleted file mode 100644 index 8e1ab81d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/README +++ /dev/null @@ -1,87 +0,0 @@ -SDRplay API - -All source class files are auto-created from sdrplay api header files using JDK 22 jextract tool: - -Version 3.07 is the oldest supported version. Versions 3.08 through 3.14 are all functionally equivalent and -versions 3.15+ are functionally equivalent. - -We use the jextract tool to generate java source files from the API include files that are located in -the /artifacts directory. - -With each new JDK release where they change something about the Foreign Function api, we have to regenerate -the java source files. My approach is to generate the java files into the source code directories alongside -the existing source files and then delete the existing files and rename the parent version package to the -same as was used by the existing classes so that we don't cause problems in any of the derivative classes. - -If you need to find the SDRPlay API header/include files: -1. Install the sdrplay api -2. On Linux, headers are located here: /usr/local/include/*.h -3. On Windows, headers are located here: c:\Program Files\SDRPlay\api - -Generate Source Files from SDRPlay API Headers -- Download latest jextract tool and alias the jextract command. -- cd into the (project)/jSDRplay/sdrplay-api/src/main/java/ directory - -Note: each version is auto-generated with a _1 suffix to avoid overwriting the existing implementation. Then, -you can just delete the original implementation and rename the suffixed versions to remove the _1. Then, -resolve any import or syntax errors to integrate the new auto-gen code into the existing codebase. - -Version 3.07 -- cd into the same folder where the v3.07 header files are located. -- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_07 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07_1/ sdrplay_api.h - -Version 3.08 -- cd into the same folder where the v3.08 header files are located. -- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h - -Version 3.15 - Adds support for RSP dx2 -- cd into the same folder where the v3.15 header files are located. -- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_15 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15_1/ sdrplay_api.h - -As a final step, delete the original api version branches and rename each of the new api version branches to remove the _1 suffix. - -Code Modifications: for each version, modify the sdrplay_api_h.java class to wrap the SYMBOL_LOOKUP variable using the -following changes, so that the code doesn't throw an error on systems that don't have the API installed: - - //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library - static SymbolLookup SYMBOL_LOOKUP; - static - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e) - { - if(SDRPlayLibraryHelper.LOADED_FROM_PATH) - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(SDRPlayLibraryHelper.LIBRARY_PATH, LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e2) - { - SYMBOL_LOOKUP = null; - } - } - else - { - SYMBOL_LOOKUP = null; - } - } - } - -... and add null checking to the findOrThrow() method ... - if(SYMBOL_LOOKUP == null) - { - throw new UnsatisfiedLinkError("unresolved symbol:" + symbol); - } - - -IntelliJ setup -1. Run configuration -2. JVM Option: --enable-native-access=ALL-UNNAMED diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayException.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayException.java deleted file mode 100644 index 1603a0b5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayException.java +++ /dev/null @@ -1,63 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -/** - * SDRplay checked exception. - */ -public class SDRPlayException extends Exception -{ - private Status mStatus = Status.UNKNOWN; - - /** - * Creates an exception - * @param message for the exception - */ - public SDRPlayException(String message) - { - super(message); - } - - /** - * Creates an operation exception - * @param message for the exception - * @param status of the operation - */ - public SDRPlayException(String message, Status status) - { - super(message + " Status:" + status); - mStatus = status; - } - - /** - * Creates an exception - * @param message for the exception - * @param throwable nested exception - */ - public SDRPlayException(String message, Throwable throwable) - { - super(message, throwable); - } - - public Status getStatus() - { - return mStatus; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayLibraryHelper.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayLibraryHelper.java deleted file mode 100644 index 3a5089b0..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayLibraryHelper.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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\\x64\\" + SDRPLAY_API_LIBRARY_NAME; - - public static final boolean LOADED; - public static final boolean LOADED_FROM_PATH; - public static final Path LIBRARY_PATH = Path.of(getSDRplayLibraryPath()); - - static - { - boolean loaded = false; - boolean loadedFromPath = false; - - try - { - System.loadLibrary(SDRPLAY_API_LIBRARY_NAME); - mLog.info("SDRPLay API library loaded by name [" + SDRPLAY_API_LIBRARY_NAME + "]"); - loaded = true; - } - catch(Throwable t) - { - String libraryPath = getSDRplayLibraryPath(); - Path path = Path.of(libraryPath); - boolean exists = Files.exists(path); - - if(exists) - { - try - { - System.load(libraryPath); - mLog.info("SDRPLay API library loaded by path [" + libraryPath + "]"); - loaded = true; - loadedFromPath = true; - } - catch(Throwable t2) - { - mLog.info("SDRPlay API native library not found at " + libraryPath); - } - } - else - { - mLog.info("SDRPlay API native library not found at: " + libraryPath); - } - } - - LOADED = loaded; - LOADED_FROM_PATH = loadedFromPath; - } - - /** - * 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 ""; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayUpdateException.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayUpdateException.java deleted file mode 100644 index 0aa61b50..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayUpdateException.java +++ /dev/null @@ -1,49 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -import java.util.ArrayList; -import java.util.List; - -/** - * SDRplay failed update request checked exception. - */ -public class SDRPlayUpdateException extends SDRPlayException -{ - private List mUpdateReasons = new ArrayList<>(); - - /** - * Creates an operation exception - * @param status of the operation - * @param updateReasons that were submitted - */ - public SDRPlayUpdateException(Status status, List updateReasons) - { - super("Unable to update device parameters: " + updateReasons, status); - } - - /** - * List of update reasons that failed. - */ - public List getUpdateReasons() - { - return mUpdateReasons; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRplay.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRplay.java deleted file mode 100644 index 064f3278..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRplay.java +++ /dev/null @@ -1,646 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -import io.github.dsheirer.source.tuner.sdrplay.api.callback.CallbackFunctions; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IDeviceEventListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamListener; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Device; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceFactory; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.device.IDeviceStruct; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.error.DebugLevel; -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_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; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.ValueLayout; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SDRplay API wrapper. - */ -public class SDRplay -{ - private static final Logger mLog = LoggerFactory.getLogger(SDRplay.class); - - /** - * Foreign memory arena allocation resource scope. We use a shared arena with a lifetime bounded by the - * lifetime of this API. - */ - private final Arena mSharedArena = Arena.ofShared(); - - /** - * Indicates if libsdrplay_api.xx library was found and loaded. - */ - private boolean mSdrplayLibraryLoaded; - - /** - * Indicates if the library is available, meaning that the host system library was loaded AND it supports the - * correct API version - */ - private boolean mAvailable; - - /** - * Map of (reusable) callback functions for each device. Key value is the device handle memory address - */ - private final Map mDeviceCallbackFunctionsMap = new HashMap<>(); - - /** - * Detected version of the API installed on the local system. - */ - private Version mVersion; - - /** - * Controls logging of library load status so that it only gets logged once. Set to false once initial logging complete - */ - private static boolean sLibraryLoadStatusLogging = true; - - /** - * Constructs an instance of the SDRPLay API - */ - public SDRplay() throws SDRPlayException - { - mSdrplayLibraryLoaded = SDRPlayLibraryHelper.LOADED; - - if(mSdrplayLibraryLoaded) - { - Status openStatus = open(); - - mAvailable = openStatus.success() && getVersion().isSupported(); - - if(openStatus == Status.FAIL) - { - throw new SDRPlayException("Service not available - open status: " + openStatus); - } - } - else - { - mAvailable = false; - } - - if(isAvailable()) - { - if(sLibraryLoadStatusLogging) - { - mLog.info("API library v" + getVersion() + " - loaded"); - } - } - else - { - if(sLibraryLoadStatusLogging) - { - if(!getVersion().isSupported()) - { - mLog.info("API library is not available - unsupported version: " + getVersion()); - } - else - { - mLog.info("API library is not available."); - } - } - } - - sLibraryLoadStatusLogging = false; - } - - /** - * Open Shared Memory Arena for this API instance - */ - private Arena getSharedArena() - { - return mSharedArena; - } - - /** - * List of devices available via the API - * @return list of device infos. - * @throws SDRPlayException if there is an error - */ - public List getDeviceInfos() throws SDRPlayException - { - return DeviceFactory.parseDeviceInfos(getDeviceStructures()); - } - - /** - * List of device structures for devices available from the API - * @return list of device structures - * @throws SDRPlayException if there is an error - */ - public List getDeviceStructures() throws SDRPlayException - { - List deviceStructs = new ArrayList<>(); - - //Get a version-correct array of DeviceT structures - MemorySegment devicesArray = DeviceFactory.createDeviceArray(getVersion(), getSharedArena()); - - 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())); - - if(status.success()) - { - int count = deviceCount.get(ValueLayout.JAVA_INT, 0); - deviceStructs.addAll(DeviceFactory.parseDeviceStructs(getVersion(), devicesArray, count)); - } - else - { - mLog.error("Couldn't load RSP devices from API. Status: " + status); - } - - return deviceStructs; - } - - /** - * Find an RSP device descriptor by serial number. - * @param serialNumber to search for - * @return matching device descriptor, or null. - * @throws SDRPlayException if there is an error parsing the device structures - */ - public DeviceInfo getDevice(String serialNumber) throws SDRPlayException - { - for(DeviceInfo deviceInfo: getDeviceInfos()) - { - if(deviceInfo.getSerialNumber().equals(serialNumber)) - { - return deviceInfo; - } - } - - return null; - } - - /** - * Obtains the device that matches the device info argument. - * @param deviceInfo to match - * @return non-null device - * @throws SDRPlayException - */ - public Device getDevice(DeviceInfo deviceInfo) throws SDRPlayException - { - Device device = null; - - if(isAvailable()) - { - List deviceStructs = getDeviceStructures(); - - for(IDeviceStruct deviceStruct: deviceStructs) - { - if(deviceInfo.matches(deviceStruct)) - { - device = DeviceFactory.createDevice(this, deviceStruct); - break; - } - } - } - - if(device == null) - { - throw new SDRPlayException("Unable to find RSP device"); - } - - return device; - } - - - /** - * Finds the first device that matches the specified device type. - * - * @param deviceType to find - * @return the specified device type or null. - */ - public DeviceInfo getDeviceInfo(DeviceType deviceType) throws SDRPlayException - { - for(DeviceInfo deviceInfo : getDeviceInfos()) - { - if(deviceInfo.getDeviceType() == deviceType) - { - return deviceInfo; - } - } - - return null; - } - - /** - * Selects the device for exclusive use. This method is invoked by the device instance. - * - * @param memorySegment of the device in foreign memory - * @throws SDRPlayException if the device argument was not created by this API instance or if unable to lock or - * unlock the device API for exclusive use, or if unable to select the device. - */ - public void select(MemorySegment memorySegment) throws SDRPlayException - { - lockDeviceApi(); - Status selectStatus = Status.fromValue(sdrplay_api_h.sdrplay_api_SelectDevice(memorySegment)); - unlockDeviceApi(); - - if(selectStatus.fail()) - { - throw new SDRPlayException("Unable to select the device", selectStatus); - } - } - - /** - * Releases the device from exclusive use. This method is invoked by the device instance. - * - * @param memorySegment of the device in foreign memory - * @throws SDRPlayException if the device argument was not created by this API instance or if unable to release - * the device - */ - public void release(MemorySegment memorySegment) throws SDRPlayException - { - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_ReleaseDevice(memorySegment)); - - if(status.fail()) - { - mLog.info("API call to release device failed, however device is effectively released now."); - } - } - - /** - * Retrieves the initial composite parameters for each device. This should only be invoked once, on - * startup, for each device. Changes made to the device parameters should invoke update() method to apply changes. - * - * @param deviceType to load parameters - * @param deviceHandle to device - * @return constructed device composite parameters - */ - public CompositeParameters getCompositeParameters(DeviceType deviceType, MemorySegment deviceHandle) throws SDRPlayException - { - //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()) - { - 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 - { - throw new SDRPlayException("Error retrieving device composite parameters", status); - } - } - - /** - * Initializes a device for use. - * - * @param deviceHandle to the device - * @param callbackFunctions to receive stream data from A and (optionally) B channels and events. - * @throws SDRPlayException if the device is not selected of if unable to init the device - */ - 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 = Arena.ofAuto().allocate(ValueLayout.ADDRESS); - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_Init(deviceHandle, callbackFunctions, contextPointer)); - - if(!status.success()) - { - throw new SDRPlayException("Error while initializing device", status); - } - } - - /** - * Initializes a device for single-tuner use or for dual-tuner use as stream A - * - * @param device to initialize - * @param deviceHandle to the device - * @param eventListener to receive events for this device - * @param streamListener to receive samples for stream A - * @throws SDRPlayException if the device is not selected of if unable to init the device - */ - public void initA(Device device, MemorySegment deviceHandle, IDeviceEventListener eventListener, - IStreamListener streamListener) throws SDRPlayException - { - CallbackFunctions callbackFunctions = mDeviceCallbackFunctionsMap.get(deviceHandle); - - if(callbackFunctions == null) - { - callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener, - device.getStreamCallbackListener()); - mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions); - } - else - { - callbackFunctions.setDeviceEventListener(eventListener); - callbackFunctions.setStreamAListener(streamListener); - } - - init(deviceHandle, callbackFunctions.getCallbackFunctionsMemorySegment()); - } - - /** - * Initializes a device for dual-tuner use as stream B - * - * @param device to initialize - * @param deviceHandle to the device - * @param eventListener to receive events for this device - * @param streamListener to receive samples for stream B - * @throws SDRPlayException if the device is not selected of if unable to init the device - */ - public void initB(Device device, MemorySegment deviceHandle, IDeviceEventListener eventListener, - IStreamListener streamListener) throws SDRPlayException - { - CallbackFunctions callbackFunctions = mDeviceCallbackFunctionsMap.get(deviceHandle); - - if(callbackFunctions == null) - { - callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener, streamListener, - device.getStreamCallbackListener()); - mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions); - } - else - { - callbackFunctions.setDeviceEventListener(eventListener); - callbackFunctions.setStreamAListener(streamListener); - } - - init(deviceHandle, callbackFunctions.getCallbackFunctionsMemorySegment()); - } - - /** - * Un-Initializes a device from use. - * - * @param deviceHandle to the device - * @throws SDRPlayException if error during uninit or if device is not selected - */ - public void uninit(MemorySegment deviceHandle) throws SDRPlayException - { - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_Uninit(deviceHandle)); - - if(status.fail() && status != Status.NOT_INITIALIZED) - { - throw new SDRPlayException("Error while un-initializing device", status); - } - } - - /** - * Applies updates made to the device parameters. The device parameter that was updated is specified in the - * update reason. - *

- * Note: this method is synchronized to prevent multiple threads from attempting to send update requests - * concurrently, which will cause a failed request. - * - * @param device to update - * @param deviceHandle for the device - * @param tunerSelect identifies which tuner to apply the updates - * @param updateReasons identifying what was updated - * @throws SDRPlayException if the device is not selected, or if unable to update the device parameters - */ - public synchronized void update(Device device, MemorySegment deviceHandle, TunerSelect tunerSelect, - UpdateReason... updateReasons) throws SDRPlayException - { - int reasons = UpdateReason.getReasons(updateReasons); - int extendedReasons = UpdateReason.getExtendedReasons(updateReasons); - - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_Update(deviceHandle, tunerSelect.getValue(), - reasons, extendedReasons)); - - if(status.fail()) - { - throw new SDRPlayUpdateException(status, Arrays.stream(updateReasons).toList()); - } - } - - /** - * Retrieve error information for the last error for the specified device. - * - * @param deviceSegment for the device - * @return error information - */ - private ErrorInformation getLastError(MemorySegment deviceSegment) - { - MemorySegment errorAddress = sdrplay_api_h.sdrplay_api_GetLastError(deviceSegment); - MemorySegment errorSegment = errorAddress.reinterpret(sdrplay_api_ErrorInfoT.layout().byteSize(), getSharedArena(), null); - return new ErrorInformation(errorSegment); - } - - /** - * Sets the debug level logging for the specified device - * - * @param deviceHandle for the device - * @param debugLevel to set - * @throws SDRPlayException if the device is not selected or if unable to set/change the debug level. - */ - public void setDebugLevel(MemorySegment deviceHandle, DebugLevel debugLevel) throws SDRPlayException - { - Status status = Status.UNKNOWN; - - if(getVersion() == Version.V3_07) - { - //V3.07 used a debug level argument - status = Status.fromValue(sdrplay_api_h.sdrplay_api_DebugEnable(deviceHandle, debugLevel.getValue())); - } - else if(getVersion().gte(Version.V3_08)) - { - //V3.08+ uses a 0:1 flag to enable debug logging. The method signature didn't change -- still takes an integer - boolean enable = debugLevel != DebugLevel.DISABLE; - status = Status.fromValue(sdrplay_api_h.sdrplay_api_DebugEnable(deviceHandle, Flag.of(enable))); - } - - if(status.fail()) - { - throw new SDRPlayException("Unable to set debug level", status); - } - } - - /** - * Indicates if the SDRplay API is available and that the API library has been located and loaded for use and - * it the API version is supported by this jsdrplay library. - */ - public boolean isAvailable() - { - return mAvailable; - } - - /** - * Opens the API service. MUST be invoked before accessing any of the API functions/methods. - */ - private Status open() - { - return Status.fromValue(sdrplay_api_h.sdrplay_api_Open()); - } - - /** - * 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 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 - */ - public Status close() - { - if(mSdrplayLibraryLoaded) - { - Status closeStatus; - - try - { - closeStatus = Status.fromValue(sdrplay_api_h.sdrplay_api_Close()); - } - catch(Exception e) - { - closeStatus = Status.FAIL; - mLog.error("Error closing SDRPlay API"); - } - - getSharedArena().close(); - mSdrplayLibraryLoaded = false; - mAvailable = false; - return closeStatus; - } - else - { - getSharedArena().close(); - return Status.API_UNAVAILABLE; - } - } - - /** - * Identifies the API version. - * Note: if the library is not found or loaded, or if the API version is not a supported version, this method - * returns UNKNOWN - * - * @return version. - */ - public Version getVersion() - { - if(mVersion == null) - { - if(mSdrplayLibraryLoaded) - { - MemorySegment apiVersion = getSharedArena().allocate(ValueLayout.JAVA_FLOAT); - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_ApiVersion(apiVersion)); - if(status.success()) - { - float version = apiVersion.get(ValueLayout.JAVA_FLOAT, 0); - mVersion = Version.fromValue(version); - } - } - - if(mVersion == null) - { - mVersion = Version.UNKNOWN; - } - } - - return mVersion; - } - - /** - * Attempts to lock the API for exclusive use of the current application. Once locked, no other applications - * will be able to use the API. Typically used to lock the API prior to calling sdrplay_api_GetDevices() to - * ensure only one application can select a given device. After completing device selection using - * sdrplay_api_SelectDevice(), sdrplay_api_UnlockDeviceApi() can be used to release the API. May also - * be used prior to calling sdrplay_api_ReleaseDevice() if it is necessary to reselect the same device. - */ - private void lockDeviceApi() throws SDRPlayException - { - if(isAvailable()) - { - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_LockDeviceApi()); - if(status.fail()) - { - throw new SDRPlayException("Unable to lock Device API for exclusive use", status); - } - } - else - { - throw new SDRPlayException("API is unavailable", Status.API_UNAVAILABLE); - } - } - - /** - * Unlocks the device from exclusive access. - * - * @throws SDRPlayException if unable to unlock the Device API - */ - private void unlockDeviceApi() throws SDRPlayException - { - if(isAvailable()) - { - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_UnlockDeviceApi()); - - if(status.fail()) - { - throw new SDRPlayException("Unable to unlock Device API", status); - } - } - else - { - throw new SDRPlayException("API is unavailable", Status.API_UNAVAILABLE); - } - } - - public static void main(String[] args) - { - /** - * Note: on windows, add the following environment variable to the IntelliJ launcher: - * -Djava.library.path="C:\Program Files\SDRplay\API\x64" - * - * Alternately, we can add this location to the Windows PATH environment variable and - * Java will look there for the library, without having to specify it as a launcher - * option. This would allow for users that have installed the API to an alternate location. - */ - - try - { - SDRplay sdrplay = new SDRplay(); - Status status = sdrplay.open(); - mLog.info("Open Status: " + status); - - for(DeviceInfo deviceInfo: sdrplay.getDeviceInfos()) - { - mLog.info("Found: " + deviceInfo); - } - Status closeStatus = sdrplay.close(); - mLog.info("Close Status: " + closeStatus); - } - catch(SDRPlayException se) - { - mLog.info("Error", se); - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Status.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Status.java deleted file mode 100644 index 6242795f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Status.java +++ /dev/null @@ -1,109 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -public enum Status -{ - SUCCESS(sdrplay_api_h.sdrplay_api_Success(), "Success"), - FAIL(sdrplay_api_h.sdrplay_api_Fail(), "Fail"), - INVALID_PARAMETER(sdrplay_api_h.sdrplay_api_InvalidParam(), "Invalid Parameter. Null pointer or invalid operating mode"), - OUT_OF_RANGE(sdrplay_api_h.sdrplay_api_OutOfRange(), "Out of Range. One or more parameters are set incorrectly"), - GAIN_UPDATE_ERROR(sdrplay_api_h.sdrplay_api_GainUpdateError(), "Gain Update Error"), - RF_UPDATE_ERROR(sdrplay_api_h.sdrplay_api_RfUpdateError(), "Frequency Update Error"), - FS_UPDATE_ERROR(sdrplay_api_h.sdrplay_api_FsUpdateError(), "Sample Rate Update Error"), - HARDWARE_ERROR(sdrplay_api_h.sdrplay_api_HwError(), "Hardware Error during tuner initialization"), - ALIASING_ERROR(sdrplay_api_h.sdrplay_api_AliasingError(), "Aliasing Error"), - ALREADY_INITIALIZED(sdrplay_api_h.sdrplay_api_AlreadyInitialised(), "Already Initialized"), - NOT_INITIALIZED(sdrplay_api_h.sdrplay_api_NotInitialised(), "Not Initialized"), - NOT_ENABLED(sdrplay_api_h.sdrplay_api_NotEnabled(), "Not Enabled"), - HARDWARE_VERSION_ERROR(sdrplay_api_h.sdrplay_api_HwVerError(), "Hardware Version Error"), - OUT_OF_MEMORY(sdrplay_api_h.sdrplay_api_OutOfMemError(), "Out Of Memory"), - SERVICE_NOT_RESPONDING(sdrplay_api_h.sdrplay_api_ServiceNotResponding(), "Service Not Responding"), - START_PENDING(sdrplay_api_h.sdrplay_api_StartPending(), "Start Pending"), - STOP_PENDING(sdrplay_api_h.sdrplay_api_StopPending(), "Stop Pending"), - INVALID_MODE(sdrplay_api_h.sdrplay_api_InvalidMode(), "Invalid Mode"), - FAILED_VERIFICATION_1(sdrplay_api_h.sdrplay_api_FailedVerification1(), "Failed Verification 1"), - FAILED_VERIFICATION_2(sdrplay_api_h.sdrplay_api_FailedVerification2(), "Failed Verification 2"), - FAILED_VERIFICATION_3(sdrplay_api_h.sdrplay_api_FailedVerification3(), "Failed Verification 3"), - FAILED_VERIFICATION_4(sdrplay_api_h.sdrplay_api_FailedVerification4(), "Failed Verification 4"), - FAILED_VERIFICATION_5(sdrplay_api_h.sdrplay_api_FailedVerification5(), "Failed Verification 5"), - FAILED_VERIFICATION_6(sdrplay_api_h.sdrplay_api_FailedVerification6(), "Failed Verification 6"), - INVALID_SERVICE_VERSION(sdrplay_api_h.sdrplay_api_InvalidServiceVersion(), "Invalid Service Version"), - - //Custom status codes - API_UNAVAILABLE(-2, "SDRplay API is not installed or it has an unsupported version"), - UNKNOWN(-1, "Unknown"); - - private int mValue; - private String mDescription; - - Status(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Status code value - */ - public int getValue() - { - return mValue; - } - - /** - * Indicates if this is a SUCCESS status. - */ - public boolean success() - { - return this == Status.SUCCESS; - } - - public boolean fail() - { - return this != Status.SUCCESS; - } - - /** - * Lookup the status from a return code - * @param value to lookup - * @return status or UKNOWN if the code is not recognized - */ - public static Status fromValue(int value) - { - for(Status status: Status.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/UpdateReason.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/UpdateReason.java deleted file mode 100644 index 133ca23e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/UpdateReason.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; -import java.util.EnumSet; - -/** - * Update reason. - * - * These entries are used to notify the SDRplay API once settings are updated on the device. - */ -public enum UpdateReason -{ - //Master Only mode - DEVICE_SAMPLE_RATE(sdrplay_api_h.sdrplay_api_Update_Dev_Fs(), "Sample Rate"), - DEVICE_PPM(sdrplay_api_h.sdrplay_api_Update_Dev_Ppm(), "PPM"), - DEVICE_SYNC_UPDATE(sdrplay_api_h.sdrplay_api_Update_Dev_SyncUpdate(), "Sync Update"), - DEVICE_RESET_FLAGS(sdrplay_api_h.sdrplay_api_Update_Dev_ResetFlags(), "Reset Flags"), - - RSP1A_BIAS_T_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp1a_BiasTControl(), "RSP1A Bias-T Control"), - RSP1A_RF_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp1a_RfNotchControl(), "RSP1A RF Notch Control"), - RSP1A_RF_DAB_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp1a_RfDabNotchControl(), "RSP1A RF DAB Notch Control"), - - RSP2_BIAS_T_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp2_BiasTControl(), "RSP2 Bias-T Control"), - RSP2_AM_PORT_SELECT(sdrplay_api_h.sdrplay_api_Update_Rsp2_AmPortSelect(), "RSP2 AM Port Select"), - RSP2_ANTENNA_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp2_AntennaControl(), "RSP2 Antenna Control"), - RSP2_RF_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp2_RfNotchControl(), "RSP2 RF Notch Control"), - RSP2_EXT_REF_CONTROL(sdrplay_api_h.sdrplay_api_Update_Rsp2_ExtRefControl(), "RSP2 External Reference Control"), - - RSP_DUO_EXT_REF_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDuo_ExtRefControl(), "RSPduo External Reference Control"), - - SPARE_1(sdrplay_api_h.sdrplay_api_Update_Master_Spare_1(), "Spare 1"), - SPARE_2(sdrplay_api_h.sdrplay_api_Update_Master_Spare_2(), "Spare 2"), - - //Master and Slave mode - TUNER_GAIN_REDUCTION(sdrplay_api_h.sdrplay_api_Update_Tuner_Gr(), "Tuner Gain Reduction"), - TUNER_GAIN_REDUCTION_LIMITS(sdrplay_api_h.sdrplay_api_Update_Tuner_GrLimits(), "Tuner Gain Reduction Limits"), - TUNER_FREQUENCY_RF(sdrplay_api_h.sdrplay_api_Update_Tuner_Frf(), "Tuner Frequency RF"), - TUNER_BANDWIDTH_TYPE(sdrplay_api_h.sdrplay_api_Update_Tuner_BwType(), "Tuner Bandwidth Type"), - TUNER_IF_TYPE(sdrplay_api_h.sdrplay_api_Update_Tuner_IfType(), "Tuner IF Type"), - TUNER_DC_OFFSET(sdrplay_api_h.sdrplay_api_Update_Tuner_DcOffset(), "Tuner DC Offset"), - TUNER_LO_MODE(sdrplay_api_h.sdrplay_api_Update_Tuner_LoMode(), "Tuner LO Mode"), - - CONTROL_DC_OFFSET_IQ_IMBALANCE(sdrplay_api_h.sdrplay_api_Update_Ctrl_DCoffsetIQimbalance(), "Control DC Offset IQ Imbalance"), - CONTROL_DECIMATION(sdrplay_api_h.sdrplay_api_Update_Ctrl_Decimation(), "Control Decimation"), - CONTROL_AGC(sdrplay_api_h.sdrplay_api_Update_Ctrl_Agc(), "Control AGC"), - CONTROL_ADSB_MODE(sdrplay_api_h.sdrplay_api_Update_Ctrl_AdsbMode(), "Control ADSB Mode"), - CONTROL_OVERLOAD_MESSAGE_ACK(sdrplay_api_h.sdrplay_api_Update_Ctrl_OverloadMsgAck(), "Control Overload Message Ack"), - - RSP_DUO_BIAS_T_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDuo_BiasTControl(), "RSPduo Bias-T Control"), - RSP_DUO_AM_PORT_SELECT(sdrplay_api_h.sdrplay_api_Update_RspDuo_AmPortSelect(), "RSPduo AM Port Select"), - RSP_DUO_TUNER_1_AM_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDuo_Tuner1AmNotchControl(), "RSPduo Tuner 1 AM Notch Control"), - RSP_DUO_RF_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDuo_RfNotchControl(), "RSPduo RF Notch Control"), - RSP_DUO_RF_DAB_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDuo_RfDabNotchControl(), "RSPduo RF DAB Notch Control"), - - //Extension 1 - EXTENSION_RSP_DX_HDR_ENABLE(sdrplay_api_h.sdrplay_api_Update_RspDx_HdrEnable(), "RSPdx HDR Enable"), - EXTENSION_RSP_DX_BIAS_T_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_BiasTControl(), "RSPdx Bias-T Control"), - EXTENSION_RSP_DX_ANTENNA_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_AntennaControl(), "RSPdx Antenna Control"), - 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_15.sdrplay_api_h.sdrplay_api_Update_RspDuo_ResetSlaveFlags(), "RSPDuo Reset Slave Flags"), - EXTENSION_NONE(sdrplay_api_h.sdrplay_api_Update_Ext1_None(), "NONE"), - - - NONE(sdrplay_api_h.sdrplay_api_Update_None(), "NONE"); - - private int mValue; - private String mDescription; - - UpdateReason(int value, String description) - { - mValue = value; - mDescription = description; - } - - public static EnumSet EXTENSIONS = EnumSet.range(EXTENSION_RSP_DX_HDR_ENABLE, EXTENSION_NONE); - - - /** - * Many of the update reasons described in this enumeration are submitted asynchronously, since the API is - * non-blocking. However, the device event listener responses are limited to just three events: Frequency, Gain, - * and Sample Rate. This constant describes the three update reasons that correspond to the device events. - */ - public static EnumSet ASYNC_UPDATE_RESPONSES = EnumSet.of(DEVICE_SAMPLE_RATE, TUNER_FREQUENCY_RF, TUNER_GAIN_REDUCTION); - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Indicates if this is an extended update reason entry. - */ - public boolean isExtended() - { - return EXTENSIONS.contains(this); - } - - /** - * Indicates if this update reason is one of the limited set of asynchronous update operation response types. - */ - public boolean isAsyncUpdateResponse() - { - return ASYNC_UPDATE_RESPONSES.contains(this); - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static UpdateReason fromValue(int value) - { - for(UpdateReason status: UpdateReason.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return NONE; - } - - /** - * Calculates a combined logical OR value of the non-extended update reasons. Extended reason values will - * be ignored for this calculation. - * - * @param reasons to combine - * @return combined (logical OR) value. - */ - public static int getReasons(UpdateReason ... reasons) - { - int combined = UpdateReason.NONE.getValue(); - - for(UpdateReason reason: reasons) - { - if(!reason.isExtended()) - { - combined += reason.getValue(); - } - } - - return combined; - } - - /** - * Calculates a combined logical OR value of the extended update reasons. Non-extended reason values will - * be ignored for this calculation. - * - * @param reasons to combine - * @return combined (logical OR) value. - */ - public static int getExtendedReasons(UpdateReason ... reasons) - { - int combined = UpdateReason.EXTENSION_NONE.getValue(); - - for(UpdateReason reason: reasons) - { - if(reason.isExtended()) - { - combined += reason.getValue(); - } - } - - return combined; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Version.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Version.java deleted file mode 100644 index 05d4d6a5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/Version.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * SDRPlay API Versions - */ -public enum Version -{ - UNKNOWN(0.0f, false), - V3_07(3.07f, true), - V3_08(3.08f, true), - V3_09(3.09f, true), - V3_10(3.10f, true), - V3_11(3.11f, true), - V3_12(3.12f, true), - V3_13(3.13f, true), //No changes - OSX build only. - V3_14(3.14f, true), - V3_15(3.15f, true), - V3_16(3.16f, true); - - private float mValue; - private boolean mSupported; - private static final Logger mLog = LoggerFactory.getLogger(Version.class); - - Version(float value, boolean supported) - { - mValue = value; - mSupported = supported; - } - - /** - * Indicates if the API version is supported by the jsdrplay library - */ - public boolean isSupported() - { - return mSupported; - } - - /** - * Indicates if this version is greater than or equal to the specified version. - * - * @param version to compare - * @return true if this version is greater than or equal to - */ - public boolean gte(Version version) - { - return this.ordinal() >= version.ordinal(); - } - - /** - * Numeric API version/value - */ - public float getVersion() - { - return mValue; - } - - /** - * Lookup the version from the specified value. - * - * @param value to lookup - * @return version or UNKNOWN - */ - public static Version fromValue(float value) - { - - for(Version version : values()) - { - if(version.mValue == value) - { - return version; - } - } - - mLog.warn("Unrecognized SDRplay API version [" + value + "]"); - return UNKNOWN; - } - - - @Override - public String toString() - { - return String.valueOf(mValue); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncFuture.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncFuture.java deleted file mode 100644 index c2820326..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncFuture.java +++ /dev/null @@ -1,227 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.async; - -import java.util.concurrent.ExecutionException; -import java.util.concurrent.Future; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.TimeoutException; -import java.util.concurrent.locks.ReentrantLock; - -/** - * Asynchronous operation that implements the Future interface with utility methods for callback on completion, or - * converting to a synchronous (ie blocking) operation. - * @param expected return type upon completion of the operation - */ -public class AsyncFuture implements Future -{ - private R mResult; - private Throwable mError; - private boolean mCancelled; - private boolean mCompleted = false; - private ReentrantLock mLock = new ReentrantLock(); - private IAsyncCallback mCallback; - - /** - * Sets the result and completes this future. - * @param result to apply. - */ - public synchronized void setResult(R result) - { - if(mCompleted) - { - throw new IllegalStateException("Future is already completed."); - } - - mResult = result; - finish(); - } - - /** - * Sets an error resulting from the operation and completes this future. - * @param error produced from the operation - */ - public synchronized void setError(Throwable error) - { - if(mCompleted) - { - throw new IllegalStateException("Future is already completed."); - } - - mError = error; - finish(); - } - - /** - * (Optional) error produced from the operation. - */ - public Throwable getError() - { - return mError; - } - - /** - * Indicates if this future had an error during the operation - */ - public boolean hasError() - { - return mError != null; - } - - /** - * Cleanup task that completes the future and notifies an optional registered callback. - */ - private void finish() - { - mLock.lock(); - - try - { - mCompleted = true; - - if(mCallback != null) - { - mCallback.complete(this); - mCallback = null; - } - } - finally - { - mLock.unlock(); - } - - notifyAll(); - } - - /** - * Signals a desire to cancel this future operation. - * - * Note: it is up to the implementer to monitor this cancel state. - * @param mayInterruptIfRunning not implemented. - * @return true always. - */ - @Override - public boolean cancel(boolean mayInterruptIfRunning) - { - mCancelled = true; - return true; - } - - /** - * Indicates if this future has been cancelled. - */ - @Override - public boolean isCancelled() - { - return mCancelled; - } - - /** - * Indicates if this future has completed. - */ - @Override - public boolean isDone() - { - return mCompleted; - } - - /** - * Blocking call to wait indefinitely for the result of the operation. - * @return result of the operation - * @throws InterruptedException if the calling thread is interrupted while waiting - * @throws ExecutionException if there is an error produced from the operation - */ - @Override - public synchronized R get() throws InterruptedException, ExecutionException - { - while(!mCompleted) - { - wait(); - } - - if(mError != null) - { - throw new ExecutionException(mError); - } - - return mResult; - } - - /** - * Blocking call to synchronously get the result of the operation. - * @param timeout to wait - * @param unit for the timeout - * @return result once completed - * @throws InterruptedException if the calling thread is interrupted while waiting - * @throws ExecutionException if there is an error produced from the operation - * @throws TimeoutException if the timeout is exceeded while waiting. - */ - @Override - public synchronized R get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException - { - if(!mCompleted) - { - wait(unit.toMillis(timeout)); - } - - if(!mCompleted) - { - throw new TimeoutException("Get timeout [" + timeout + " " + unit + "] exceeded without completion"); - } - - if(mError != null) - { - throw new ExecutionException(mError); - } - - return mResult; - } - - /** - * Registers the callback to receive the result once the operation completes. If the operation is completed, the - * callback is immediately notified, otherwise the callback will be notified later. - * @param callback to be notified once the operation is completed. - */ - public synchronized void callback(IAsyncCallback callback) - { - if(mCallback != null) - { - throw new IllegalArgumentException("Callback has been registered - only one callback is supported."); - } - - mLock.lock(); - - try - { - if(mCompleted) - { - callback.complete(this); - } - else - { - mCallback = callback; - } - } - finally - { - mLock.unlock(); - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncUpdateFuture.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncUpdateFuture.java deleted file mode 100644 index 998870e1..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/AsyncUpdateFuture.java +++ /dev/null @@ -1,100 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.async; - -import io.github.dsheirer.source.tuner.sdrplay.api.Status; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; - -/** - * Asynchronous future for an SDRplay API update operation. - */ -public class AsyncUpdateFuture extends AsyncFuture -{ - private TunerSelect mTunerSelect; - private UpdateReason mUpdateReason; - private UpdateReason mExpectedResponse; - private boolean mSubmitted; - - /** - * Creates a to-be completed future where a successful update with return success or an unsuccessful update will - * return an exception. - * @param tunerSelect for the tuner to be updated - * @param updateReason of what is to be updated - * @param expectedResponse to be received to indicate the async operation is completed - */ - public AsyncUpdateFuture(TunerSelect tunerSelect, UpdateReason updateReason, UpdateReason expectedResponse) - { - mTunerSelect = tunerSelect; - mUpdateReason = updateReason; - mExpectedResponse = expectedResponse; - } - - /** - * Tuner(s) for the update - */ - public TunerSelect getTunerSelect() - { - return mTunerSelect; - } - - /** - * UpdateReason that is being updated - */ - public UpdateReason getUpdateReason() - { - return mUpdateReason; - } - - /** - * Expected response to this update operation - */ - public UpdateReason getExpectedResponse() - { - return mExpectedResponse; - } - - /** - * Flag to indicate if this update has been submitted and is currently awaiting results. - */ - public boolean isSubmitted() - { - return mSubmitted; - } - - /** - * Sets flag to indicate that this update has been submitted. - */ - public void setSubmitted(boolean submitted) - { - mSubmitted = submitted; - } - - /** - * Indicates if the completed async operation matches this submitted async update future - * @param completedAsyncUpdate to compare - * @return true if there is a match - */ - public boolean matches(CompletedAsyncUpdate completedAsyncUpdate) - { - return getTunerSelect().equals(completedAsyncUpdate.getTunerSelect()) && - getExpectedResponse().equals(completedAsyncUpdate.getUpdateReason()); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/CompletedAsyncUpdate.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/CompletedAsyncUpdate.java deleted file mode 100644 index 57b35a07..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/CompletedAsyncUpdate.java +++ /dev/null @@ -1,57 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.async; - -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; - -/** - * Completed asynchronous update operation - */ -public class CompletedAsyncUpdate -{ - private TunerSelect mTunerSelect; - private UpdateReason mUpdateReason; - - /** - * Creates a completed update. - */ - public CompletedAsyncUpdate(TunerSelect tunerSelect, UpdateReason updateReason) - { - mTunerSelect = tunerSelect; - mUpdateReason = updateReason; - } - - /** - * Tuner(s) for the update - */ - public TunerSelect getTunerSelect() - { - return mTunerSelect; - } - - /** - * UpdateReason that is being updated - */ - public UpdateReason getUpdateReason() - { - return mUpdateReason; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/IAsyncCallback.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/IAsyncCallback.java deleted file mode 100644 index 88050765..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/async/IAsyncCallback.java +++ /dev/null @@ -1,32 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.async; - -/** - * Callback interface to be notified when an async future has completed or has resulted in an error - */ -public interface IAsyncCallback -{ - /** - * Callback method once the future is completed or produces an error. - * @param future that is being monitored - */ - void complete(AsyncFuture future); -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/CallbackFunctions.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/CallbackFunctions.java deleted file mode 100644 index ce9beca9..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/CallbackFunctions.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_CallbackFnsT; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_EventCallback_t; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_StreamCallback_t; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * Callback functions (sdrplay_api_CallbackFnsT) factory - */ -public class CallbackFunctions -{ - 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 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 arena, IDeviceEventListener deviceEventListener, IStreamListener streamListener, - IStreamCallbackListener streamCallbackListener) - { - //Create the event callback function - mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener); - 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, arena); - mStreamBCallbackAdapter = null; - - //Create the callback functions union and populate the callback functions - 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); - } - - /** - * Constructs a callback functions for dual-tuner use. - * @param arena for native memory allocation - * @param deviceEventListener for device events - * @param streamAListener for streaming samples from the master tuner - * @param streamBListener for streaming samples from the slave tuner - * @param streamCallbackListener for streaming events - */ - public CallbackFunctions(Arena arena, IDeviceEventListener deviceEventListener, - IStreamListener streamAListener, IStreamListener streamBListener, - IStreamCallbackListener streamCallbackListener) - { - //Create the event callback function - mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener); - 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); - - //Create the stream B callback function - mStreamBCallbackAdapter = new StreamCallbackAdapter(streamBListener, streamCallbackListener); - 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(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); - } - - /** - * Foreign memory segment for the callback functions. - */ - public MemorySegment getCallbackFunctionsMemorySegment() - { - return mCallbackFunctionsMemorySegment; - } - - /** - * Updates the device event listener - * @param listener to receive device events - */ - public void setDeviceEventListener(IDeviceEventListener listener) - { - mDeviceEventAdapter.setListener(listener); - } - - /** - * Updates the stream A listener - * @param listener to receive samples for stream A - */ - public void setStreamAListener(IStreamListener listener) - { - mStreamACallbackAdapter.setListener(listener); - } - - /** - * Updates the stream B listener - * @param listener to receive samples for stream B - */ - public void setStreamBListener(IStreamListener listener) - { - mStreamBCallbackAdapter.setListener(listener); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/DeviceEventAdapter.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/DeviceEventAdapter.java deleted file mode 100644 index 1d9ee41a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/DeviceEventAdapter.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2025 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.EventParametersFactory; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.EventType; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_EventCallback_t; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_EventParamsT; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import org.slf4j.Logger; -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.Function -{ - private static final Logger mLog = LoggerFactory.getLogger(DeviceEventAdapter.class); - private IDeviceEventListener mDeviceEventListener; - - /** - * Constructs an instance. - * @param listener to receive translated device events. - */ - public DeviceEventAdapter(IDeviceEventListener listener) - { - setListener(listener); - } - - /** - * Updates the device event listener - * @param listener to receive device events - */ - public void setListener(IDeviceEventListener listener) - { - if(listener == null) - { - throw new IllegalArgumentException("Device event listener must be non-null"); - } - - mDeviceEventListener = listener; - } - - @Override - public void apply(int eventTypeId, int tunerSelectId, MemorySegment eventParametersPointer, - MemorySegment callbackContext) - { - //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) - { - case GAIN_CHANGE -> - { - mDeviceEventListener.processGainChange(tunerSelect, - EventParametersFactory.createGainCallbackParameters(eventParams)); - } - case POWER_OVERLOAD_CHANGE -> - { - mDeviceEventListener.processPowerOverload(tunerSelect, - EventParametersFactory.createPowerOverloadCallbackParameters(eventParams)); - } - case DEVICE_REMOVED, DEVICE_FAILURE -> - { - 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); - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IDeviceEventListener.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IDeviceEventListener.java deleted file mode 100644 index 8f685468..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IDeviceEventListener.java +++ /dev/null @@ -1,67 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.EventType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.GainCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.PowerOverloadCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.event.RspDuoModeCallbackParameters; - -/** - * Device event listener. Receives events for the device, impacting one or both (if equipped) tuners on the device. - */ -public interface IDeviceEventListener -{ - /** - * Process a device event - * @param eventType identifies the type of event - * @param tunerSelect identifies which tuner(s) are included in the event (A, B, BOTH, or NEITHER) - */ - void processEvent(EventType eventType, TunerSelect tunerSelect); - - /** - * Process a gain change event - * @param tunerSelect identifies which tuner(s) are included in the event (A, B, BOTH, or NEITHER) - * @param gainCallbackParameters containing event details - */ - void processGainChange(TunerSelect tunerSelect, GainCallbackParameters gainCallbackParameters); - - /** - * Process a power overload event - * @param tunerSelect identifies which tuner(s) are included in the event (A, B, BOTH, or NEITHER) - * @param parameters containing event details - */ - void processPowerOverload(TunerSelect tunerSelect, PowerOverloadCallbackParameters parameters); - - /** - * Process an RSP-Duo mode change event - * @param tunerSelect identifies which tuner(s) are included in the event (A, B, BOTH, or NEITHER) - * @param parameters containing event details - */ - void processRspDuoModeChange(TunerSelect tunerSelect, RspDuoModeCallbackParameters parameters); - - /** - * Process a device removed (ie unplugged) event - * @param tunerSelect identifies which tuner(s) are included in the event (A, B, BOTH, or NEITHER) - */ - void processDeviceRemoval(TunerSelect tunerSelect); - -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamCallbackListener.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamCallbackListener.java deleted file mode 100644 index 41429525..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamCallbackListener.java +++ /dev/null @@ -1,32 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; - -public interface IStreamCallbackListener -{ - /** - * Process stream callback parameters and reset value received over the stream callback interface. - * @param parameters to process - * @param reset value - */ - void process(TunerSelect tunerSelect, StreamCallbackParameters parameters, int reset); -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamListener.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamListener.java deleted file mode 100644 index 77313786..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/IStreamListener.java +++ /dev/null @@ -1,45 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; - -/** - * Stream Listener interface. - */ -public interface IStreamListener -{ - /** - * Process samples from a single stream of I/Q samples - * @param xi array of Inphase samples - * @param xq array of Quadrature samples - * @param streamCallbackParameters stream callback parameters - * @param reset indicates if a re-initialization has occurred within the API and that local buffering should be reset - */ - void processStream(short[] xi, short[] xq, StreamCallbackParameters streamCallbackParameters, - boolean reset); - - /** - * Indicates which tuner this stream listener is for. Note: this is used to manage asynchronous Updates to ensure - * that submitted updates get correctly mapped and resolved in the Device update manager. - * @return - */ - TunerSelect getTunerSelect(); -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackAdapter.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackAdapter.java deleted file mode 100644 index 065a8e3a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackAdapter.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_StreamCallback_t; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_StreamCbParamsT; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.ValueLayout; -import org.slf4j.Logger; -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.Function -{ - private static final Logger mLog = LoggerFactory.getLogger(StreamCallbackAdapter.class); - private IStreamListener mStreamListener; - private IStreamCallbackListener mStreamCallbackListener; - - /** - * Constructs an instance of the callback implementation - * @param streamListener to receive transferred I/Q samples and event details - * @param listener to receive callback parameters - */ - public StreamCallbackAdapter(IStreamListener streamListener, IStreamCallbackListener listener) - { - mStreamCallbackListener = listener; - setListener(streamListener); - } - - /** - * Updates the listener for receiving samples - * @param listener to receive stream samples - */ - public void setListener(IStreamListener listener) - { - mStreamListener = listener; - } - - /** - * Receives callback of foreign memory data, transfers it to Java, and passes to the listener. - * @param iSamplesPointer array foreign memory address - * @param qSamplesPointer array foreign memory address - * @param parametersPointer associated with the callback - foreign memory address - * @param sampleCount number of samples in each of the I and Q arrays - * @param reset 0 or 1, translated to a boolean - * @param deviceContext of the device that sourced the samples - */ - @Override - public void apply(MemorySegment iSamplesPointer, MemorySegment qSamplesPointer, MemorySegment parametersPointer, - int sampleCount, int reset, MemorySegment deviceContext) - { - if(mStreamListener != null || mStreamCallbackListener != null) - { - try(Arena confinedArena = Arena.ofConfined()) - { - //Translate the callback parameters pointer to a memory segment and re-construct the parameters as a Java object - MemorySegment memorySegment = parametersPointer.reinterpret(sdrplay_api_StreamCbParamsT.sizeof(), confinedArena, null); - StreamCallbackParameters parameters = new StreamCallbackParameters(memorySegment); - - if(mStreamCallbackListener != null) - { - mStreamCallbackListener.process(mStreamListener.getTunerSelect(), parameters, reset); - } - - if(mStreamListener != null) - { - //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 = 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)); - } - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackParameters.java deleted file mode 100644 index d7b87b5b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/callback/StreamCallbackParameters.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.callback; - -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_StreamCbParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Stream Callback Parameters structure (sdrplay_api_StreamCbParamsT) - */ -public class StreamCallbackParameters -{ - 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(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); - } - - /** - * First sample number - */ - public int getFirstSampleNumber() - { - return mFirstSampleNumber; - } - - /** - * Indicates if gain reduction value has changed - */ - public boolean isGainReductionChanged() - { - return mGainReductionChanged; - } - - /** - * Indicates if RF center frequency has changed - */ - public boolean isRfFrequencyChanged() - { - return mRfFrequencyChanged; - } - - /** - * Indicates if sample rate has changed - */ - public boolean isSampleRateChanged() - { - return mSampleRateChanged; - } - - /** - * Number of samples - */ - public long getNumberSamples() - { - return mNumberSamples; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Decimate.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Decimate.java deleted file mode 100644 index 25124e20..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Decimate.java +++ /dev/null @@ -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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -/** - * Software decimation rates supported by the API for SDRPlay RSP devices - */ -public enum Decimate -{ - X1(1, 16), - X2(2, 16), - X4(4, 17), - X8(8, 17), - X16(16, 18), - X32(32, 20); - - private int mValue; - private int mSampleSize; - - /** - * Constructs an instance - * @param value - * @param sampleSize in bits to represent effective dynamic range. - */ - Decimate(int value, int sampleSize) - { - mValue = value; - mSampleSize = sampleSize; - } - - /** - * Decimation value. - * @return - */ - public int getValue() - { - return mValue; - } - - /** - * Sample size in bits to represent effective dynamic range for the decimation value. - */ - public int getSampleSize() - { - return mSampleSize; - } - - /** - * Indicates if software decimation is enabled. - * @return true for all values except X1. - */ - public boolean isEnabled() - { - return !this.equals(X1); - } - - @Override - public String toString() - { - if(this.equals(X1)) - { - return "None"; - } - - return "x" + getValue(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Device.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Device.java deleted file mode 100644 index ace8215d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Device.java +++ /dev/null @@ -1,695 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.Status; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.async.AsyncUpdateFuture; -import io.github.dsheirer.source.tuner.sdrplay.api.async.CompletedAsyncUpdate; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IDeviceEventListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamCallbackListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.IStreamListener; -import io.github.dsheirer.source.tuner.sdrplay.api.callback.StreamCallbackParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.error.DebugLevel; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.CompositeParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.IfMode; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.LoMode; -import java.lang.foreign.MemorySegment; -import java.util.Queue; -import java.util.concurrent.ConcurrentLinkedQueue; -import java.util.concurrent.Executors; -import java.util.concurrent.ScheduledExecutorService; -import java.util.concurrent.TimeUnit; -import java.util.concurrent.locks.ReentrantLock; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Abstract device structure (sdrplay_api_DeviceT) - */ -public abstract class Device, R extends RspTuner> -{ - private static final Logger mLog = LoggerFactory.getLogger(Device.class); - - private SDRplay mSDRplay; - private final UpdateRequestManager mUpdateRequestManager = new UpdateRequestManager(); - private final IDeviceStruct mDeviceStruct; - protected boolean mSelected = false; - protected boolean mInitialized = false; - private T mCompositeParameters; - - /** - * Constructs an SDRPlay device from the foreign memory segment - * @param sdrPlay api instance that created this device - * @param deviceStruct to parse or access the fields of the device structure - */ - public Device(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - mSDRplay = sdrPlay; - mDeviceStruct = deviceStruct; - } - - /** - * Version specific device structure parser - */ - protected IDeviceStruct getDeviceStruct() - { - return mDeviceStruct; - } - - /** - * API that owns this device - */ - protected SDRplay getAPI() - { - return mSDRplay; - } - - /** - * Stream callback listener for parameter change events. - */ - public IStreamCallbackListener getStreamCallbackListener() - { - return mUpdateRequestManager; - } - - /** - * Loads the device parameters for this device. Subsequent calls once the parameters are created are ignored. - * @throws SDRPlayException if the device is not selected or if there is an issue loading the parameters - */ - private void loadDeviceParameters() throws SDRPlayException - { - if(selected()) - { - mCompositeParameters = (T)getAPI().getCompositeParameters(getDeviceType(), getDeviceHandle()); - } - } - - /** - * Sets the debug logging level for this device. - * @param debugLevel to set - */ - public void setDebugLevel(DebugLevel debugLevel) - { - try - { - mSDRplay.setDebugLevel(getDeviceHandle(), debugLevel); - } - catch(SDRPlayException se) - { - mLog.info("Unable to set debug level [" + debugLevel + "] for device - not selected", se); - } - } - - /** - * Selects this device for exclusive use and loads the device composite parameters. - * @throws SDRPlayException if unable to select the device or if unable to load the composite parameters for use. - */ - public void select() throws SDRPlayException - { - if(!selected()) - { - getAPI().select(getDeviceMemorySegment()); - mSelected = true; - loadDeviceParameters(); - } - } - - /** - * Indicates if this device has been selected via the SDRplay api - */ - protected boolean selected() - { - return mSelected; - } - - /** - * Indicates if the device is valid and ready for use - */ - public boolean isValid() - { - return getDeviceStruct().isValid(); - } - - /** - * Releases this device from exclusive use. - */ - public void release() throws SDRPlayException - { - if(selected()) - { - mSelected = false; - getAPI().release(getDeviceMemorySegment()); - } - } - - /** - * Indicates if this device is initialized for use - */ - public boolean isInitialized() - { - return mInitialized; - } - - /** - * Initializes this device for single-tuner use and starts the tuner providing raw signal samples to the stream - * listener and device events to the event listener. - * - * Note: invoke select() to select this device for exclusive use before invoking this method. If this device has - * previously been initialized, an exception is thrown. Use uninit() to uninitialize this device and stop the - * sample stream and event notifications. - * - * @param eventListener to receive device event notifications - * @param streamListener to receive samples from stream. Stream is from either Tuner 1 or Tuner 2 when - * the device is selected for single-tuner mode. - * @throws SDRPlayException if there is an error - */ - public void initStreamA(IDeviceEventListener eventListener, IStreamListener streamListener) throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before it can be initialized"); - } - - if(isInitialized()) - { - throw new SDRPlayException("Device has already been initialized with listeners"); - } - - getAPI().initA(Device.this, getDeviceHandle(), eventListener, streamListener); - mInitialized = true; - } - - /** - * Initializes this device for dual-tuner stream B use and starts the tuner providing raw signal samples to the stream - * listener and device events to the event listener. - * - * Note: invoke select() to select this device for exclusive use before invoking this method. If this device has - * previously been initialized, an exception is thrown. Use uninit() to uninitialize this device and stop the - * sample stream and event notifications. - * - * @param eventListener to receive device event notifications - * @param streamListener to receive samples from stream. Stream is from either Tuner 1 or Tuner 2 when - * the device is selected for single-tuner mode. - * @throws SDRPlayException if there is an error - */ - public void initStreamB(IDeviceEventListener eventListener, IStreamListener streamListener) throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before it can be initialized"); - } - - if(isInitialized()) - { - throw new SDRPlayException("Device has already been initialized with listeners"); - } - - getAPI().initB(Device.this, getDeviceHandle(), eventListener, streamListener); - mInitialized = true; - } - - /** - * Uninitializes this device from use. Note: call is ignored if this device hasn't been initialized - * @throws SDRPlayException if there is an error - */ - public void uninitialize() throws SDRPlayException - { - if(isInitialized()) - { - getAPI().uninit(getDeviceHandle()); - mInitialized = false; - } - else - { - throw new SDRPlayException("Attempt to uninit a device that has not been initialized previously"); - } - } - - /** - * Updates this device after parameter change, only when the device is initialized. If the device is not yet - * initialized, the update request is ignored. - * - * @throws SDRPlayException if unable to apply updates - */ - public void update(TunerSelect tunerSelect, UpdateReason ... updateReasons) throws SDRPlayException - { - if(isInitialized()) - { - submitUpdate(tunerSelect, updateReasons); - } - } - - private String toString(UpdateReason ... updateReasons) - { - StringBuilder sb = new StringBuilder(); - - boolean first = true; - - for(UpdateReason updateReason: updateReasons) - { - if(first) - { - sb.append("["); - } - else - { - sb.append(", "); - } - - sb.append(updateReason.name()); - - first = false; - } - - sb.append("]"); - - return sb.toString(); - } - - /** - * Asynchronous update request. This method should only be used for Frequency, Gain and Sample Rate updates. - * @param tunerSelect tuner being updated - * @param updateReason for the parameter that is being updated - * @param expectedResponse that is one of Gain, Frequency, or Sample Rate. - * @return a future that has already been completed, or if initialized a future that will be completed. - */ - protected AsyncUpdateFuture updateAsync(TunerSelect tunerSelect, UpdateReason updateReason, UpdateReason expectedResponse) - { - if(!expectedResponse.isAsyncUpdateResponse()) - { - throw new IllegalArgumentException("Invalid expected response: " + expectedResponse + - ". Valid values are: " + UpdateReason.ASYNC_UPDATE_RESPONSES); - } - - if(isInitialized()) - { - return mUpdateRequestManager.update(tunerSelect, updateReason, expectedResponse); - } - - //If not initialized, return success. - AsyncUpdateFuture future = new AsyncUpdateFuture(tunerSelect, updateReason, expectedResponse); - future.setResult(Status.SUCCESS); - return future; - } - - /** - * Submits an update request to the API. This method is used/managed by the update request manager. - * @param tunerSelect for the update - * @param updateReasons to apply - * @throws SDRPlayException if there is an issue. - */ - private void submitUpdate(TunerSelect tunerSelect, UpdateReason ... updateReasons) throws SDRPlayException - { - getAPI().update(Device.this, getDeviceHandle(), tunerSelect, updateReasons); - } - - /** - * Acknowledge tuner power overload events - * @param tunerSelect identifying which tuner(s) - * @throws SDRPlayException on error - */ - public void acknowledgePowerOverload(TunerSelect tunerSelect) throws SDRPlayException - { -// mLog.info("Acknowledging power overload message for tuner [" + tunerSelect + "]"); - - //There's a bug (feature?) in the API ... when you un-initialize the device, it causes a power overload event - // and if you acknowledge it, you get an error that the device is not initialized. - if(isInitialized()) - { - try - { - update(tunerSelect, UpdateReason.CONTROL_OVERLOAD_MESSAGE_ACK); - } - catch(SDRPlayException se) - { - //Ignore the not initialized exception that can happen when shutting down the receiver, otherwise - //rethrow the exception. - if(se.getStatus() != Status.NOT_INITIALIZED) - { - throw se; - } - } - } - } - - /** - * Tuner selection. - * @return tuner select. Defaults to TUNER_1 for all but the RSPduo where it is overridden for tuner 2. - */ - public TunerSelect getTunerSelect() - { - return TunerSelect.TUNER_1; - } - - /** - * Foreign memory segment representing this device. - */ - protected MemorySegment getDeviceMemorySegment() - { - return getDeviceStruct().getDeviceMemorySegment(); - } - - /** - * Handle to this device. - * - * Note: this device must be selected for exclusive use before you can access this handle. - * - * @throws SDRPlayException if this method is accessed before the device has been successfully selected - */ - MemorySegment getDeviceHandle() throws SDRPlayException - { - if(!selected()) - { - throw new SDRPlayException("This device must be selected for exclusive use before accessing/using the " + - "device handle"); - } - - return getDeviceStruct().getDeviceHandle(); - } - - /** - * Tuner for this device - * @return tuner appropriate for the device type - * @throws SDRPlayException for various reasons include device not selected or API unavailable - */ - public abstract R getTuner() throws SDRPlayException; - - /** - * Composite parameters for this device - */ - public T getCompositeParameters() - { - return mCompositeParameters; - } - - /** - * Indicates if this device has composite parameters - */ - public boolean hasCompositeParameters() - { - return mCompositeParameters != null; - } - - /** - * Indicates if this device is available and has been selected for exclusive use. - */ - public boolean isSelected() - { - return mSelected; - } - - /** - * Device type - */ - public DeviceType getDeviceType() - { - return getDeviceStruct().getDeviceType(); - } - - /** - * Serial number - */ - public String getSerialNumber() - { - return getDeviceStruct().getSerialNumber(); - } - - /** - * Current sample rate - */ - public double getSampleRate() - { - return getCompositeParameters().getDeviceParameters().getSamplingFrequency().getSampleRate(); - } - - public void setIfMode(IfMode ifMode) - { - getCompositeParameters().getTunerAParameters().setIfMode(ifMode); - } - - public void setLoMode(LoMode loMode) - { - getCompositeParameters().getTunerAParameters().setLoMode(loMode); - } - - /** - * Enables or disables wideband signal mode. This should be set according to the IFMode, where IFMode.ZERO is - * wideband and all others are not wideband. - * @param enable - */ - public void setWidebandSignal(boolean enable) throws SDRPlayException - { - getCompositeParameters().getControlAParameters().getDecimation().setWideBandSignal(enable); - - if(isInitialized()) - { - update(getTunerSelect(), UpdateReason.CONTROL_DECIMATION); - } - } - - /** - * Sets the software-based decimation factor for the final sample rate. - * @param decimate value where X1 is no decimation and all others are decimation enabled values. - * @throws SDRPlayException if there is an error while setting decimation - */ - public void setDecimation(Decimate decimate) throws SDRPlayException - { - getCompositeParameters().getControlAParameters().getDecimation().setDecimationFactor(decimate.getValue()); - getCompositeParameters().getControlAParameters().getDecimation().setEnabled(decimate.isEnabled()); - - if(isInitialized()) - { - update(getTunerSelect(), UpdateReason.CONTROL_DECIMATION); - } - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("SDRPplay Device").append("\n"); - sb.append("\tType: ").append(getDeviceType()).append("\n"); - sb.append("\tSerial Number: ").append(getSerialNumber()).append("\n"); - sb.append("\tSelected: ").append(isSelected()); - if(hasCompositeParameters()) - { - sb.append("\t").append(getCompositeParameters()); - } - - return sb.toString(); - } - - /** - * Thread-safe manager for asynchronous update request queue processing for an initialized RSP device. - * - * Once a device has been initialized, any changes to frequency, gain or sample rate require submitting an update - * request to the device to apply the parameter change(s). However, since the API supports non-blocking operation, - * the operation executes asynchronously. The API supports only a single update request operation - * to be in-progress at a time and any overlapping update requests are met with an unsuccessful status code return - * from the update method. - */ - class UpdateRequestManager implements IStreamCallbackListener - { - private static final long UPDATE_QUEUE_PROCESSING_INTERVAL_MS = 75; - private final ScheduledExecutorService mExecutorService = Executors.newSingleThreadScheduledExecutor(); - private final Queue mUpdateQueue = new ConcurrentLinkedQueue(); - private final Queue mCompletedUpdateQueue = new ConcurrentLinkedQueue(); - private final ReentrantLock mLock = new ReentrantLock(); - - /** - * Submits an update request for the specified tuner and update reason for queued processing. This is a - * non-blocking operation and the update is performed by a thread from the thread pool. - * @param tunerSelect to apply the update - * @param updateReason to update - * @return an asynchronous future to monitor the progress of the update request - */ - public AsyncUpdateFuture update(TunerSelect tunerSelect, UpdateReason updateReason, UpdateReason expectedResponse) - { - AsyncUpdateFuture future = new AsyncUpdateFuture(tunerSelect, updateReason, expectedResponse); - mUpdateQueue.add(future); - processQueuesImmediately(); - return future; - } - - /** - * Schedules a process queues task for immediate execution. Non-blocking. - */ - private void processQueuesImmediately() - { - processQueuesAfterDelay(0); - } - - /** - * Schedules a process queues task after the delay. Non-blocking - * @param delay in milliseconds, or zero for immediate. - */ - private void processQueuesAfterDelay(long delay) - { - mExecutorService.schedule(() -> processQueues(), delay, TimeUnit.MILLISECONDS); - } - - /** - * Processes the pending and completed update operation queues. Submits new update requests one at a time and - * awaits a stream callback notification that the matching update reason has been applied/updated. Ensures - * that only a single update operation is in-progress at any given time. - */ - private synchronized void processQueues() - { - mLock.lock(); - - try - { - if(mUpdateQueue.isEmpty()) - { - //If we have no pending updates, we don't care about any completed update results - mCompletedUpdateQueue.clear(); - } - else - { - boolean processing = true; - - while(processing) - { - processing = false; - - AsyncUpdateFuture futureUpdate = mUpdateQueue.peek(); - - if(futureUpdate != null) - { - if(futureUpdate.isSubmitted()) - { - //Process the completion queue - while(!mCompletedUpdateQueue.isEmpty()) - { - CompletedAsyncUpdate completedUpdate = mCompletedUpdateQueue.poll(); - - if(completedUpdate != null) - { - if(futureUpdate.matches(completedUpdate)) - { - //Clear the remaining completed updates - mCompletedUpdateQueue.clear(); - - //Remove and (successfully) complete the current future - mUpdateQueue.remove(); - futureUpdate.setResult(Status.SUCCESS); - - //Signal to immediately reprocess the queue - processing = true; - - //Break out of the completed update queue processing - break; - } - } - } - } - else - { - //Clear the completed queue and submit the update - mCompletedUpdateQueue.clear(); - - try - { - submitUpdate(futureUpdate.getTunerSelect(), futureUpdate.getUpdateReason()); - futureUpdate.setSubmitted(true); - } - catch(SDRPlayException se) - { - futureUpdate = mUpdateQueue.poll(); - futureUpdate.setError(se); - //Set continuous to true to immediately reprocess the next update - processing = true; - } - } - } - } - } - } - finally - { - mLock.unlock(); - } - - if(!mUpdateQueue.isEmpty()) - { - processQueuesAfterDelay(UPDATE_QUEUE_PROCESSING_INTERVAL_MS); - } - } - - /** - * Receives an update completion event. This is a non-blocking operation since this method will be invoked - * by the stream callback thread, and we don't want to impact the delivery of streaming samples or events. - * - * @param tunerSelect tuner that was updated - * @param updateReason for what was updated - */ - public void completed(TunerSelect tunerSelect, UpdateReason updateReason) - { - mCompletedUpdateQueue.add(new CompletedAsyncUpdate(tunerSelect, updateReason)); - mExecutorService.schedule(this::processQueues, 0, TimeUnit.MILLISECONDS); - } - - /** - * Resets the update queue. - */ - public void reset() - { - mLock.lock(); - - try - { - while(!mUpdateQueue.isEmpty()) - { - AsyncUpdateFuture future = mUpdateQueue.poll(); - future.setResult(Status.UNKNOWN); - } - } - finally - { - mLock.unlock(); - } - } - - /** - * Implements the IStreamCallbackListener interface to receive change notifications from update requests. - * @param parameters to process - * @param reset value with flags - */ - @Override - public void process(TunerSelect tunerSelect, StreamCallbackParameters parameters, int reset) - { - if(parameters.isSampleRateChanged()) - { - completed(tunerSelect, UpdateReason.DEVICE_SAMPLE_RATE); - } - if(parameters.isRfFrequencyChanged()) - { - completed(tunerSelect, UpdateReason.TUNER_FREQUENCY_RF); - } - if(parameters.isGainReductionChanged()) - { - completed(tunerSelect, UpdateReason.TUNER_GAIN_REDUCTION); - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceFactory.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceFactory.java deleted file mode 100644 index 6fbec9b7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceFactory.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -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_h; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.util.ArrayList; -import java.util.List; - -/** - * Factory methods for creating new RSP Device instances - */ -public class DeviceFactory -{ - /** - * Creates a foreign memory segment for a DeviceT array, appropriate for the specified version. - * @param version value - * @param segmentAllocator to allocate the foreign memory - * @return devices array - */ - public static MemorySegment createDeviceArray(Version version, SegmentAllocator segmentAllocator) - { - if(version.gte(Version.V3_08)) - { - return sdrplay_api_DeviceT.allocateArray(sdrplay_api_h.SDRPLAY_MAX_DEVICES(), segmentAllocator); - } - else if(version == Version.V3_07) - { - return sdrplay_api_DeviceT.allocateArray(sdrplay_api_h.SDRPLAY_MAX_DEVICES(), segmentAllocator); - } - - throw new IllegalArgumentException("Unrecognized version: " + version); - } - - /** - * Parses device information from a list of device structures - * @param deviceStructs representing devices to parse - * @return a list of device infos - */ - public static List parseDeviceInfos(List deviceStructs) - { - List deviceInfos = new ArrayList<>(); - - for(IDeviceStruct deviceStruct: deviceStructs) - { - deviceInfos.add(new DeviceInfo(deviceStruct)); - } - - return deviceInfos; - } - - /** - * Parses device information from a memory segment containing an array of device structures. - * @param version of the API - * @param devicesArray memory segment - * @param count of device structures in the devicesArray. - * @return a list of device infos - * @throws SDRPlayException if version is unrecognized or unsupported - */ - public static List parseDeviceStructs(Version version, MemorySegment devicesArray, int count) - throws SDRPlayException - { - List deviceStructs = new ArrayList<>(); - - if(version.gte(Version.V3_08)) - { - 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 -> - { - deviceStructs.add(DeviceFactory.createDeviceStruct(version, memorySegment)); - }); - } - else - { - throw new SDRPlayException("Unrecognized version: " + version); - } - - return deviceStructs; - } - - /** - * Creates an SDRplay device from the foreign memory Device instance. - * @param sdrPlay for device callback support - * @param deviceStruct instance for the device - * @return correctly typed device - */ - public static Device createDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - switch(deviceStruct.getDeviceType()) - { - case RSP1 -> { - return new Rsp1Device(sdrPlay, deviceStruct); - } - case RSP1A -> { - return new Rsp1aDevice(sdrPlay, deviceStruct); - } - case RSP1B -> { - return new Rsp1bDevice(sdrPlay, deviceStruct); - } - case RSP2 -> { - return new Rsp2Device(sdrPlay, deviceStruct); - } - case RSPduo -> { - return new RspDuoDevice(sdrPlay, deviceStruct); - } - case RSPdx, RSPdxR2 -> { - return new RspDxDevice(sdrPlay, deviceStruct); - } - default -> { - return new UnknownDevice(sdrPlay, deviceStruct); - } - } - } - - /** - * Creates a device structure parser for the specified API version - * @param version to create - * @param deviceMemorySegment for the device - * @return device structure - */ - private static IDeviceStruct createDeviceStruct(Version version, MemorySegment deviceMemorySegment) - { - if(version == Version.V3_07) - { - return new DeviceStruct_v3_07(deviceMemorySegment); - } - else if(version.gte(Version.V3_08)) - { - return new DeviceStruct_v3_08(deviceMemorySegment); - } - else - { - throw new IllegalArgumentException("Unsupported version: " + version); - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceInfo.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceInfo.java deleted file mode 100644 index 1d1af632..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceInfo.java +++ /dev/null @@ -1,140 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import java.util.Objects; -import org.apache.commons.lang3.Validate; - -/** - * RSP device information to support device selection. - */ -public class DeviceInfo -{ - private DeviceSelectionMode mDeviceSelectionMode = DeviceSelectionMode.SINGLE_TUNER_1; - private DeviceType mDeviceType; - private String mSerialNumber; - - /** - * Constructs an instance - * @param deviceType of the RSP device - * @param serialNumber for the device - */ - public DeviceInfo(DeviceType deviceType, String serialNumber) - { - Validate.notNull(deviceType, "Device type cannot be null"); - Validate.notNull(serialNumber, "Device serial number cannot be null"); - - mDeviceType = deviceType; - mSerialNumber = serialNumber; - } - - /** - * Alternate constructor where we get the parameters from a device structure. - * @param deviceStruct containing device type and serial number values. - */ - public DeviceInfo(IDeviceStruct deviceStruct) - { - this(deviceStruct.getDeviceType(), deviceStruct.getSerialNumber()); - } - - /** - * Device type for this RSP device - * @return type - */ - public DeviceType getDeviceType() - { - return mDeviceType; - } - - /** - * Serial number for this RSP device - * @return serial number - */ - public String getSerialNumber() - { - return mSerialNumber; - } - - /** - * Device selection mode for this RSP device - * @return device selection mode where single tuner 1 is default - */ - public DeviceSelectionMode getDeviceSelectionMode() - { - return mDeviceSelectionMode; - } - - /** - * Sets the device selection mode. This should be left as default of single tuner 1 unless this device is an RSPduo. - * @param deviceSelectionMode to use for this device. - */ - public void setDeviceSelectionMode(DeviceSelectionMode deviceSelectionMode) - { - Validate.notNull(deviceSelectionMode, "Device selection mode cannot be null"); - mDeviceSelectionMode = deviceSelectionMode; - } - - /** - * Clones this instance - * @return deep copy. - */ - public DeviceInfo clone() - { - return new DeviceInfo(mDeviceType, mSerialNumber); - } - - /** - * Indicates if this device type and serial number matches the details of the device structure. - * @param deviceStruct to compare - * @return true if the device type and serial number match. - */ - public boolean matches(IDeviceStruct deviceStruct) - { - return deviceStruct != null && getDeviceType().equals(deviceStruct.getDeviceType()) && getSerialNumber().equals(deviceStruct.getSerialNumber()); - } - - @Override - public String toString() - { - return "Device: " + getDeviceType() + " Serial Number: " + getSerialNumber() + " Selection Mode: " + getDeviceSelectionMode(); - } - - @Override - public boolean equals(Object o) - { - if(this == o) - { - return true; - } - if(o == null || getClass() != o.getClass()) - { - return false; - } - DeviceInfo that = (DeviceInfo) o; - return mDeviceSelectionMode == that.mDeviceSelectionMode && mDeviceType == that.mDeviceType && mSerialNumber.equals(that.mSerialNumber); - } - - @Override - public int hashCode() - { - return Objects.hash(mDeviceSelectionMode, mDeviceType, mSerialNumber); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_07.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_07.java deleted file mode 100644 index 18c579a4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_07.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceT; -import java.lang.foreign.MemorySegment; - -/** - * sdrplay_api_DeviceT structure parser for API version 3.07 - */ -public class DeviceStruct_v3_07 implements IDeviceStruct -{ - private final MemorySegment mDeviceMemorySegment; - private final DeviceType mDeviceType; - private final String mSerialNumber; - - /** - * Constructs an instance - * @param deviceMemorySegment of foreign memory - */ - public DeviceStruct_v3_07(MemorySegment deviceMemorySegment) - { - mDeviceMemorySegment = deviceMemorySegment; - mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment)); - MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment); - mSerialNumber = serialSegment.getString(0); - } - - @Override public MemorySegment getDeviceMemorySegment() - { - return mDeviceMemorySegment; - } - - @Override public String getSerialNumber() - { - return mSerialNumber; - } - - @Override public DeviceType getDeviceType() - { - return mDeviceType; - } - - @Override public TunerSelect getTunerSelect() - { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); - } - - @Override public RspDuoMode getRspDuoMode() - { - return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment())); - } - - @Override - public void setRspDuoMode(RspDuoMode mode) - { - sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue()); - } - - @Override public boolean isValid() - { - //Always returns true for version 3.07 - return true; - } - - @Override public double getRspDuoSampleFrequency() - { - return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment()); - } - - @Override - public void setRspDuoSampleFrequency(double frequency) - { - sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency); - } - - @Override public MemorySegment getDeviceHandle() - { - return sdrplay_api_DeviceT.dev(getDeviceMemorySegment()); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_08.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_08.java deleted file mode 100644 index 45d84a0e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceStruct_v3_08.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_08.sdrplay_api_DeviceT; -import java.lang.foreign.MemorySegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * sdrplay_api_DeviceT structure parser for API version 3.08+ - */ -public class DeviceStruct_v3_08 implements IDeviceStruct -{ - private static final Logger LOGGER = LoggerFactory.getLogger(DeviceStruct_v3_08.class); - private final MemorySegment mDeviceMemorySegment; - private final DeviceType mDeviceType; - private final String mSerialNumber; - - /** - * Constructs an instance - * @param deviceMemorySegment of foreign memory - */ - public DeviceStruct_v3_08(MemorySegment deviceMemorySegment) - { - mDeviceMemorySegment = deviceMemorySegment; - int deviceTypeValue = 0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment); - mDeviceType = DeviceType.fromValue(deviceTypeValue); - - MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment); - mSerialNumber = serialSegment.getString(0); - - if(mDeviceType == DeviceType.UNKNOWN) - { - LOGGER.warn("Unrecognized RSP tuner device type value [" + deviceTypeValue + "] with serial number [" + - mSerialNumber + "]"); - } - } - - @Override public MemorySegment getDeviceMemorySegment() - { - return mDeviceMemorySegment; - } - - @Override public String getSerialNumber() - { - return mSerialNumber; - } - - @Override public DeviceType getDeviceType() - { - return mDeviceType; - } - - @Override public TunerSelect getTunerSelect() - { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); - } - - @Override public RspDuoMode getRspDuoMode() - { - return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment())); - } - - @Override - public void setRspDuoMode(RspDuoMode mode) - { - sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue()); - } - - @Override public boolean isValid() - { - //Always returns true for version 3.07 - return true; - } - - @Override public double getRspDuoSampleFrequency() - { - return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment()); - } - - @Override - public void setRspDuoSampleFrequency(double frequency) - { - sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency); - } - - @Override public MemorySegment getDeviceHandle() - { - return sdrplay_api_DeviceT.dev(getDeviceMemorySegment()); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceType.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceType.java deleted file mode 100644 index afd4a462..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/DeviceType.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h; - -/** - * RSP Device type - */ -public enum DeviceType -{ - RSP1(sdrplay_api_h.SDRPLAY_RSP1_ID(), "RSP1"), - RSP1A(sdrplay_api_h.SDRPLAY_RSP1A_ID(), "RSP1A"), - RSP1B(sdrplay_api_h.SDRPLAY_RSP1B_ID(), "RSP1B"), - 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_RSPdxR2_ID(), "RSPdxR2"), - UNKNOWN(Integer.MIN_VALUE, "UNKNOWN"); - - private final int mValue; - private final String mDescription; - - DeviceType(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static DeviceType fromValue(int value) - { - for(DeviceType status: DeviceType.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/IDeviceStruct.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/IDeviceStruct.java deleted file mode 100644 index 56e45a9f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/IDeviceStruct.java +++ /dev/null @@ -1,80 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import java.lang.foreign.MemorySegment; - -/** - * Interface for parsing and accessing the fields of the sdrplay_api_DeviceT structure across - * various versions. - */ -public interface IDeviceStruct -{ - /** - * Foreign memory segment for this device structure - */ - MemorySegment getDeviceMemorySegment(); - - /** - * Serial number of the device - */ - String getSerialNumber(); - - /** - * Indicates the device type, or model of RSP - */ - DeviceType getDeviceType(); - - /** - * Indicates single, dual, or master/slave mode for the tuner. - */ - TunerSelect getTunerSelect(); - - /** - * RSPduo mode - */ - RspDuoMode getRspDuoMode(); - - /** - * Sets the RSPduo mode - * @param mode to set - */ - void setRspDuoMode(RspDuoMode mode); - - /** - * Indicates if the device is valid and ready for use (V3.08 and later) - */ - boolean isValid(); - - /** - * Sample frequency/rate for the RSPduo when in master/slave mode - */ - double getRspDuoSampleFrequency(); - - /** - * Sets the sample frequency/rate for the RSPduo when in master (only) mode. - */ - void setRspDuoSampleFrequency(double frequency); - - /** - * Device handle. Note this is only available if the device has been selected. - */ - MemorySegment getDeviceHandle(); -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Device.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Device.java deleted file mode 100644 index 229c465c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Device.java +++ /dev/null @@ -1,61 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.Rsp1CompositeParameters; - -/** - * RSP1 Device - */ -public class Rsp1Device extends Device -{ - private Rsp1Tuner mTuner1; - - /** - * Constructs an SDRPlay RSP1 device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - Rsp1Device(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - @Override - public Rsp1Tuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner1 == null) - { - mTuner1 = new Rsp1Tuner(Rsp1Device.this, getAPI(), getTunerSelect(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - - return mTuner1; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Tuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Tuner.java deleted file mode 100644 index e693c051..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1Tuner.java +++ /dev/null @@ -1,46 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1DeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1TunerParameters; - -/** - * RSP1 Tuner - */ -public class Rsp1Tuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public Rsp1Tuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, Rsp1DeviceParameters deviceParameters, - Rsp1TunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aDevice.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aDevice.java deleted file mode 100644 index be34f9e6..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aDevice.java +++ /dev/null @@ -1,61 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.Rsp1aCompositeParameters; - -/** - * RSP1A Device - */ -public class Rsp1aDevice extends Device -{ - private Rsp1aTuner mTuner1; - - /** - * Constructs an SDRPlay RSP1A device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - Rsp1aDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - @Override - public Rsp1aTuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner1 == null) - { - mTuner1 = new Rsp1aTuner(Rsp1aDevice.this, getAPI(), getTunerSelect(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - - return mTuner1; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aTuner.java deleted file mode 100644 index a0853e5a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1aTuner.java +++ /dev/null @@ -1,105 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1aDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1aTunerParameters; - -/** - * RSP1A Tuner - */ -public class Rsp1aTuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public Rsp1aTuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, Rsp1aDeviceParameters deviceParameters, - Rsp1aTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return getDeviceParameters().isRFNotch(); - } - - /** - * Enables or disables the RF notch - * @param enable setting - * @throws SDRPlayException if there is an error - */ - public void setRfNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRFNotch(enable); - update(UpdateReason.RSP1A_RF_NOTCH_CONTROL); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return getDeviceParameters().isRfDabNotch(); - } - - /** - * Enables or disables the RF DAB notch - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setRfDabNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRfDabNotch(enable); - update(UpdateReason.RSP1A_RF_DAB_NOTCH_CONTROL); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return getTunerParameters().isBiasT(); - } - - /** - * Enables or disables the Bias-T - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setBiasT(boolean enable) throws SDRPlayException - { - getTunerParameters().setBiasT(enable); - update(UpdateReason.RSP1A_BIAS_T_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bDevice.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bDevice.java deleted file mode 100644 index 935b62aa..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bDevice.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.Rsp1bCompositeParameters; - -/** - * RSP1B Device - */ -public class Rsp1bDevice extends Device -{ - private Rsp1bTuner mTuner1; - - /** - * Constructs an SDRPlay RSP1B device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - Rsp1bDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - @Override - public Rsp1bTuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner1 == null) - { - mTuner1 = new Rsp1bTuner(Rsp1bDevice.this, getAPI(), getTunerSelect(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - - return mTuner1; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bTuner.java deleted file mode 100644 index 912b511a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp1bTuner.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1aDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1aTunerParameters; - -/** - * RSP1B Tuner - * - * Note: the RSP1B uses the same device and tuner parameters structures as the RSP1A - */ -public class Rsp1bTuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public Rsp1bTuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, Rsp1aDeviceParameters deviceParameters, - Rsp1aTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return getDeviceParameters().isRFNotch(); - } - - /** - * Enables or disables the RF notch - * @param enable setting - * @throws SDRPlayException if there is an error - */ - public void setRfNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRFNotch(enable); - update(UpdateReason.RSP1A_RF_NOTCH_CONTROL); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return getDeviceParameters().isRfDabNotch(); - } - - /** - * Enables or disables the RF DAB notch - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setRfDabNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRfDabNotch(enable); - update(UpdateReason.RSP1A_RF_DAB_NOTCH_CONTROL); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return getTunerParameters().isBiasT(); - } - - /** - * Enables or disables the Bias-T - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setBiasT(boolean enable) throws SDRPlayException - { - getTunerParameters().setBiasT(enable); - update(UpdateReason.RSP1A_BIAS_T_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Device.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Device.java deleted file mode 100644 index 449ff523..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Device.java +++ /dev/null @@ -1,61 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.Rsp2CompositeParameters; - -/** - * RSP2 Device - */ -public class Rsp2Device extends Device -{ - private Rsp2Tuner mTuner1; - - /** - * Constructs an SDRPlay RSP2 device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - Rsp2Device(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - @Override - public Rsp2Tuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner1 == null) - { - mTuner1 = new Rsp2Tuner(Rsp2Device.this, getAPI(), getTunerSelect(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - - return mTuner1; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Tuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Tuner.java deleted file mode 100644 index 750f171d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/Rsp2Tuner.java +++ /dev/null @@ -1,145 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp2DeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AmPort; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2Antenna; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2TunerParameters; - -/** - * RSP2 Tuner - */ -public class Rsp2Tuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public Rsp2Tuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, Rsp2DeviceParameters deviceParameters, - Rsp2TunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if the external reference output is enabled. - */ - public boolean isExternalReferenceOutput() - { - return getDeviceParameters().isExternalReferenceOutput(); - } - - /** - * Enables or disables the external reference output - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setExternalReferenceOutput(boolean enable) throws SDRPlayException - { - getDeviceParameters().setExternalReferenceOutput(enable); - update(UpdateReason.RSP2_EXT_REF_CONTROL); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return getTunerParameters().isBiasT(); - } - - /** - * Enables or disables the Bias-T - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setBiasT(boolean enable) throws SDRPlayException - { - getTunerParameters().setBiasT(enable); - update(UpdateReason.RSP2_BIAS_T_CONTROL); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return getTunerParameters().isRfNotch(); - } - - /** - * Enables or disables the RF notch - * @param enable setting - * @throws SDRPlayException if there is an error - */ - public void setRfNotch(boolean enable) throws SDRPlayException - { - getTunerParameters().setRfNotch(enable); - update(UpdateReason.RSP2_RF_NOTCH_CONTROL); - } - - /** - * AM port selection - */ - public Rsp2AmPort getAmPort() - { - return getTunerParameters().getAmPort(); - } - - /** - * Sets the AM port - * @param port to select - * @throws SDRPlayException if there is an error - */ - public void setAmPort(Rsp2AmPort port) throws SDRPlayException - { - getTunerParameters().setAmPort(port); - update(UpdateReason.RSP2_AM_PORT_SELECT); - } - - /** - * Antenna selection - */ - public Rsp2Antenna getAntenna() - { - return getTunerParameters().getAntenna(); - } - - /** - * Sets the antenna - * @param antenna to select - * @throws SDRPlayException if there is an error - */ - public void setAntenna(Rsp2Antenna antenna) throws SDRPlayException - { - getTunerParameters().setAntenna(antenna); - update(UpdateReason.RSP2_ANTENNA_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoDevice.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoDevice.java deleted file mode 100644 index a94b7e41..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoDevice.java +++ /dev/null @@ -1,208 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.RspDuoCompositeParameters; -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; - -/** - * RSPduo Device - */ -public class RspDuoDevice extends Device -{ - private RspDuoTuner mTuner; - - /** - * Constructs an SDRPlay RSPduo device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - RspDuoDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - /** - * Tuner - * @return tuner - * @throws SDRPlayException if there is an error - */ - @Override - public RspDuoTuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner == null) - { - if(getTunerSelect().equals(TunerSelect.TUNER_1)) - { - mTuner = new RspDuoTuner1(RspDuoDevice.this, getAPI(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - else - { - mTuner = new RspDuoTuner2(RspDuoDevice.this, getAPI(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerBParameters(), - getCompositeParameters().getControlBParameters()); - } - } - - return mTuner; - } - - /** - * Selected tuner(s). - */ - @Override - public TunerSelect getTunerSelect() - { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); - } - - /** - * Sets the selected tuner(s) - */ - public void setTunerSelect(TunerSelect tunerSelect) - { - sdrplay_api_DeviceT.tuner(getDeviceMemorySegment(), tunerSelect.getValue()); - } - - /** - * RSPduo mode - */ - public RspDuoMode getRspDuoMode() - { - return getDeviceStruct().getRspDuoMode(); - } - - /** - * Sets RSPduo mode. Note this must be set before selecting the device for use. - * @param mode to set - * @throws SDRPlayException if the device has already been selected - */ - public void setRspDuoMode(RspDuoMode mode) throws SDRPlayException - { - if(isSelected()) - { - throw new SDRPlayException("RSPduo device is already selected. Mode can only be set/changed before the " + - "device is selected for use."); - } - - getDeviceStruct().setRspDuoMode(mode); - } - - /** - * Sample rate when in master/slave mode - */ - public double getRspDuoSampleFrequency() - { - return getDeviceStruct().getRspDuoSampleFrequency(); - } - - /** - * Sets the sample rate when the device is configured for master mode. - * @param frequency - */ - public void setRspDuoSampleFrequency(double frequency) throws SDRPlayException - { - if(!getRspDuoMode().equals(RspDuoMode.MASTER)) - { - throw new SDRPlayException("This method can only be used to set the overall sample rate when the RSPduo " + - "device is configured for master mode."); - } - - getDeviceStruct().setRspDuoSampleFrequency(frequency); - } - - /** - * Sets the decimation factor for the final sample rate. - * @param decimation as an integer multiple of two (e.g. 1, 2, 4, 8) - * @throws SDRPlayException if there is an error while setting decimation - */ - @Override - public void setDecimation(Decimate decimation) throws SDRPlayException - { - if(getTunerSelect() == TunerSelect.TUNER_1) - { - getCompositeParameters().getControlAParameters().getDecimation().setDecimationFactor(decimation.getValue()); - getCompositeParameters().getControlAParameters().getDecimation().setEnabled(decimation.isEnabled()); - update(getTunerSelect(), UpdateReason.CONTROL_DECIMATION); - } - else if(getTunerSelect() == TunerSelect.TUNER_2) - { - getCompositeParameters().getControlBParameters().getDecimation().setDecimationFactor(decimation.getValue()); - getCompositeParameters().getControlBParameters().getDecimation().setEnabled(decimation.isEnabled()); - update(getTunerSelect(), UpdateReason.CONTROL_DECIMATION); - } - else if(getTunerSelect() == TunerSelect.TUNER_BOTH) - { - //Dual-synchronized tuner mode ... let the parent Device class set the value - super.setDecimation(decimation); - } - } - - /** - * Sets the IF mode when tuner 2 is selected in single-tuner mode. - * @param ifMode to set - */ - public void setIfModeTuner2(IfMode ifMode) - { - getCompositeParameters().getTunerBParameters().setIfMode(ifMode); - } - - /** - * Sets the LO mode when tuner 2 is selected in single-tuner mode. - * @param loMode to set - */ - public void setLoModeTuner2(LoMode loMode) - { - getCompositeParameters().getTunerBParameters().setLoMode(loMode); - } - - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("SDRPplay Device").append("\n"); - sb.append("\tType: " + getDeviceType()).append("\n"); - sb.append("\tSerial Number: " + getSerialNumber()).append("\n"); - sb.append("\tTuner: " + getTunerSelect()).append("\n"); - sb.append("\tRSP Duo: " + getRspDuoMode()).append("\n"); - sb.append("\tRSP Duo Sample Rate: " + getRspDuoSampleFrequency()).append("\n"); - sb.append("\tSelected: " + isSelected()); - if(hasCompositeParameters()) - { - sb.append("\t").append(getCompositeParameters()); - } - - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoMode.java deleted file mode 100644 index f51f12c1..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoMode.java +++ /dev/null @@ -1,75 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * RSP-Duo Mode - */ -public enum RspDuoMode -{ - SINGLE_TUNER(sdrplay_api_h.sdrplay_api_RspDuoMode_Single_Tuner(), "SINGLE TUNER"), - DUAL_TUNER(sdrplay_api_h.sdrplay_api_RspDuoMode_Dual_Tuner(), "DUAL TUNER"), - MASTER(sdrplay_api_h.sdrplay_api_RspDuoMode_Master(), "MASTER"), - SLAVE(sdrplay_api_h.sdrplay_api_RspDuoMode_Slave(), "SLAVE"), - UNKNOWN(sdrplay_api_h.sdrplay_api_RspDuoMode_Unknown(), "UNKNOWN"); - - private int mValue; - private String mDescription; - - RspDuoMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UKNOWN if the code is not recognized - */ - public static RspDuoMode fromValue(int value) - { - for(RspDuoMode status: RspDuoMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner.java deleted file mode 100644 index 6fe8ac3d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner.java +++ /dev/null @@ -1,105 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDuoDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoTunerParameters; - -/** - * RSPduo Tuner - */ -public abstract class RspDuoTuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public RspDuoTuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, RspDuoDeviceParameters deviceParameters, - RspDuoTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRFNotch() - { - return getTunerParameters().isRfNotch(); - } - - /** - * Enables or disables the RF notch - * @param enable setting - * @throws SDRPlayException if there is an error - */ - public void setRfNotch(boolean enable) throws SDRPlayException - { - getTunerParameters().setRfNotch(enable); - update(UpdateReason.RSP_DUO_RF_NOTCH_CONTROL); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return getTunerParameters().isRfDabNotch(); - } - - /** - * Enables or disables the RF DAB notch - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setRfDabNotch(boolean enable) throws SDRPlayException - { - getTunerParameters().setRfDabNotch(enable); - update(UpdateReason.RSP_DUO_RF_DAB_NOTCH_CONTROL); - } - - /** - * Indicates if the external reference output is enabled. - */ - public boolean isExternalReferenceOutput() - { - return getDeviceParameters().isExternalReferenceOutput(); - } - - /** - * Enables or disables the external reference output - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setExternalReferenceOutput(boolean enable) throws SDRPlayException - { - getDeviceParameters().setExternalReferenceOutput(enable); - update(UpdateReason.RSP_DUO_EXT_REF_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner1.java deleted file mode 100644 index bbdd339e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner1.java +++ /dev/null @@ -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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDuoDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoAmPort; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoTunerParameters; - -/** - * RSPduo Tuner 1 - */ -public class RspDuoTuner1 extends RspDuoTuner -{ - /** - * Constructs an instance - * - * @param device parent for this tuner - * @param sdrplay api - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public RspDuoTuner1(Device device, SDRplay sdrplay, RspDuoDeviceParameters deviceParameters, - RspDuoTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, TunerSelect.TUNER_1, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates which AM port is selected - */ - public RspDuoAmPort getAmPort() - { - return getTunerParameters().getTuner1AmPort(); - } - - /** - * Selects the AM port to use - * @param port to use - * @throws SDRPlayException if there is an error - */ - public void setAmPort(RspDuoAmPort port) throws SDRPlayException - { - getTunerParameters().setTuner1AmPort(port); - update(UpdateReason.RSP_DUO_AM_PORT_SELECT); - } - - /** - * Indicates if the AM notch is enabled - */ - public boolean isAmNotch() - { - return getTunerParameters().isTuner1AmNotch(); - } - - /** - * Enables or disables the AM notch - * @param enable for the notch - * @throws SDRPlayException if there is an error - */ - public void setAmNotch(boolean enable) throws SDRPlayException - { - getTunerParameters().setTuner1AmNotch(enable); - update(UpdateReason.RSP_DUO_TUNER_1_AM_NOTCH_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner2.java deleted file mode 100644 index 254757b7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDuoTuner2.java +++ /dev/null @@ -1,67 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDuoDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoTunerParameters; - -/** - * RSPduo Tuner 2 - */ -public class RspDuoTuner2 extends RspDuoTuner -{ - /** - * Constructs an instance - * - * @param device parent for this tuner - * @param sdrplay api - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public RspDuoTuner2(Device device, SDRplay sdrplay, RspDuoDeviceParameters deviceParameters, - RspDuoTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, TunerSelect.TUNER_2, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return getTunerParameters().isBiasT(); - } - - /** - * Enables or disables the Bias-T - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setBiasT(boolean enable) throws SDRPlayException - { - getTunerParameters().setBiasT(enable); - update(UpdateReason.RSP_DUO_BIAS_T_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxDevice.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxDevice.java deleted file mode 100644 index 68676409..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxDevice.java +++ /dev/null @@ -1,62 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.RspDxCompositeParameters; - -/** - * RSPdx Device - */ -public class RspDxDevice extends Device -{ - private RspDxTuner mTuner1; - - /** - * Constructs an SDRPlay RSPdx device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - RspDxDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - - @Override - public RspDxTuner getTuner() throws SDRPlayException - { - if(!isSelected()) - { - throw new SDRPlayException("Device must be selected before accessing the tuner"); - } - - if(mTuner1 == null) - { - mTuner1 = new RspDxTuner(RspDxDevice.this, getAPI(), getTunerSelect(), - getCompositeParameters().getDeviceParameters(), getCompositeParameters().getTunerAParameters(), - getCompositeParameters().getControlAParameters()); - } - - return mTuner1; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxTuner.java deleted file mode 100644 index 85e3773f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspDxTuner.java +++ /dev/null @@ -1,164 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDxDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.HdrModeBandwidth; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxAntenna; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxTunerParameters; - -/** - * RSPdx Tuner - */ -public class RspDxTuner extends RspTuner -{ - /** - * Constructs an instance - * @param device parent for this tuner - * @param sdrplay api - * @param tunerSelect to specify which tuner - * @param deviceParameters for this device - * @param tunerParameters for this tuner - * @param controlParameters for this device - */ - public RspDxTuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, RspDxDeviceParameters deviceParameters, - RspDxTunerParameters tunerParameters, ControlParameters controlParameters) - { - super(device, sdrplay, tunerSelect, deviceParameters, tunerParameters, controlParameters); - } - - /** - * Indicates if HDR mode is enabled - */ - public boolean isHdrMode() - { - return getDeviceParameters().isHdr(); - } - - /** - * Enables or disables HDR mode - * @param enable mode - * @throws SDRPlayException if there is an error - */ - public void setHdrMode(boolean enable) throws SDRPlayException - { - getDeviceParameters().setHdr(enable); - update(UpdateReason.EXTENSION_RSP_DX_HDR_ENABLE); - } - - /** - * HDR mode bandwidth - */ - public HdrModeBandwidth getHdrModeBandwidth() - { - return getTunerParameters().getHdrModeBandwidth(); - } - - /** - * Sets HDR mode bandwidth - * @param bandwidth to select - * @throws SDRPlayException if there is an error - */ - public void setHdrModeBandwidth(HdrModeBandwidth bandwidth) throws SDRPlayException - { - getTunerParameters().setHdrModeBandwidth(bandwidth); - update(UpdateReason.EXTENSION_RSP_DX_HDR_BANDWIDTH); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return getDeviceParameters().isRfNotch(); - } - - /** - * Enables or disables the RF notch - * @param enable setting - * @throws SDRPlayException if there is an error - */ - public void setRfNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRfNotch(enable); - update(UpdateReason.EXTENSION_RSP_DX_RF_NOTCH_CONTROL); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return getDeviceParameters().isRfDabNotch(); - } - - /** - * Enables or disables the RF DAB notch - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setRfDabNotch(boolean enable) throws SDRPlayException - { - getDeviceParameters().setRfDabNotch(enable); - update(UpdateReason.EXTENSION_RSP_DX_RF_DAB_NOTCH_CONTROL); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return getDeviceParameters().isBiasT(); - } - - /** - * Enables or disables the Bias-T - * @param enable value - * @throws SDRPlayException if there is an error - */ - public void setBiasT(boolean enable) throws SDRPlayException - { - getDeviceParameters().setBiasT(enable); - update(UpdateReason.EXTENSION_RSP_DX_BIAS_T_CONTROL); - } - - /** - * Antenna selection - */ - public RspDxAntenna getAntenna() - { - return getDeviceParameters().getRspDxAntenna(); - } - - /** - * Sets the antenna selection - * @param antenna to select - * @throws SDRPlayException if there is an error - */ - public void setAntenna(RspDxAntenna antenna) throws SDRPlayException - { - getDeviceParameters().setRspDxAntenna(antenna); - update(UpdateReason.EXTENSION_RSP_DX_ANTENNA_CONTROL); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspTuner.java deleted file mode 100644 index d12f20da..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/RspTuner.java +++ /dev/null @@ -1,381 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.async.AsyncUpdateFuture; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.DeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Bandwidth; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Gain; -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.parameter.tuner.TunerParameters; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Abstract RSP device tuner - * @param RSP device implementation - */ -public abstract class RspTuner -{ - private static final Logger mLog = LoggerFactory.getLogger(RspTuner.class); - private final SDRplay mSDRplay; - private final Device mDevice; - private final TunerSelect mTunerSelect; - private final D mDeviceParameters; - private final T mTunerParameters; - private final ControlParameters mControlParameters; - - RspTuner(Device device, SDRplay sdrplay, TunerSelect tunerSelect, D deviceParameters, T tunerParameters, - ControlParameters controlParameters) - { - mDevice = device; - mSDRplay = sdrplay; - mTunerSelect = tunerSelect; - mDeviceParameters = deviceParameters; - mTunerParameters = tunerParameters; - mControlParameters = controlParameters; - } - - /** - * SDRplay API - */ - private SDRplay getSDRplay() - { - return mSDRplay; - } - - /** - * Parent device for this tuner - */ - private Device getDevice() - { - return mDevice; - } - - /** - * Selected tuner - */ - public TunerSelect getTunerSelect() - { - return mTunerSelect; - } - - /** - * Device parameters - */ - protected D getDeviceParameters() - { - return mDeviceParameters; - } - - /** - * Tuner parameters for the selected tuner - */ - public T getTunerParameters() - { - return mTunerParameters; - } - - /** - * Control parameters for the selected tuner - */ - protected ControlParameters getControlParameters() - { - return mControlParameters; - } - - /** - * Convenience method for notifying the API that parameters for the device have been updated, when the device is - * initialized. - * - * @param updateReasons indicating what has been updated - * @throws SDRPlayException if there is an error - */ - protected void update(UpdateReason... updateReasons) throws SDRPlayException - { - getDevice().update(getTunerSelect(), updateReasons); - } - - /** - * Convenience method for notifying the device that a parameter for this tuner have been updated. - * - * Note: the asynchronous device event responses are limited to Frequency, Gain and Sample Rate. For example, - * if you update the RSPduo DAB Notch parameter, it will generate a Gain change notification, so we submit - * an async update for the DAB Notch, but anticipate a Gain update response. - * - * @param updateReason indicating what has been updated - * @param expectedResponse that will be received indicating that the async operation is completed. - */ - protected AsyncUpdateFuture updateAsync(UpdateReason updateReason, UpdateReason expectedResponse) - { - return getDevice().updateAsync(getTunerSelect(), updateReason, expectedResponse); - } - - /** - * Current tuner bandwidth - */ - public Bandwidth getBandwidth() - { - return getTunerParameters().getBandwidth(); - } - - /** - * Sets tuner bandwidth - * @param bandwidth to apply - * @throws SDRPlayException if there is an error - */ - public void setBandwidth(Bandwidth bandwidth) throws SDRPlayException - { - getTunerParameters().setBandwidth(bandwidth); - update(UpdateReason.TUNER_BANDWIDTH_TYPE); - } - - /** - * Center frequency for the tuner - */ - public long getFrequency() - { - return (long) getTunerParameters().getRfFrequency().getFrequency(); - } - - /** - * Requests to set the center frequency for the tuner asynchronously. - * - * Note: the API supports the notion of synchronous frequency updates, but in testing I found that you cannot - * submit a second frequency change update request until a previously submitted frequency change update - * operation had completed, otherwise it would generate a fail status. Therefore, this is method is strictly - * an async operation. - * - * @param frequency in Hertz - * @return future that can be monitored for completion of the set frequency operation. - */ - public AsyncUpdateFuture setFrequency(long frequency) - { - try - { - getTunerParameters().getRfFrequency().setFrequency(frequency, false); - return updateAsync(UpdateReason.TUNER_FREQUENCY_RF, UpdateReason.TUNER_FREQUENCY_RF); - } - catch(SDRPlayException se) - { - AsyncUpdateFuture future = new AsyncUpdateFuture(getTunerSelect(), UpdateReason.TUNER_FREQUENCY_RF, - UpdateReason.TUNER_FREQUENCY_RF); - future.setError(se); - return future; - } - } - - /** - * Sets the LNA state and Baseband Gain Reduction values. - * @param lna state (varies by tuner and frequency range) - * @param basebandGainReduction in range 20-59 dB - * @throws SDRPlayException - */ - public void setGain(int lna, int basebandGainReduction) throws SDRPlayException - { - getTunerParameters().getGain().setLNA(lna); - getTunerParameters().getGain().setGainReductionDb(basebandGainReduction); - update(UpdateReason.TUNER_GAIN_REDUCTION); - } - - /** - * Sets the automatic gain contral (AGC) mode - * - * @param mode to set - * @throws SDRPlayException if there is an error - */ - public void setAGC(AgcMode mode) throws SDRPlayException - { - getControlParameters().getAgc().setAgcMode(mode); - update(UpdateReason.CONTROL_AGC); - } - - /** - * AGC Mode - */ - public AgcMode getAGC() - { - return getControlParameters().getAgc().getAgcMode(); - } - - /** - * Gain for the tuner. - */ - public Gain getGain() - { - return getTunerParameters().getGain(); - } - - /** - * Enables or disables DC correction - * - * @param enable true or false - * @throws SDRPlayException if there is an error - */ - public void setDCCorrection(boolean enable) throws SDRPlayException - { - getControlParameters().getDcOffset().setDC(enable); - update(UpdateReason.CONTROL_DC_OFFSET_IQ_IMBALANCE); - } - - /** - * Enables or disables IQ imbalance correction - * - * @param enable true or false - * @throws SDRPlayException if there is an error - */ - public void setIQCorrection(boolean enable) throws SDRPlayException - { - getControlParameters().getDcOffset().setIQ(enable); - update(UpdateReason.CONTROL_DC_OFFSET_IQ_IMBALANCE); - } - - /** - * Sets or updates the parts per million (ppm) frequency correction - * - * @param ppm value - * @throws SDRPlayException - */ - public AsyncUpdateFuture setPPM(double ppm) throws SDRPlayException - { - getDeviceParameters().setPPM(ppm); - - //Note: async ppm updates effect both frequency and sample rate, so we expect the completion of the - //operation will be first FREQUENCY and then SAMPLE RATE, so we watch for sample rate. - return updateAsync(UpdateReason.DEVICE_PPM, UpdateReason.DEVICE_SAMPLE_RATE); - } - - /** - * Parts per million (PPM) frequency correction value - * - * @return ppm value - */ - public double getPPM() - { - return getDeviceParameters().getPPM(); - } - - /** - * Perform synchronous update - * - * @param sampleNumber value - * @param period value - * @throws SDRPlayException if there is an error - */ - public void setSynchronousUpdate(int sampleNumber, int period) throws SDRPlayException - { - getDeviceParameters().getSynchronousUpdate().set(sampleNumber, period); - update(UpdateReason.DEVICE_SYNC_UPDATE); - } - - /** - * Resets device functions to default - * - * @param frequency to reset - * @param sampleRate to reset - * @param gain to reset - * @throws SDRPlayException if there is an error - */ - public void reset(boolean frequency, boolean sampleRate, boolean gain) throws SDRPlayException - { - getDeviceParameters().getResetFlags().resetGain(gain); - getDeviceParameters().getResetFlags().resetFrequency(frequency); - getDeviceParameters().getResetFlags().resetSampleRate(sampleRate); - update(UpdateReason.DEVICE_RESET_FLAGS); - } - - /** - * Resets the frequency. - * - * @param frequency true to reset - * @throws SDRPlayException if there is an error - */ - public void resetFrequency(boolean frequency) throws SDRPlayException - { - reset(frequency, false, false); - } - - /** - * Resets the sample rate. - * - * @param sampleRate true to reset - * @throws SDRPlayException if there is an error - */ - public void resetSampleRate(boolean sampleRate) throws SDRPlayException - { - reset(false, sampleRate, false); - } - - /** - * Resets the gain (reduction). - * - * @param gain true to reset - * @throws SDRPlayException if there is an error - */ - public void resetGain(boolean gain) throws SDRPlayException - { - reset(false, false, gain); - } - - /** - * IF mode (type) - */ - public IfMode getIfMode() - { - return getTunerParameters().getIfMode(); - } - - /** - * Sets the IF mode (type) - * @param mode to set - * @throws SDRPlayException if there is an error - */ - public void setIfMode(IfMode mode) throws SDRPlayException - { - getTunerParameters().setIfMode(mode); - update(UpdateReason.TUNER_IF_TYPE); - } - - /** - * Local Oscillator (LO) mode - * @return mode - */ - public LoMode getLoMode() - { - return getTunerParameters().getLoMode(); - } - - /** - * Sets the Local Oscillator (LO) mode - * @param mode to set - * @throws SDRPlayException if there is an error - */ - public void setLoMode(LoMode mode) throws SDRPlayException - { - getTunerParameters().setLoMode(mode); - update(UpdateReason.TUNER_LO_MODE); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/TunerSelect.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/TunerSelect.java deleted file mode 100644 index 2f48f7e5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/TunerSelect.java +++ /dev/null @@ -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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Tuner Select - */ -public enum TunerSelect -{ - TUNER_1(sdrplay_api_h.sdrplay_api_Tuner_A(), "TUNER 1"), - TUNER_2(sdrplay_api_h.sdrplay_api_Tuner_B(), "TUNER 2"), - TUNER_BOTH(sdrplay_api_h.sdrplay_api_Tuner_Both(), "TUNER 1 & 2"), - NEITHER(sdrplay_api_h.sdrplay_api_Tuner_Neither(), "NEITHER"); - - private int mValue; - private String mDescription; - - TunerSelect(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or NEITHER if the code is not recognized - */ - public static TunerSelect fromValue(int value) - { - for(TunerSelect status: TunerSelect.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return NEITHER; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/UnknownDevice.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/UnknownDevice.java deleted file mode 100644 index c006eecd..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/device/UnknownDevice.java +++ /dev/null @@ -1,46 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRplay; - -/** - * Unknown or Unrecognized SDRplay Device - */ -public class UnknownDevice extends Device -{ - /** - * Constructs an Unknown SDRPlay device from the foreign memory segment - * - * @param sdrPlay api instance that created this device - * @param deviceStruct parser - */ - UnknownDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) - { - super(sdrPlay, deviceStruct); - } - - @Override - public RspTuner getTuner() throws SDRPlayException - { - throw new SDRPlayException("Unrecognized device type. Cannot construct tuner"); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/DebugLevel.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/DebugLevel.java deleted file mode 100644 index fe6f40ad..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/DebugLevel.java +++ /dev/null @@ -1,76 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.error; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Debug Level - */ -public enum DebugLevel -{ - DISABLE(sdrplay_api_h.sdrplay_api_DbgLvl_Disable(), "DISABLE"), - VERBOSE(sdrplay_api_h.sdrplay_api_DbgLvl_Verbose(), "VERBOSE"), - WARNING(sdrplay_api_h.sdrplay_api_DbgLvl_Warning(), "WARNING"), - ERROR(sdrplay_api_h.sdrplay_api_DbgLvl_Error(), "ERROR"), - MESSAGE(sdrplay_api_h.sdrplay_api_DbgLvl_Message(), "MESSAGE"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - DebugLevel(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static DebugLevel fromValue(int value) - { - for(DebugLevel status: DebugLevel.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/ErrorInformation.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/ErrorInformation.java deleted file mode 100644 index 5fd8346c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/error/ErrorInformation.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.error; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ErrorInfoT; -import java.lang.foreign.MemorySegment; - -/** - * Error Information structure (sdrplay_api_ErrorInfoT) - */ -public class ErrorInformation -{ - 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(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() - { - return mFile; - } - - public String getFunction() - { - return mFunction; - } - - public int getLine() - { - return mLine; - } - - public String getMessage() - { - return mMessage; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Error Information:").append("\n"); - sb.append("\t File: ").append(getFile()).append("\n"); - sb.append("\tFunction: ").append(getFunction()).append("\n"); - sb.append("\t Line: ").append(getLine()).append("\n"); - sb.append("\t Message: ").append(getMessage()).append("\n"); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParameters.java deleted file mode 100644 index 015ce733..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParameters.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.DeviceParameters; -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; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * Composite Device Parameters structure (sdrplay_api_DeviceParamsT) providing access to the device parameters and - * the tuner 1 parameter. Tuner 2 parameters are only accessible via the RSPduo subclass implementation. - * - * Note: subclass implementations will constrain access to the appropriate sub-structures of the DeviceParamsT - * structure for each specific device. - */ -public class CompositeParameters -{ - 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 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 deviceParamsT, Arena arena) - { - MemorySegment addressDevParams = sdrplay_api_DeviceParamsT.devParams(deviceParamsT); - MemorySegment devParams = addressDevParams.reinterpret(sdrplay_api_DevParamsT.sizeof(), arena, null); - mDeviceParameters = (D) DeviceParametersFactory.create(deviceType, devParams); - - 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 tunerACtrlParams = rxA.asSlice(sdrplay_api_RxChannelParamsT.ctrlParams$offset(), sdrplay_api_ControlParamsT.sizeof()); - mControlAParameters = new ControlParameters(tunerACtrlParams); - } - - /** - * Device parameters - */ - public D getDeviceParameters() - { - return mDeviceParameters; - } - - /** - * Tuner A Parameters. - * - * Note: this is normally mapped to tuner 1. In the RSPduo, this is mapped to Tuner 1 or Tuner 2, according to how - * the user has setup the TunerSelect. - */ - public T getTunerAParameters() - { - return mTunerAParameters; - } - - /** - * Tuner A Control Parameters - * - * Note: this is normally mapped to tuner 1. In the RSPduo, this is mapped to Tuner 1 or Tuner 2, according to how - * the user has setup the TunerSelect. - */ - public ControlParameters getControlAParameters() - { - return mControlAParameters; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Composite Parameters\n"); - sb.append("\tDevice Parameters:\n").append(getDeviceParameters()).append("\n"); - sb.append("\tTuner A Parameters:\n").append(getTunerAParameters()).append("\n"); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParametersFactory.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParametersFactory.java deleted file mode 100644 index fe2edcb3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/CompositeParametersFactory.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * Creates a composite parameters instance for a device type - */ -public class CompositeParametersFactory -{ - /** - * Creates a composite parameters instance for the specified device type - * @param version of the api - * @param deviceType to create - * @param deviceParams sdrplay_api_DeviceParamsT structure - * @param arena to allocate additional memory structures - * @return instance - */ - public static CompositeParameters create(Version version, DeviceType deviceType, MemorySegment deviceParams, - Arena arena) - { - switch(deviceType) - { - case RSP1 -> { - return new Rsp1CompositeParameters(version, deviceParams, arena); - } - case RSP1A -> { - return new Rsp1aCompositeParameters(version, deviceParams, arena); - } - case RSP1B -> { - return new Rsp1bCompositeParameters(version, deviceParams, arena); - } - case RSP2 -> { - return new Rsp2CompositeParameters(version, deviceParams, arena); - } - case RSPduo -> { - return new RspDuoCompositeParameters(version, deviceParams, arena); - } - case RSPdx, RSPdxR2 -> { - return new RspDxCompositeParameters(version, deviceParams, arena); - } - } - - throw new IllegalArgumentException("Unrecognized device type: " + deviceType); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1CompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1CompositeParameters.java deleted file mode 100644 index a06ed54c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1CompositeParameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1DeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1TunerParameters; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSP1 Composite parameters (device and tuner) - */ -public class Rsp1CompositeParameters extends CompositeParameters -{ - /** - * Constructs an instance from the foreign memory segment - * - * @param version of the API - * @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 deviceParams, Arena arena) - { - super(version, DeviceType.RSP1, deviceParams, arena); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1aCompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1aCompositeParameters.java deleted file mode 100644 index 09cd7015..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1aCompositeParameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1aDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1aTunerParameters; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSP1A Composite parameters (device and tuner) - */ -public class Rsp1aCompositeParameters extends CompositeParameters -{ - /** - * Constructs an instance from the foreign memory segment - * - * @param version of the API - * @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 deviceParams, Arena arena) - { - super(version, DeviceType.RSP1A, deviceParams, arena); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1bCompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1bCompositeParameters.java deleted file mode 100644 index d2224493..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp1bCompositeParameters.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp1aDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp1aTunerParameters; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSP1B Composite parameters (device and tuner) - * - * Note: RSP1B uses RSP1A device and tuner parameters structures. - */ -public class Rsp1bCompositeParameters extends CompositeParameters -{ - /** - * Constructs an instance from the foreign memory segment - * - * @param version of the API - * @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 deviceParams, Arena arena) - { - super(version, DeviceType.RSP1B, deviceParams, arena); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp2CompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp2CompositeParameters.java deleted file mode 100644 index 642d0daf..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/Rsp2CompositeParameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.Rsp2DeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2TunerParameters; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSP2 Composite parameters (device and tuner) - */ -public class Rsp2CompositeParameters extends CompositeParameters -{ - /** - * Constructs an instance from the foreign memory segment - * - * @param version of the API - * @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 deviceParams, Arena arena) - { - super(version, DeviceType.RSP2, deviceParams, arena); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDuoCompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDuoCompositeParameters.java deleted file mode 100644 index 018e6011..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDuoCompositeParameters.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDuoDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoTunerParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParametersFactory; -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; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSPduo Composite parameters (device and two tuners) - */ -public class RspDuoCompositeParameters extends CompositeParameters -{ - 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 deviceParams structure in foreign memory - * @param arena for allocating additional memory segments for the sub-structures. - */ - public RspDuoCompositeParameters(Version version, MemorySegment deviceParams, Arena arena) - { - super(version, DeviceType.RSPduo, deviceParams, arena); - - 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 rxChannelBCtrlParams = sdrplay_api_RxChannelParamsT.ctrlParams(rxChannelB); - mControlBParameters = new ControlParameters(rxChannelBCtrlParams); - } - - /** - * Tuner B Tuner Parameters - */ - public RspDuoTunerParameters getTunerBParameters() - { - return mTunerBParameters; - } - - /** - * Tuner B Control Parameters - */ - public ControlParameters getControlBParameters() - { - return mControlBParameters; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Device Composite Parameters\n"); - sb.append("\tDevice Parameters:\n").append(getDeviceParameters()).append("\n"); - sb.append("\tTuner Channel A:\n").append(getTunerAParameters()).append("\n"); - sb.append("\tTuner Channel B:\n").append(getTunerBParameters()).append("\n"); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDxCompositeParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDxCompositeParameters.java deleted file mode 100644 index c177c90a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/composite/RspDxCompositeParameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.RspDxDeviceParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxTunerParameters; -import java.lang.foreign.Arena; -import java.lang.foreign.MemorySegment; - -/** - * RSPdx Composite parameters (device and receiver) - */ -public class RspDxCompositeParameters extends CompositeParameters -{ - /** - * Constructs an instance from the foreign memory segment - * - * @param version of the API - * @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 deviceParams, Arena arena) - { - super(version, DeviceType.RSPdx, deviceParams, arena); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AdsbMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AdsbMode.java deleted file mode 100644 index 62f72e43..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AdsbMode.java +++ /dev/null @@ -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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * ADSB Mode (for ADS-B decoding applications) - */ -public enum AdsbMode -{ - NO_DECIMATION_LOWPASS(sdrplay_api_h.sdrplay_api_ADSB_NO_DECIMATION_LOWPASS(), "No Decimation-Lowpass"), - NO_DECIMATION_BANDPASS_2_MHZ(sdrplay_api_h.sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ(), "No Decimation-Bandpass 2 MHz"), - NO_DECIMATION_BANDPASS_3_MHZ(sdrplay_api_h.sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ(), "No Decimation-Bandpass 3 MHz"), - DECIMATION(sdrplay_api_h.sdrplay_api_ADSB_DECIMATION(), "Decimation"); - - private int mValue; - private String mDescription; - - AdsbMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or DECIMATION if the code is not recognized - */ - public static AdsbMode fromValue(int value) - { - for(AdsbMode status: AdsbMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return DECIMATION; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Agc.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Agc.java deleted file mode 100644 index 3ef08406..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Agc.java +++ /dev/null @@ -1,153 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_AgcT; -import java.lang.foreign.MemorySegment; - -/** - * AGC structure (sdrplay_api_AgcT) - */ -public class Agc -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from the foreign memory segment - */ - public Agc(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * AGC Control (mode) - */ - public AgcMode getAgcMode() - { - return AgcMode.fromValue(sdrplay_api_AgcT.enable(getMemorySegment())); - } - - /** - * Sets AGC Control (mode) - */ - public void setAgcMode(AgcMode mode) - { - sdrplay_api_AgcT.enable(getMemorySegment(), mode.getValue()); - } - - /** - * Set point dBfs - */ - public int getSetPointDbfs() - { - return sdrplay_api_AgcT.setPoint_dBfs(getMemorySegment()); - } - - /** - * Sets the set point dBfs - */ - public void setSetPointDbfs(int setPointDbfs) - { - sdrplay_api_AgcT.setPoint_dBfs(getMemorySegment(), setPointDbfs); - } - - /** - * Attack rate in milliseconds - */ - public int getAttackMs() - { - return sdrplay_api_AgcT.attack_ms(getMemorySegment()); - } - - /** - * Sets the attack rate in milliseconds - */ - public void setAttackMs(int attackMs) - { - sdrplay_api_AgcT.attack_ms(getMemorySegment(), (short)attackMs); - } - - /** - * Decay rate in milliseconds - */ - public int getDecayMs() - { - return sdrplay_api_AgcT.decay_ms(getMemorySegment()); - } - - /** - * Sets the decay rate in milliseconds - */ - public void setDecayMs(int decayMs) - { - sdrplay_api_AgcT.decay_ms(getMemorySegment(), (short)decayMs); - } - - /** - * Decay delay rate in milliseconds - */ - public int getDecayDelayMs() - { - return sdrplay_api_AgcT.decay_delay_ms(getMemorySegment()); - } - - /** - * Sets the decay delay rate in milliseconds - */ - public void setDecayDelayMs(int decayDelayMs) - { - sdrplay_api_AgcT.decay_delay_ms(getMemorySegment(), (short)decayDelayMs); - } - - /** - * Decay threshold in dB - */ - public int getDecayThresholdDb() - { - return sdrplay_api_AgcT.decay_threshold_dB(getMemorySegment()); - } - - /** - * Sets the decay threshold in dB - */ - public void setDecayThresholdDb(int decayThresholdDb) - { - sdrplay_api_AgcT.decay_threshold_dB(getMemorySegment(), (short)decayThresholdDb); - } - - /** - * Sets the changes to be applied as a synchronous update - */ - 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(getMemorySegment(), Flag.of(syncUpdate)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AgcMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AgcMode.java deleted file mode 100644 index a861b4fd..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/AgcMode.java +++ /dev/null @@ -1,98 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; -import java.util.EnumSet; - -/** - * Automatic Gain Control (AGC) Control (mode) - */ -public enum AgcMode -{ - //Deprecated modes ... only use the ENABLE or DISABLE, in conjunction with the - AGC_100_HZ(sdrplay_api_h.sdrplay_api_AGC_100HZ(), "Deprecated - 100 Hz"), - AGC_50_HZ(sdrplay_api_h.sdrplay_api_AGC_50HZ(), "Deprecated 50 Hz"), - AGC_5_HZ(sdrplay_api_h.sdrplay_api_AGC_5HZ(), "Deprecated 5 Hz"), - - DISABLE(sdrplay_api_h.sdrplay_api_AGC_DISABLE(), "DISABLE"), - ENABLE(sdrplay_api_h.sdrplay_api_AGC_CTRL_EN(), "ENABLE"); - - private int mValue; - private String mDescription; - - AgcMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - public static EnumSet SUPPORTED_MODES = EnumSet.of(ENABLE, DISABLE); - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Indicates if the mode is a supported mode. - * @return true if it's a supported mode. - */ - public boolean isSupported() - { - return SUPPORTED_MODES.contains(this); - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or DISABLE if the code is not recognized - */ - public static AgcMode fromValue(int value) - { - for(AgcMode status: AgcMode.values()) - { - if(status.getValue() == value) - { - //legacy support in case some users had the deprecated values stored in their tuner configs. In - //this situation we return ENABLED instead of one of these deprecated values. - if(status.isSupported()) - { - return status; - } - else - { - return ENABLE; - } - } - } - - return DISABLE; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/ControlParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/ControlParameters.java deleted file mode 100644 index 012bef79..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/ControlParameters.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ControlParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Control Parameters structure (sdrplay_api_ControlParamsT) - */ -public class ControlParameters -{ - 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 controlParams) - { - 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 getControlParams() - { - return mControlParams; - } - - /** - * DC offset settings for DC and IQ correction - */ - public DcOffset getDcOffset() - { - return mDcOffset; - } - - /** - * Decimation settings - */ - public Decimation getDecimation() - { - return mDecimation; - } - - /** - * Automatic Gain Control (AGC) settings - */ - public Agc getAgc() - { - return mAgc; - } - - /** - * Current ADSB mode - */ - public AdsbMode getAdsbMode() - { - return AdsbMode.fromValue(sdrplay_api_ControlParamsT.adsbMode(getControlParams())); - } - - /** - * Sets ADSB mode - */ - public void setAdsbMode(AdsbMode mode) - { - sdrplay_api_ControlParamsT.adsbMode(getControlParams(), mode.getValue()); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/DcOffset.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/DcOffset.java deleted file mode 100644 index b627beca..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/DcOffset.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DcOffsetT; -import java.lang.foreign.MemorySegment; - -/** - * DC Offset structure (sdrplay_api_DCOffsetT) - */ -public class DcOffset -{ - private final MemorySegment mDCOffset; - - /** - * Constructs an instance from the foreign memory segment - */ - public DcOffset(MemorySegment dCOffset) - { - mDCOffset = dCOffset; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getDCOffset() - { - return mDCOffset; - } - - /** - * Indicates if DC correction is enabled. - */ - public boolean isDC() - { - return Flag.evaluate(sdrplay_api_DcOffsetT.DCenable(getDCOffset())); - } - - /** - * Enable or disable DC correction - */ - public void setDC(boolean enable) - { - sdrplay_api_DcOffsetT.DCenable(getDCOffset(), Flag.of(enable)); - } - - /** - * Indicates if IQ correction is enabled - */ - public boolean isIQ() - { - return Flag.evaluate(sdrplay_api_DcOffsetT.IQenable(getDCOffset())); - } - - /** - * Enable or disable IQ correction - */ - public void setIQ(boolean enable) - { - sdrplay_api_DcOffsetT.IQenable(getDCOffset(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Decimation.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Decimation.java deleted file mode 100644 index a45d2945..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/control/Decimation.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.control; - -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DecimationT; -import java.lang.foreign.MemorySegment; - -/** - * Decimation structure (sdrplay_api_DecimationT) - */ -public class Decimation -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from the foreign memory segment - */ - public Decimation(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - /** - * Foreign memory segment for this structure - */ - public MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * Indicates if decimation is enabled - */ - public boolean isEnabled() - { - return Flag.evaluate(sdrplay_api_DecimationT.enable(getMemorySegment())); - } - - /** - * Enable or disable decimation - */ - public void setEnabled(boolean enable) - { - sdrplay_api_DecimationT.enable(getMemorySegment(), Flag.of(enable)); - } - - /** - * Decimation factor - */ - public int getDecimationFactor() - { - return sdrplay_api_DecimationT.decimationFactor(getMemorySegment()); - } - - /** - * Sets the decimation factor - */ - public void setDecimationFactor(int decimationFactor) - { - sdrplay_api_DecimationT.decimationFactor(getMemorySegment(), (byte)decimationFactor); - } - - /** - * Indicates if the wideband signal setting is enabled - */ - public boolean isWideBandSignal() - { - return Flag.evaluate(sdrplay_api_DecimationT.wideBandSignal(getMemorySegment())); - } - - /** - * Enables or disables the wideband signal setting - */ - public void setWideBandSignal(boolean enable) - { - sdrplay_api_DecimationT.wideBandSignal(getMemorySegment(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParameters.java deleted file mode 100644 index 46c1c631..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParameters.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DevParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Device Parameters structure (sdrplay_api_DevParamsT) - */ -public abstract class DeviceParameters -{ - private final MemorySegment mDevParams; - private final SamplingFrequency mSamplingFrequency; - private final SynchronousUpdate mSynchronousUpdate; - private final ResetFlags mResetFlags; - - /** - * Constructs an instance. - * @param devParams for the DeviceParameters structure - */ - public DeviceParameters(MemorySegment devParams) - { - 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 getDevParams() - { - return mDevParams; - } - - /** - * Parts Per Million (ppm) center frequency correction value. - * @return ppm - */ - public double getPPM() - { - return sdrplay_api_DevParamsT.ppm(getDevParams()); - } - - /** - * Sets the parts per million (ppm) center frequency correction value - * @param ppm parts per million - */ - public void setPPM(double ppm) - { - sdrplay_api_DevParamsT.ppm(getDevParams(), ppm); - } - - /** - * Sampling frequency structure. - */ - public SamplingFrequency getSamplingFrequency() - { - return mSamplingFrequency; - } - - /** - * Synchronous update structure - */ - public SynchronousUpdate getSynchronousUpdate() - { - return mSynchronousUpdate; - } - - /** - * Reset request flags - */ - public ResetFlags getResetFlags() - { - return mResetFlags; - } - - /** - * USB Transfer mode currently used by the device - */ - public TransferMode getTransferMode() - { - return TransferMode.fromValue(sdrplay_api_DevParamsT.mode(getDevParams())); - } - - /** - * Sets the USB transfer mode used by the device - */ - public void setTransferMode(TransferMode transferMode) - { - if(transferMode != TransferMode.UNKNOWN) - { - sdrplay_api_DevParamsT.mode(getDevParams(), transferMode.getValue()); - } - } - - public long getSamplesPerPacket() - { - return sdrplay_api_DevParamsT.samplesPerPkt(getDevParams()); - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("\tDevice Parameters").append("\n"); - sb.append("\t\tPPM: ").append(getPPM()).append("\n"); - sb.append("\t\tSample Rate: ").append(getSamplingFrequency()).append("\n"); - sb.append("\t\tSamples Per Packet: ").append(getSamplesPerPacket()).append("\n"); - sb.append("\t\tSync Update: ").append(getSynchronousUpdate()).append("\n"); - sb.append("\t\tReset Flags: ").append(getResetFlags()).append("\n"); - sb.append("\t\tTransfer Mode: ").append(getTransferMode()).append("\n"); - - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParametersFactory.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParametersFactory.java deleted file mode 100644 index 64ef86fc..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/DeviceParametersFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import java.lang.foreign.MemorySegment; - -/** - * Creates device parameters instance from a foreign memory segment - */ -public class DeviceParametersFactory -{ - /** - * Create a device parameters instance - * @param deviceType for the device - * @param memorySegment for an allocated sdrplay_api_DevParamsT structure - * @return instance - */ - public static DeviceParameters create(DeviceType deviceType, MemorySegment memorySegment) - { - switch(deviceType) - { - case RSP1 -> { - return new Rsp1DeviceParameters(memorySegment); - } - //RSP1A and RSP1B share the same device parameters structures - case RSP1A, RSP1B -> { - return new Rsp1aDeviceParameters(memorySegment); - } - case RSP2 -> { - return new Rsp2DeviceParameters(memorySegment); - } - case RSPduo -> { - return new RspDuoDeviceParameters(memorySegment); - } - case RSPdx, RSPdxR2 -> { - return new RspDxDeviceParameters(memorySegment); - } - } - - throw new IllegalArgumentException("Unrecognized Device Type: " + deviceType); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/ResetFlags.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/ResetFlags.java deleted file mode 100644 index f8906d70..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/ResetFlags.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_ResetFlagsT; -import java.lang.foreign.MemorySegment; - -/** - * Reset Flags structure - */ -public class ResetFlags -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from a foreign memory segment and transfers the structure fields into this instance. - * @param memorySegment pointer - */ - public ResetFlags(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - /** - * Foreign memory segment - */ - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * Request a reset of the gain reduction - */ - public void resetGain(boolean reset) - { - sdrplay_api_ResetFlagsT.resetGainUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE); - } - - /** - * Request a reset of the center frequency value - */ - public void resetFrequency(boolean reset) - { - sdrplay_api_ResetFlagsT.resetRfUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE); - } - - /** - * Request a reset of the sample rate value. - */ - public void resetSampleRate(boolean reset) - { - sdrplay_api_ResetFlagsT.resetFsUpdate(getMemorySegment(), reset ? Flag.TRUE : Flag.FALSE); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1aDeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1aDeviceParameters.java deleted file mode 100644 index 3d296567..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp1aDeviceParameters.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_DevParamsT; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_Rsp1aParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-1A Device Parameters structure - */ -public class Rsp1aDeviceParameters extends DeviceParameters -{ - private final MemorySegment mRsp1aParams; - - /** - * Constructs an instance - * @param devParams for an allocated sdrplay_api_DevParamsT structure - */ - public Rsp1aDeviceParameters(MemorySegment devParams) - { - super(devParams); - mRsp1aParams = sdrplay_api_DevParamsT.rsp1aParams(devParams); - } - - /** - * Foreign memory segment representing this structure - */ - private MemorySegment getRsp1aParams() - { - return mRsp1aParams; - } - - /** - * Indicates if RF notch is enabled. - */ - public boolean isRFNotch() - { - return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfNotchEnable(getRsp1aParams())); - } - - /** - * Enables or disables the RF notch. - */ - public void setRFNotch(boolean enable) - { - sdrplay_api_Rsp1aParamsT.rfNotchEnable(getRsp1aParams(), Flag.of(enable)); - } - - /** - * Indicates if DAB RF notch is enabled - */ - public boolean isRfDabNotch() - { - return Flag.evaluate(sdrplay_api_Rsp1aParamsT.rfDabNotchEnable(getRsp1aParams())); - } - - /** - * Enables or disables the DAB RF notch - */ - public void setRfDabNotch(boolean enable) - { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable(getRsp1aParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp2DeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp2DeviceParameters.java deleted file mode 100644 index d1cf2635..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/Rsp2DeviceParameters.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_DevParamsT; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_Rsp2ParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-2 Device Parameters structure - */ -public class Rsp2DeviceParameters extends DeviceParameters -{ - private final MemorySegment mRsp2Params; - - /** - * Constructs an instance - * @param devParams for an allocated sdrplay_api_DevParamsT structure - */ - public Rsp2DeviceParameters(MemorySegment devParams) - { - super(devParams); - mRsp2Params = sdrplay_api_DevParamsT.rsp2Params(devParams); - } - - /** - * Foreign memory segment representing this structure - */ - private MemorySegment getRsp2Params() - { - return mRsp2Params; - } - - /** - * Indicates if the external reference output is enabled - */ - public boolean isExternalReferenceOutput() - { - return Flag.evaluate(sdrplay_api_Rsp2ParamsT.extRefOutputEn(getRsp2Params())); - } - - /** - * Enables or disables the external reference output - */ - public void setExternalReferenceOutput(boolean enable) - { - sdrplay_api_Rsp2ParamsT.extRefOutputEn(getRsp2Params(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDuoDeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDuoDeviceParameters.java deleted file mode 100644 index 37473a17..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDuoDeviceParameters.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_DevParamsT; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RspDuoParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSPduo Device Parameters structure - */ -public class RspDuoDeviceParameters extends DeviceParameters -{ - private final MemorySegment mRspDuoParams; - - /** - * Constructs an instance - * @param devParams for an allocated sdrplay_api_DevParamsT structure - */ - public RspDuoDeviceParameters(MemorySegment devParams) - { - super(devParams); - mRspDuoParams = sdrplay_api_DevParamsT.rspDuoParams(devParams); - } - - /** - * Foreign memory segment representing this structure - */ - private MemorySegment getRspDuoParams() - { - return mRspDuoParams; - } - - /** - * Indicates if the external reference output is enabled - */ - public boolean isExternalReferenceOutput() - { - return Flag.evaluate(sdrplay_api_RspDuoParamsT.extRefOutputEn(getRspDuoParams())); - } - - /** - * Enables or disables the external reference output - */ - public void setExternalReferenceOutput(boolean enable) - { - sdrplay_api_RspDuoParamsT.extRefOutputEn(getRspDuoParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDxDeviceParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDxDeviceParameters.java deleted file mode 100644 index 68ec48e8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/RspDxDeviceParameters.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxAntenna; -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -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_RspDxParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-DX Device Parameters structure - */ -public class RspDxDeviceParameters extends DeviceParameters -{ - private final MemorySegment mRspDxParams; - - /** - * Constructs an instance from the foreign memory segment. - * @param devParams an allocated sdrplay_api_DevParamsT structure - */ - public RspDxDeviceParameters(MemorySegment devParams) - { - super(devParams); - mRspDxParams = sdrplay_api_DevParamsT.rspDxParams(devParams); - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getRspDxParams() - { - return mRspDxParams; - } - - /** - * Indicates if High Dynamic Range (HDR) is enabled - */ - public boolean isHdr() - { - return Flag.evaluate(sdrplay_api_RspDxParamsT.hdrEnable(getRspDxParams())); - } - - /** - * Enables or disables High Dynamic Range (HDR) - */ - public void setHdr(boolean enable) - { - sdrplay_api_RspDxParamsT.hdrEnable(getRspDxParams(), Flag.of(enable)); - } - - /** - * Indicates if Bias-T is enabled - */ - public boolean isBiasT() - { - return Flag.evaluate(sdrplay_api_RspDxParamsT.biasTEnable(getRspDxParams())); - } - - /** - * Enables or disables Bias-T - */ - public void setBiasT(boolean enable) - { - sdrplay_api_RspDxParamsT.biasTEnable(getRspDxParams(), Flag.of(enable)); - } - - /** - * RSPdx Antenna Setting - */ - public RspDxAntenna getRspDxAntenna() - { - return RspDxAntenna.fromValue(sdrplay_api_RspDxParamsT.antennaSel(getRspDxParams())); - } - - /** - * Selects the RSPdx Antenna - */ - public void setRspDxAntenna(RspDxAntenna rspDxAntenna) - { - sdrplay_api_RspDxParamsT.antennaSel(getRspDxParams(), rspDxAntenna.getValue()); - } - - /** - * Indicates if RF notch is enabled - */ - public boolean isRfNotch() - { - return Flag.evaluate(sdrplay_api_RspDxParamsT.rfNotchEnable(getRspDxParams())); - } - - /** - * Enables or disables RF notch - */ - public void setRfNotch(boolean enable) - { - sdrplay_api_RspDxParamsT.rfNotchEnable(getRspDxParams(), Flag.of(enable)); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return Flag.evaluate(sdrplay_api_RspDxParamsT.rfDabNotchEnable(getRspDxParams())); - } - - /** - * Enables or disables the RF DAB notch - */ - public void setRfDabNotch(boolean enable) - { - sdrplay_api_RspDxParamsT.rfDabNotchEnable(getRspDxParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SamplingFrequency.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SamplingFrequency.java deleted file mode 100644 index ceb51665..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SamplingFrequency.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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; - -/** - * Sample Rate structure - */ -public class SamplingFrequency -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from a foreign memory segment and transfers the structure fields into this instance. - * @param memorySegment pointer - */ - public SamplingFrequency(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * Sample rate frequency - * @return frequency in Hertz - */ - public double getSampleRate() - { - return sdrplay_api_FsFreqT.fsHz(getMemorySegment()); - } - - /** - * Applies the requested sample rate to the device parameters - * @param sampleRate requested rate - * @param synchronousUpdate request - * @param recalibrate request - */ - public void setSampleRate(double sampleRate, boolean synchronousUpdate, boolean recalibrate) - { - 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); - } - - /** - * Applies the requested sample rate to the device parameters with synchronous update and recalibrate set to false. - * @param sampleRate requested rate - */ - public void setSampleRate(double sampleRate) - { - setSampleRate(sampleRate, false, false); - } - - @Override - public String toString() - { - return "Sample Rate:" + getSampleRate(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SynchronousUpdate.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SynchronousUpdate.java deleted file mode 100644 index f6e66190..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/SynchronousUpdate.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_SyncUpdateT; -import java.lang.foreign.MemorySegment; - -/** - * Sync Update structure - */ -public class SynchronousUpdate -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from a foreign memory segment - * @param memorySegment pointer - */ - public SynchronousUpdate(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * Sets the sample number and period to apply to both tuners for a synchronous update. - * @param sampleNumber value - * @param period value - */ - public void set(int sampleNumber, int period) - { - sdrplay_api_SyncUpdateT.sampleNum(getMemorySegment(), sampleNumber); - sdrplay_api_SyncUpdateT.period(getMemorySegment(), period); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/TransferMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/TransferMode.java deleted file mode 100644 index b32309ac..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/device/TransferMode.java +++ /dev/null @@ -1,73 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.device; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * USB Transfer Mode - */ -public enum TransferMode -{ - ISOCHRONOUS(sdrplay_api_h.sdrplay_api_ISOCH(), "ISOCHRONOUS"), - BULK(sdrplay_api_h.sdrplay_api_BULK(), "BULK"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - TransferMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static TransferMode fromValue(int value) - { - for(TransferMode status: TransferMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventParametersFactory.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventParametersFactory.java deleted file mode 100644 index 62f0dfc2..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventParametersFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_EventParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Event Parameters structure (sdrplay_api_EventParamsT) - */ -public class EventParametersFactory -{ - /** - * Gain event callback parameters - */ - public static GainCallbackParameters createGainCallbackParameters(MemorySegment eventParams) - { - return new GainCallbackParameters(sdrplay_api_EventParamsT.gainParams(eventParams)); - } - - /** - * Power overload event callback parameters - */ - public static PowerOverloadCallbackParameters createPowerOverloadCallbackParameters(MemorySegment eventParams) - { - return new PowerOverloadCallbackParameters(sdrplay_api_EventParamsT.powerOverloadParams(eventParams)); - } - - /** - * RSPduo mode event callback parameters - */ - public static RspDuoModeCallbackParameters createRspDuoModeCallbackParameters(MemorySegment eventParams) - { - return new RspDuoModeCallbackParameters(sdrplay_api_EventParamsT.rspDuoModeParams(eventParams)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventType.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventType.java deleted file mode 100644 index 9cc149b3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/EventType.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * (Callback) Event Type (sdrplay_api_EventT) - */ -public enum EventType -{ - GAIN_CHANGE(sdrplay_api_h.sdrplay_api_GainChange(), "GAIN CHANGE"), - 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_15.sdrplay_api_h.sdrplay_api_DeviceFailure(), "DEVICE FAILURE"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - /** - * Constructs an instance - * @param value of the entry - * @param description for the entry - */ - EventType(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static EventType fromValue(int value) - { - for(EventType status: EventType.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/GainCallbackParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/GainCallbackParameters.java deleted file mode 100644 index 32c36a6b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/GainCallbackParameters.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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; - -/** - * Gain Callback Parameters structure (sdrplay_api_GainCbParamT) - */ -public class GainCallbackParameters -{ - private final int mGainReductionDb; - private final int mLnaGainReductionDb; - private final double mCurrentGain; - - /** - * Constructs an instance from the foreign memory segment - */ - public GainCallbackParameters(MemorySegment gainCbParam) - { - mGainReductionDb = sdrplay_api_GainCbParamT.gRdB(gainCbParam); - mLnaGainReductionDb = sdrplay_api_GainCbParamT.lnaGRdB(gainCbParam); - mCurrentGain = sdrplay_api_GainCbParamT.currGain(gainCbParam); - } - - /** - * Current gain reduction value - */ - public int getGainReductionDb() - { - return mGainReductionDb; - } - - /** - * Current LNA state setting - */ - public int getLnaGainReductionDb() - { - return mLnaGainReductionDb; - } - - /** - * Current gain value - */ - public double getCurrentGain() - { - return mCurrentGain; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("GR:").append(getGainReductionDb()); - sb.append(" LNA:").append(getLnaGainReductionDb()); - sb.append(" CURRENT GAIN:").append(getCurrentGain()); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadCallbackParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadCallbackParameters.java deleted file mode 100644 index 4ff4f8dd..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadCallbackParameters.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_PowerOverloadCbParamT; -import java.lang.foreign.MemorySegment; - -/** - * Power Overload Callback Parameters (sdrplay_api_PowerOverloadCbParamT) - */ -public class PowerOverloadCallbackParameters -{ - private final PowerOverloadEventType mPowerOverloadEventType; - - /** - * Constructs an instance from the foreign memory segment - */ - public PowerOverloadCallbackParameters(MemorySegment powerOverloadCbParam) - { - mPowerOverloadEventType = PowerOverloadEventType - .fromValue(sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType(powerOverloadCbParam)); - } - - /** - * Event type - */ - public PowerOverloadEventType getPowerOverloadEvent() - { - return mPowerOverloadEventType; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadEventType.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadEventType.java deleted file mode 100644 index e3797a19..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/PowerOverloadEventType.java +++ /dev/null @@ -1,73 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Power Overload Callback Event type - */ -public enum PowerOverloadEventType -{ - OVERLOAD_DETECTED(sdrplay_api_h.sdrplay_api_Overload_Detected(), "OVERLOAD DETECTED"), - OVERLOAD_CORRECTED(sdrplay_api_h.sdrplay_api_Overload_Corrected(), "OVERLOAD CORRECTED"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - PowerOverloadEventType(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static PowerOverloadEventType fromValue(int value) - { - for(PowerOverloadEventType status: PowerOverloadEventType.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeCallbackParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeCallbackParameters.java deleted file mode 100644 index 049a75ba..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeCallbackParameters.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RspDuoModeCbParamT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-Duo Mode Callback Parameters (sdrplay_api_RspDuoModeCbParamT) - */ -public class RspDuoModeCallbackParameters -{ - private final RspDuoModeEventType mRspDuoModeEventType; - - /** - * Constructs an instance from the foreign memory segment - */ - public RspDuoModeCallbackParameters(MemorySegment rspDuoModeCbParam) - { - mRspDuoModeEventType = RspDuoModeEventType.fromValue(sdrplay_api_RspDuoModeCbParamT.modeChangeType(rspDuoModeCbParam)); - } - - /** - * Event type - */ - public RspDuoModeEventType getRspDuoModeEvent() - { - return mRspDuoModeEventType; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeEventType.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeEventType.java deleted file mode 100644 index c0f40d85..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/event/RspDuoModeEventType.java +++ /dev/null @@ -1,78 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.event; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * RSP-Duo Mode Callback Event type - */ -public enum RspDuoModeEventType -{ - MASTER_INITIALIZED(sdrplay_api_h.sdrplay_api_MasterInitialised(), "MASTER INITIALIZED"), - SLAVE_ATTACHED(sdrplay_api_h.sdrplay_api_SlaveAttached(), "SLAVE ATTACHED"), - SLAVE_DETACHED(sdrplay_api_h.sdrplay_api_SlaveDetached(), "SLAVE DETACHED"), - SLAVE_INITIALIZED(sdrplay_api_h.sdrplay_api_SlaveInitialised(), "SLAVE INITIALIZED"), - SLAVE_UNINITIALIZED(sdrplay_api_h.sdrplay_api_SlaveUninitialised(), "SLAVE UNINITIALIZED"), - MASTER_DLL_DISAPPEARED(sdrplay_api_h.sdrplay_api_MasterDllDisappeared(), "MASTER DLL DISAPPEARED"), - SLAVE_DLL_DISAPPEARED(sdrplay_api_h.sdrplay_api_SlaveDllDisappeared(), "SLAVE DLL DISAPPEARED"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - RspDuoModeEventType(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static RspDuoModeEventType fromValue(int value) - { - for(RspDuoModeEventType status: RspDuoModeEventType.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Bandwidth.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Bandwidth.java deleted file mode 100644 index 04c2b8c8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Bandwidth.java +++ /dev/null @@ -1,89 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Bandwidth - */ -public enum Bandwidth -{ - BW_0_200(sdrplay_api_h.sdrplay_api_BW_0_200(), 200_000, "0.200 MHz"), - BW_0_300(sdrplay_api_h.sdrplay_api_BW_0_300(), 300_000, "0.300 MHz"), - BW_0_600(sdrplay_api_h.sdrplay_api_BW_0_600(), 600_000, "0.600 MHz"), - BW_1_536(sdrplay_api_h.sdrplay_api_BW_1_536(), 1_536_000, "1.536 MHz"), - BW_5_000(sdrplay_api_h.sdrplay_api_BW_5_000(), 5_000_000, "5.000 MHz"), - BW_6_000(sdrplay_api_h.sdrplay_api_BW_6_000(), 6_000_000, "6.000 MHz"), - BW_7_000(sdrplay_api_h.sdrplay_api_BW_7_000(), 7_000_000, "7.000 MHz"), - BW_8_000(sdrplay_api_h.sdrplay_api_BW_8_000(), 8_000_000, "8.000 MHz"), - UNDEFINED(sdrplay_api_h.sdrplay_api_BW_Undefined(), 0, "UNDEFINED"); - - private int mValue; - private long mBandwidth; - private String mDescription; - - Bandwidth(int value, long bandwidth, String description) - { - mValue = value; - mBandwidth = bandwidth; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Bandwidth (Hz) - */ - public long getBandwidth() - { - return mBandwidth; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNDEFINED if the code is not recognized - */ - public static Bandwidth fromValue(int value) - { - for(Bandwidth status: Bandwidth.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNDEFINED; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/DcOffsetTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/DcOffsetTuner.java deleted file mode 100644 index 7952b360..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/DcOffsetTuner.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_07.sdrplay_api_DcOffsetTunerT; -import java.lang.foreign.MemorySegment; - -/** - * DC Offset Tuner structure (sdrplay_api_DcOffsetTunerT) - */ -public class DcOffsetTuner -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from the foreign memory segment - */ - public DcOffsetTuner(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * DC calibration mode. - * @return - */ - public int getDcCal() - { - return sdrplay_api_DcOffsetTunerT.dcCal(getMemorySegment()); - } - - public void setDcCal(int dcCal) - { - sdrplay_api_DcOffsetTunerT.dcCal(getMemorySegment(), (byte)dcCal); - } - - public boolean isSpeedUp() - { - return Flag.evaluate(sdrplay_api_DcOffsetTunerT.speedUp(getMemorySegment())); - } - - public void setSpeedUp(boolean speedUp) - { - sdrplay_api_DcOffsetTunerT.speedUp(getMemorySegment(), Flag.of(speedUp)); - } - - public int getTrackTime() - { - return sdrplay_api_DcOffsetTunerT.trackTime(getMemorySegment()); - } - - public void setTrackTime(int trackTime) - { - sdrplay_api_DcOffsetTunerT.trackTime(getMemorySegment(), trackTime); - } - - public int getRefreshRateTime() - { - return sdrplay_api_DcOffsetTunerT.refreshRateTime(getMemorySegment()); - } - - public void setRefreshRateTime(int refreshRateTime) - { - sdrplay_api_DcOffsetTunerT.refreshRateTime(getMemorySegment(), refreshRateTime); - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("DC Cal:").append(getDcCal()).append(" Speed Up:").append(isSpeedUp()); - sb.append(" Track Time:").append(getTrackTime()).append(" Refresh Rate Time:").append(getRefreshRateTime()); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Gain.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Gain.java deleted file mode 100644 index a17a33b7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Gain.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_07.sdrplay_api_GainT; -import java.lang.foreign.MemorySegment; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Gain structure (sdrplay_api_GainT) - */ -public class Gain -{ - private static final Logger mLog = LoggerFactory.getLogger(Gain.class); - - private final MemorySegment mMemorySegment; - private final GainValues mGainValues; - - /** - * Constructs an instance from the foreign memory segment - */ - public Gain(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - mGainValues = new GainValues(sdrplay_api_GainT.gainVals(memorySegment)); - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * Current gain reduction - * @return gain dB - */ - public int getGainReductionDb() - { - return sdrplay_api_GainT.gRdB(getMemorySegment()); - } - - /** - * Sets the gain reduction value - * @param gainReductionDb - */ - public void setGainReductionDb(int gainReductionDb) - { - sdrplay_api_GainT.gRdB(getMemorySegment(), gainReductionDb); - } - - /** - * Low Noise Amplifier (LNA) state/value - */ - public int getLNA() - { - return sdrplay_api_GainT.LNAstate(getMemorySegment()); - } - - /** - * Sets the Low Noise Amplifier (LNA) state - */ - public void setLNA(int lna) - { - sdrplay_api_GainT.LNAstate(getMemorySegment(), (byte)lna); - } - - /** - * Specifies if LNA and gain reduction changes should be applied synchronously - */ - public void setSynchronousUpdate(boolean syncUpdate) - { - sdrplay_api_GainT.syncUpdate(getMemorySegment(), Flag.of(syncUpdate)); - } - - /** - * Minimum gain reduction mode - */ - public MinimumGainReductionMode getMinimumGainReductionMode() - { - return MinimumGainReductionMode.fromValue(sdrplay_api_GainT.minGr(getMemorySegment())); - } - - /** - * Sets the minimum gain reduction mode - */ - public void setMinimumGainReductionMode(MinimumGainReductionMode minimumGainReductionMode) - { - sdrplay_api_GainT.minGr(getMemorySegment(), minimumGainReductionMode.getValue()); - } - - /** - * Gain values structure - */ - public GainValues getGainValues() - { - return mGainValues; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Reduction:").append(getGainReductionDb()).append("dB"); - sb.append(" LNA:").append(getLNA()); - sb.append(" Min Gain Reduction Mode:").append(getMinimumGainReductionMode()); - sb.append(" Gain Values:").append(getGainValues()); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/GainValues.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/GainValues.java deleted file mode 100644 index a804724d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/GainValues.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_GainValuesT; -import java.lang.foreign.MemorySegment; - -/** - * Gain Values structure (sdrplay_api_GainValuesT) - * - * Note: these are output parameters, so there are no setter methods. - */ -public class GainValues -{ - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from the foreign memory segment - */ - public GainValues(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - - public float getCurrent() - { - return sdrplay_api_GainValuesT.curr(getMemorySegment()); - } - - public float getMax() - { - return sdrplay_api_GainValuesT.max(getMemorySegment()); - } - - public float getMin() - { - return sdrplay_api_GainValuesT.min(getMemorySegment()); - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Current:").append(getCurrent()).append(" Max:").append(getMax()).append(" Min:").append(getMin()); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/HdrModeBandwidth.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/HdrModeBandwidth.java deleted file mode 100644 index 45cc78b8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/HdrModeBandwidth.java +++ /dev/null @@ -1,85 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * RSPdx High Dynamic Range (HDR) Mode Bandwidth - */ -public enum HdrModeBandwidth -{ - BANDWIDTH_0_200(sdrplay_api_h.sdrplay_api_RspDx_HDRMODE_BW_0_200(), 200_000, ".2 MHz"), - BANDWIDTH_0_500(sdrplay_api_h.sdrplay_api_RspDx_HDRMODE_BW_0_500(), 500_000, ".5 MHz"), - BANDWIDTH_1_200(sdrplay_api_h.sdrplay_api_RspDx_HDRMODE_BW_1_200(), 1_200_000, "1.2 MHz"), - BANDWIDTH_1_700(sdrplay_api_h.sdrplay_api_RspDx_HDRMODE_BW_1_700(), 1_700_000, "1.7 MHz"), - UNKNOWN(-1, 0, "UNKNOWN"); - - private int mValue; - private long mBandwidth; - private String mDescription; - - HdrModeBandwidth(int value, long bandwidth, String description) - { - mValue = value; - mBandwidth = bandwidth; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Bandwidth in Hertz - */ - public long getBandwidth() - { - return mBandwidth; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UKNOWN if the code is not recognized - */ - public static HdrModeBandwidth fromValue(int value) - { - for(HdrModeBandwidth status: HdrModeBandwidth.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/IfMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/IfMode.java deleted file mode 100644 index b5298256..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/IfMode.java +++ /dev/null @@ -1,83 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Intermediate Frequency (IF) Mode / Frequency - */ -public enum IfMode -{ - IF_ZERO(sdrplay_api_h.sdrplay_api_IF_Zero(), "ZIF 0.000 MHz"), - IF_450(sdrplay_api_h.sdrplay_api_IF_0_450(), "0.450 MHz"), - IF_1620(sdrplay_api_h.sdrplay_api_IF_1_620(), "1.620 MHz"), - IF_2048(sdrplay_api_h.sdrplay_api_IF_2_048(), "2.048 MHz"), - UNDEFINED(sdrplay_api_h.sdrplay_api_IF_Undefined(), "UNDEFINED"); - - private int mValue; - private String mDescription; - - IfMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Indicates the wideband enable decimation setting to use for this IF value. - */ - public boolean isWidebandSignal() - { - return this.equals(IF_ZERO); - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static IfMode fromValue(int value) - { - for(IfMode status: IfMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNDEFINED; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/LoMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/LoMode.java deleted file mode 100644 index c1f73fc9..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/LoMode.java +++ /dev/null @@ -1,75 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Local Oscillator Mode - */ -public enum LoMode -{ - AUTO(sdrplay_api_h.sdrplay_api_LO_Auto(), "AUTO"), - MHZ_120(sdrplay_api_h.sdrplay_api_LO_120MHz(), "120 MHz"), - MHZ_144(sdrplay_api_h.sdrplay_api_LO_144MHz(), "144 MHz"), - MHZ_168(sdrplay_api_h.sdrplay_api_LO_168MHz(), "168 MHz"), - UNDEFINED(sdrplay_api_h.sdrplay_api_LO_Undefined(), "UNDEFINED"); - - private int mValue; - private String mDescription; - - LoMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static LoMode fromValue(int value) - { - for(LoMode status: LoMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNDEFINED; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/MinimumGainReductionMode.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/MinimumGainReductionMode.java deleted file mode 100644 index ad003396..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/MinimumGainReductionMode.java +++ /dev/null @@ -1,73 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * Minimum Gain Reduction (mode) - */ -public enum MinimumGainReductionMode -{ - EXTENDED(sdrplay_api_h.sdrplay_api_EXTENDED_MIN_GR(), "EXTENDED"), - NORMAL(sdrplay_api_h.sdrplay_api_NORMAL_MIN_GR(), "NORMAL"), - UNKNOWN(-1, "UNKNOWN"); - - private int mValue; - private String mDescription; - - MinimumGainReductionMode(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or UNKNOWN if the code is not recognized - */ - public static MinimumGainReductionMode fromValue(int value) - { - for(MinimumGainReductionMode status: MinimumGainReductionMode.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return UNKNOWN; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RfFrequency.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RfFrequency.java deleted file mode 100644 index d0e485eb..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RfFrequency.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RfFreqT; -import java.lang.foreign.MemorySegment; - -/** - * RF Frequency structure (sdrplay_api_RfFreqT) - */ -public class RfFrequency -{ - private static final double MINIMUM_FREQUENCY = 1_200; - private static final double MAXIMUM_FREQUENCY = 2_000_000_000; - private final MemorySegment mMemorySegment; - - /** - * Constructs an instance from the foreign memory segment - * @param memorySegment representing the structure - */ - public RfFrequency(MemorySegment memorySegment) - { - mMemorySegment = memorySegment; - } - - private MemorySegment getMemorySegment() - { - return mMemorySegment; - } - - /** - * RF Frequency - * @return frequency in Hertz - */ - public double getFrequency() - { - return sdrplay_api_RfFreqT.rfHz(getMemorySegment()); - } - - /** - * Sets the RF frequency - * @param frequency (0 < frequency <= 2,000,000,000 Hz) - * @param synchronousUpdate to set the frequency as a synchronous update - * @throws SDRPlayException for an invalid frequency (ie out of valid range) - */ - public void setFrequency(double frequency, boolean synchronousUpdate) throws SDRPlayException - { - if(MINIMUM_FREQUENCY < frequency && frequency <= MAXIMUM_FREQUENCY) - { - sdrplay_api_RfFreqT.rfHz(getMemorySegment(), frequency); - sdrplay_api_RfFreqT.syncUpdate(getMemorySegment(), Flag.of(synchronousUpdate)); - } - else - { - throw new SDRPlayException("Invalid frequency: " + frequency + " - valid range: " + - MINIMUM_FREQUENCY + "-" + MAXIMUM_FREQUENCY); - } - } - - /** - * Sets the RF frequency as a synchronous update - */ - public void setFrequency(double frequency) throws SDRPlayException - { - setFrequency(frequency, true); - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Frequency:").append(getFrequency()); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1TunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1TunerParameters.java deleted file mode 100644 index 6121e5df..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1TunerParameters.java +++ /dev/null @@ -1,38 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import java.lang.foreign.MemorySegment; - -/** - * RSP1 Tuner Parameters structure - * - * Note: the RSP1 doesn't have any additional settings beyond the basic tuner parameters - */ -public class Rsp1TunerParameters extends TunerParameters -{ - /** - * Constructs an instance from the foreign memory segment. - */ - public Rsp1TunerParameters(MemorySegment tunerParametersMemorySegment) - { - super(tunerParametersMemorySegment); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1aTunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1aTunerParameters.java deleted file mode 100644 index abdc2da4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp1aTunerParameters.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_07.sdrplay_api_Rsp1aTunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-1A Tuner Parameters structure - */ -public class Rsp1aTunerParameters extends TunerParameters -{ - private final MemorySegment mRsp1aTunerParams; - - /** - * Constructs an instance from the foreign memory segment. - */ - public Rsp1aTunerParameters(MemorySegment rxChannelParams, MemorySegment rsp1aTunerParams) - { - super(rxChannelParams); - mRsp1aTunerParams = rsp1aTunerParams; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getRsp1aTunerParams() - { - return mRsp1aTunerParams; - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return Flag.evaluate(sdrplay_api_Rsp1aTunerParamsT.biasTEnable(getRsp1aTunerParams())); - } - - /** - * Enable or disable the Bias-T - */ - public void setBiasT(boolean enable) - { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable(getRsp1aTunerParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2TunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2TunerParameters.java deleted file mode 100644 index 5f04080c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2TunerParameters.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_07.sdrplay_api_Rsp2TunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP2 Tuner Parameters structure - */ -public class Rsp2TunerParameters extends TunerParameters -{ - private final MemorySegment mRsp2TunerParams; - - public Rsp2TunerParameters(MemorySegment rxChannelParams, MemorySegment rsp2TunerParams) - { - super(rxChannelParams); - mRsp2TunerParams = rsp2TunerParams; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getRsp2TunerParams() - { - return mRsp2TunerParams; - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.biasTEnable(getRsp2TunerParams())); - } - - /** - * Enables or disables the Bias-T - */ - public void setBiasT(boolean enable) - { - sdrplay_api_Rsp2TunerParamsT.biasTEnable(getRsp2TunerParams(), Flag.of(enable)); - } - - /** - * Current AM port setting - */ - public Rsp2AmPort getAmPort() - { - return Rsp2AmPort.fromValue(sdrplay_api_Rsp2TunerParamsT.amPortSel(getRsp2TunerParams())); - } - - /** - * Sets the AM port to use - */ - public void setAmPort(Rsp2AmPort amPort) - { - sdrplay_api_Rsp2TunerParamsT.amPortSel(getRsp2TunerParams(), amPort.getValue()); - } - - /** - * Antenna setting - */ - public Rsp2Antenna getAntenna() - { - return Rsp2Antenna.fromValue(sdrplay_api_Rsp2TunerParamsT.antennaSel(getRsp2TunerParams())); - } - - /** - * Sets the antenna - */ - public void setAntenna(Rsp2Antenna rsp2Antenna) - { - sdrplay_api_Rsp2TunerParamsT.antennaSel(getRsp2TunerParams(), rsp2Antenna.getValue()); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return Flag.evaluate(sdrplay_api_Rsp2TunerParamsT.rfNotchEnable(getRsp2TunerParams())); - } - - /** - * Enables or disables the RF notch - */ - public void setRfNotch(boolean enable) - { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable(getRsp2TunerParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParameters.java deleted file mode 100644 index 316b879e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParameters.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import java.lang.foreign.MemorySegment; - -/** - * RSPduo abstract Tuner Parameters structure - */ -public abstract class RspDuoTunerParameters extends TunerParameters -{ - private MemorySegment mRspDuoTunerParams; - - /** - * Constructs an instance from the foreign memory segment - * @param rxChannelParams of foreign memory structure - * @param rspDuoTunerParams of foreign memory structure - */ - RspDuoTunerParameters(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams) - { - super(rxChannelParams); - mRspDuoTunerParams = rspDuoTunerParams; - } - - /** - * Foreign memory segment for this structure - */ - MemorySegment getRspDuoTunerParams() - { - return mRspDuoTunerParams; - } - - /** - * Indicates if the Bias-T is enabled - */ - public abstract boolean isBiasT(); - - /** - * Enables or disables the Bias-T - */ - public abstract void setBiasT(boolean enable); - - /** - * Tuner 1 AM port setting - */ - public abstract RspDuoAmPort getTuner1AmPort(); - - /** - * Set Tuner 1 AM port setting - */ - public abstract void setTuner1AmPort(RspDuoAmPort amPort); - - /** - * Indicates if Tuner 1 AM notch is enabled - */ - public abstract boolean isTuner1AmNotch(); - - /** - * Enables or disables the Tuner 1 AM notch - */ - public abstract void setTuner1AmNotch(boolean enable); - - /** - * Indicates if the RF notch is enabled - */ - public abstract boolean isRfNotch(); - - /** - * Enables or disables the RF notch - */ - public abstract void setRfNotch(boolean enable); - - /** - * Indicates if the RF DAB notch is enabled - */ - public abstract boolean isRfDabNotch(); - - /** - * Enables or disables the RF DAB notch - */ - public abstract void setRfDabNotch(boolean enable); -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_07.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_07.java deleted file mode 100644 index c31a8da4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_07.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_07.sdrplay_api_RspDuoTunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSPduo Tuner Parameters structure for API Versions 3.07 - 3.12. - */ -public class RspDuoTunerParametersV3_07 extends RspDuoTunerParameters -{ - /** - * Constructs an instance from the foreign memory segment - * @param rxChannelParams of foreign memory structure - * @param rspDuoTunerParams of foreign memory structure - */ - RspDuoTunerParametersV3_07(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams) - { - super(rxChannelParams, rspDuoTunerParams); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the Bias-T - */ - public void setBiasT(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Tuner 1 AM port setting - */ - public RspDuoAmPort getTuner1AmPort() - { - return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams())); - } - - /** - * Set Tuner 1 AM port setting - */ - public void setTuner1AmPort(RspDuoAmPort amPort) - { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams(), amPort.getValue()); - } - - /** - * Indicates if Tuner 1 AM notch is enabled - */ - public boolean isTuner1AmNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the Tuner 1 AM notch - */ - public void setTuner1AmNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the RF notch - */ - public void setRfNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the RF DAB notch - */ - public void setRfDabNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_14.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_14.java deleted file mode 100644 index e57f85ee..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDuoTunerParametersV3_14.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -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_15.sdrplay_api_RspDuoTunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSPduo Tuner Parameters structure for API Versions 3.14+. - * - * Note: version 3.14 is different from version 3.07-3.12 because it adds the RspDuo_ResetSlaveFlagsT structure and - * methods, however these are not used/implemented in this class or in the parent abstract class. - */ -public class RspDuoTunerParametersV3_14 extends RspDuoTunerParameters -{ - /** - * Constructs an instance from the foreign memory segment - * @param rxChannelParams of foreign memory structure - * @param rspDuoTunerParams of foreign memory structure - */ - RspDuoTunerParametersV3_14(MemorySegment rxChannelParams, MemorySegment rspDuoTunerParams) - { - super(rxChannelParams, rspDuoTunerParams); - } - - /** - * Indicates if the Bias-T is enabled - */ - public boolean isBiasT() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the Bias-T - */ - public void setBiasT(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.biasTEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Tuner 1 AM port setting - */ - public RspDuoAmPort getTuner1AmPort() - { - return RspDuoAmPort.fromValue(sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams())); - } - - /** - * Set Tuner 1 AM port setting - */ - public void setTuner1AmPort(RspDuoAmPort amPort) - { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel(getRspDuoTunerParams(), amPort.getValue()); - } - - /** - * Indicates if Tuner 1 AM notch is enabled - */ - public boolean isTuner1AmNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the Tuner 1 AM notch - */ - public void setTuner1AmNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Indicates if the RF notch is enabled - */ - public boolean isRfNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the RF notch - */ - public void setRfNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } - - /** - * Indicates if the RF DAB notch is enabled - */ - public boolean isRfDabNotch() - { - return Flag.evaluate(sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams())); - } - - /** - * Enables or disables the RF DAB notch - */ - public void setRfDabNotch(boolean enable) - { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable(getRspDuoTunerParams(), Flag.of(enable)); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxAntenna.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxAntenna.java deleted file mode 100644 index 0ca6ea8e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxAntenna.java +++ /dev/null @@ -1,73 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; - -/** - * RSP-Dx Antenna - */ -public enum RspDxAntenna -{ - ANTENNA_A(sdrplay_api_h.sdrplay_api_RspDx_ANTENNA_A(), "ANT A (1 kHz to 2 GHz)"), - ANTENNA_B(sdrplay_api_h.sdrplay_api_RspDx_ANTENNA_B(), "ANT B (1 kHz to 2 GHz)"), - ANTENNA_C(sdrplay_api_h.sdrplay_api_RspDx_ANTENNA_C(), "ANT C (1 kHz to 200 MHz)"); - - private int mValue; - private String mDescription; - - RspDxAntenna(int value, String description) - { - mValue = value; - mDescription = description; - } - - /** - * Numeric value - */ - public int getValue() - { - return mValue; - } - - /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or ANTENNA A if the code is not recognized - */ - public static RspDxAntenna fromValue(int value) - { - for(RspDxAntenna status: RspDxAntenna.values()) - { - if(status.getValue() == value) - { - return status; - } - } - - return ANTENNA_A; - } - - @Override - public String toString() - { - return mDescription; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxTunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxTunerParameters.java deleted file mode 100644 index e8bdbee2..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/RspDxTunerParameters.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RspDxTunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * RSP-Dx Tuner Parameters structure - */ -public class RspDxTunerParameters extends TunerParameters -{ - private final MemorySegment mRspDxTunerParams; - - /** - * Constructs an instance from the foreign memory segment. - */ - public RspDxTunerParameters(MemorySegment rxChannelParams, MemorySegment rspDxTunerParams) - { - super(rxChannelParams); - mRspDxTunerParams = rspDxTunerParams; - } - - /** - * Foreign memory segment for this structure - */ - private MemorySegment getRspDxTunerParams() - { - return mRspDxTunerParams; - } - - /** - * Current bandwidth setting for High Dynamic Range (HDR) mode - */ - public HdrModeBandwidth getHdrModeBandwidth() - { - return HdrModeBandwidth.fromValue(sdrplay_api_RspDxTunerParamsT.hdrBw(getRspDxTunerParams())); - } - - /** - * Sets bandwidth for High Dynamic Range (HDR) mode - */ - public void setHdrModeBandwidth(HdrModeBandwidth bandwidth) - { - sdrplay_api_RspDxTunerParamsT.hdrBw(getRspDxTunerParams(), bandwidth.getValue()); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParameters.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParameters.java deleted file mode 100644 index 56989642..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParameters.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_TunerParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Tuner Parameters structure (sdrplay_api_TunerParamsT) - */ -public abstract class TunerParameters -{ - 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 tunerParams) - { - 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 getTunerParams() - { - return mTunerParams; - } - - /** - * IF bandwidth - */ - public Bandwidth getBandwidth() - { - return Bandwidth.fromValue(sdrplay_api_TunerParamsT.bwType(getTunerParams())); - } - - /** - * Sets the IF bandwidth - */ - public void setBandwidth(Bandwidth bandwidth) - { - sdrplay_api_TunerParamsT.bwType(getTunerParams(), bandwidth.getValue()); - } - - /** - * IF mode - */ - public IfMode getIfMode() - { - return IfMode.fromValue(sdrplay_api_TunerParamsT.ifType(getTunerParams())); - } - - /** - * Sets IF mode - */ - public void setIfMode(IfMode ifMode) - { - sdrplay_api_TunerParamsT.ifType(getTunerParams(), ifMode.getValue()); - } - - /** - * LO mode - */ - public LoMode getLoMode() - { - return LoMode.fromValue(sdrplay_api_TunerParamsT.loMode(getTunerParams())); - } - - /** - * Sets LO mode - */ - public void setLoMode(LoMode loMode) - { - sdrplay_api_TunerParamsT.loMode(getTunerParams(), loMode.getValue()); - } - - /** - * Gain settings structure - */ - public Gain getGain() - { - return mGain; - } - - /** - * RF frequency structure - */ - public RfFrequency getRfFrequency() - { - return mRfFrequency; - } - - /** - * DC offset tuner structure - */ - public DcOffsetTuner getDcOffsetTuner() - { - return mDcOffsetTuner; - } - - @Override - public String toString() - { - StringBuilder sb = new StringBuilder(); - sb.append("Tuner Parameters\n"); - sb.append("\tBandwidth: ").append(getBandwidth()).append("\n"); - sb.append("\tIF Mode: ").append(getIfMode()).append("\n"); - sb.append("\tLO Mode: ").append(getLoMode()).append("\n"); - sb.append("\tGain: ").append(getGain()).append("\n"); - sb.append("\tRF Frequency: ").append(getRfFrequency()).append("\n"); - sb.append("\tDC Offset Tuner: ").append(getDcOffsetTuner()).append("\n"); - return sb.toString(); - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParametersFactory.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParametersFactory.java deleted file mode 100644 index bfa40d9a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/TunerParametersFactory.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; - -import io.github.dsheirer.source.tuner.sdrplay.api.Version; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceType; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RxChannelParamsT; -import java.lang.foreign.MemorySegment; - -/** - * Factory for creating tuner parameters structures - */ -public class TunerParametersFactory -{ - /** - * Creats a tuner parameters instance for the specified device type - * @param deviceType to create - * @param rxChannelParams sdrplay_api_RxChannelParamsT structure - * @return tuner parameters - */ - public static TunerParameters create(Version version, DeviceType deviceType, MemorySegment rxChannelParams) - { - MemorySegment tunerParams = sdrplay_api_RxChannelParamsT.tunerParams(rxChannelParams); - - switch(deviceType) - { - case RSP1 -> { - return new Rsp1TunerParameters(tunerParams); - } - //RSP1A and RSP1B share the same tuner parameters structures - case RSP1A, RSP1B -> { - MemorySegment rsp1aTunerParams = sdrplay_api_RxChannelParamsT.rsp1aTunerParams(rxChannelParams); - return new Rsp1aTunerParameters(rxChannelParams, rsp1aTunerParams); - } - case RSP2 -> { - MemorySegment rsp2TunerParams = sdrplay_api_RxChannelParamsT.rsp2TunerParams(rxChannelParams); - return new Rsp2TunerParameters(rxChannelParams, rsp2TunerParams); - } - case RSPduo -> { - if(version.gte(Version.V3_14)) - { - 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 rspDuoTunerParams = sdrplay_api_RxChannelParamsT.rspDuoTunerParams(rxChannelParams); - return new RspDuoTunerParametersV3_07(rxChannelParams, rspDuoTunerParams); - } - else - { - throw new IllegalArgumentException("Unrecognized API version: " + version); - } - } - case RSPdx, RSPdxR2 -> { - MemorySegment rspDxTunerParams = sdrplay_api_RxChannelParamsT.rspDxTunerParams(rxChannelParams); - return new RspDxTunerParameters(rxChannelParams, rspDxTunerParams); - } - default -> throw new IllegalArgumentException("Unrecognized device type: " + deviceType); - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Flag.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Flag.java deleted file mode 100644 index cba54895..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Flag.java +++ /dev/null @@ -1,59 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.util; - -/** - * Utility for integer and byte values representing true/false flags. - */ -public class Flag -{ - public static final byte TRUE = 0x01; - public static final byte FALSE = 0x00; - - /** - * Evaluates the boolean value false (0x00) or true - * @param value to evaluate - * @return true of the value is non-zero - */ - public static boolean evaluate(byte value) - { - return value != FALSE; - } - - /** - * Evaluates the boolean value false (0) or true - * @param value to evaluate - * @return true of the value is non-zero - */ - public static boolean evaluate(int value) - { - return value != 0; - } - - /** - * Returns a byte value representing the boolean value. - * @param value to lookup - * @return byte flag value - */ - public static byte of(boolean value) - { - return value ? TRUE : FALSE; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Retry.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Retry.java deleted file mode 100644 index e1bb9748..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/util/Retry.java +++ /dev/null @@ -1,91 +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 - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.util; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; - -/** - * Utility for retrying SDRplay API operations with thread sleep delay - * - * Note: the SDRplay API is non-blocking and therefore non-deterministic because it will return a Fail status code - * if it can't execute the requested operation at that time. Your only recourse is to repeatedly attempt an - * operation until you get a successful status return code. - */ -public class Retry -{ - /** - * Attempts to execute the runnable up to a maximum of 5 attempts, sleeping the thread by 20 millis each time. - * @param r to execute - */ - public static void quietly(Retryable r) - { - quietly(5, 20, r); - } - - /** - * Attempts to execute the runnable up to a maximum of (attempts), sleeping the thread by (pause) millis each time. - * @param attempts number of tries - * @param pause in milliseconds between each attempt - * @param r to execute - */ - public static void quietly(int attempts, long pause, Retryable r) - { - int attempt = 0; - - boolean success = false; - - while(attempt < attempts && !success) - { - attempt++; - - try - { - r.run(); - success = true; - } - catch(SDRPlayException e) - { - //Quietly ... no logging - } - - if(!success) - { - try - { - Thread.sleep(pause); - } - catch(Exception e) - { - //Do nothing - } - } - } - } - - /** - * Functional interface that encapsulates an SDRplay API operation that can throw an SDRplay exception and that - * can be attempted multiple times until successful. - */ - @FunctionalInterface - public interface Retryable - { - void run() throws SDRPlayException; - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_AgcT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_AgcT.java deleted file mode 100644 index 05558d16..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_AgcT.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.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 lang=c : - * struct { - * sdrplay_api_AgcControlT enable; - * int setPoint_dBfs; - * unsigned short attack_ms; - * unsigned short decay_ms; - * unsigned short decay_delay_ms; - * unsigned short decay_threshold_dB; - * int syncUpdate; - * } - * } - */ -public class sdrplay_api_AgcT { - - sdrplay_api_AgcT() { - // Should not be called directly - } - - 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 lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static int enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static void enable(MemorySegment struct, int fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int setPoint_dBfs - * } - */ - public static int setPoint_dBfs(MemorySegment struct) { - return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int setPoint_dBfs - * } - */ - public static void setPoint_dBfs(MemorySegment struct, int fieldValue) { - struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short attack_ms - * } - */ - public static short attack_ms(MemorySegment struct) { - return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short attack_ms - * } - */ - public static void attack_ms(MemorySegment struct, short fieldValue) { - struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_ms - * } - */ - public static short decay_ms(MemorySegment struct) { - return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_ms - * } - */ - public static void decay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_delay_ms - * } - */ - public static short decay_delay_ms(MemorySegment struct) { - return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_delay_ms - * } - */ - public static void decay_delay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static short decay_threshold_dB(MemorySegment struct) { - return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static void decay_threshold_dB(MemorySegment struct, short fieldValue) { - struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int syncUpdate - * } - */ - public static int syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, int fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ApiVersion_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ApiVersion_t.java deleted file mode 100644 index e7fb49ce..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ApiVersion_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *) - * } - */ -public class sdrplay_api_ApiVersion_t { - - sdrplay_api_ApiVersion_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_CallbackFnsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_CallbackFnsT.java deleted file mode 100644 index 1a80f9f5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_CallbackFnsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_StreamCallback_t StreamACbFn; - * sdrplay_api_StreamCallback_t StreamBCbFn; - * sdrplay_api_EventCallback_t EventCbFn; - * } - * } - */ -public class sdrplay_api_CallbackFnsT { - - sdrplay_api_CallbackFnsT() { - // Should not be called directly - } - - 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 lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static MemorySegment StreamACbFn(MemorySegment struct) { - return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static void StreamACbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamACbFn$LAYOUT, StreamACbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static MemorySegment StreamBCbFn(MemorySegment struct) { - return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static MemorySegment EventCbFn(MemorySegment struct) { - return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Close_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Close_t.java deleted file mode 100644 index bc00f12e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Close_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void) - * } - */ -public class sdrplay_api_Close_t { - - sdrplay_api_Close_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ControlParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ControlParamsT.java deleted file mode 100644 index f313b315..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ControlParamsT.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DcOffsetT dcOffset; - * sdrplay_api_DecimationT decimation; - * sdrplay_api_AgcT agc; - * sdrplay_api_AdsbModeT adsbMode; - * } - * } - */ -public class sdrplay_api_ControlParamsT { - - sdrplay_api_ControlParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_DcOffsetT.layout().withName("dcOffset"), - sdrplay_api_DecimationT.layout().withName("decimation"), - MemoryLayout.paddingLayout(3), - sdrplay_api_AgcT.layout().withName("agc"), - sdrplay_api_h.C_INT.withName("adsbMode") - ).withName("$anon$47:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout dcOffset$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffset")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final GroupLayout dcOffset$layout() { - return dcOffset$LAYOUT; - } - - private static final long dcOffset$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final long dcOffset$offset() { - return dcOffset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static MemorySegment dcOffset(MemorySegment struct) { - return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final GroupLayout decimation$layout() { - return decimation$LAYOUT; - } - - private static final long decimation$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final long decimation$offset() { - return decimation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static MemorySegment decimation(MemorySegment struct) { - return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static void decimation(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - private static final GroupLayout agc$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("agc")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final GroupLayout agc$layout() { - return agc$LAYOUT; - } - - private static final long agc$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final long agc$offset() { - return agc$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static MemorySegment agc(MemorySegment struct) { - return struct.asSlice(agc$OFFSET, agc$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static void agc(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, agc$OFFSET, agc$LAYOUT.byteSize()); - } - - private static final OfInt adsbMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("adsbMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final OfInt adsbMode$layout() { - return adsbMode$LAYOUT; - } - - private static final long adsbMode$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final long adsbMode$offset() { - return adsbMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static int adsbMode(MemorySegment struct) { - return struct.get(adsbMode$LAYOUT, adsbMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static void adsbMode(MemorySegment struct, int fieldValue) { - struct.set(adsbMode$LAYOUT, adsbMode$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetT.java deleted file mode 100644 index e7894dc7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char DCenable; - * unsigned char IQenable; - * } - * } - */ -public class sdrplay_api_DcOffsetT { - - sdrplay_api_DcOffsetT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("DCenable"), - sdrplay_api_h.C_CHAR.withName("IQenable") - ).withName("$anon$23:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final OfByte DCenable$layout() { - return DCenable$LAYOUT; - } - - private static final long DCenable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final long DCenable$offset() { - return DCenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static byte DCenable(MemorySegment struct) { - return struct.get(DCenable$LAYOUT, DCenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static void DCenable(MemorySegment struct, byte fieldValue) { - struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue); - } - - private static final OfByte IQenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("IQenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final OfByte IQenable$layout() { - return IQenable$LAYOUT; - } - - private static final long IQenable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final long IQenable$offset() { - return IQenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static byte IQenable(MemorySegment struct) { - return struct.get(IQenable$LAYOUT, IQenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static void IQenable(MemorySegment struct, byte fieldValue) { - struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetTunerT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetTunerT.java deleted file mode 100644 index 9f66a02f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DcOffsetTunerT.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char dcCal; - * unsigned char speedUp; - * int trackTime; - * int refreshRateTime; - * } - * } - */ -public class sdrplay_api_DcOffsetTunerT { - - sdrplay_api_DcOffsetTunerT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("dcCal"), - sdrplay_api_h.C_CHAR.withName("speedUp"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("trackTime"), - sdrplay_api_h.C_INT.withName("refreshRateTime") - ).withName("$anon$75:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte dcCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("dcCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final OfByte dcCal$layout() { - return dcCal$LAYOUT; - } - - private static final long dcCal$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final long dcCal$offset() { - return dcCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static byte dcCal(MemorySegment struct) { - return struct.get(dcCal$LAYOUT, dcCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static void dcCal(MemorySegment struct, byte fieldValue) { - struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue); - } - - private static final OfByte speedUp$LAYOUT = (OfByte)$LAYOUT.select(groupElement("speedUp")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final OfByte speedUp$layout() { - return speedUp$LAYOUT; - } - - private static final long speedUp$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final long speedUp$offset() { - return speedUp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static byte speedUp(MemorySegment struct) { - return struct.get(speedUp$LAYOUT, speedUp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static void speedUp(MemorySegment struct, byte fieldValue) { - struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue); - } - - private static final OfInt trackTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("trackTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final OfInt trackTime$layout() { - return trackTime$LAYOUT; - } - - private static final long trackTime$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final long trackTime$offset() { - return trackTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static int trackTime(MemorySegment struct) { - return struct.get(trackTime$LAYOUT, trackTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static void trackTime(MemorySegment struct, int fieldValue) { - struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue); - } - - private static final OfInt refreshRateTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("refreshRateTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final OfInt refreshRateTime$layout() { - return refreshRateTime$LAYOUT; - } - - private static final long refreshRateTime$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final long refreshRateTime$offset() { - return refreshRateTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static int refreshRateTime(MemorySegment struct) { - return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static void refreshRateTime(MemorySegment struct, int fieldValue) { - struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DebugEnable_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DebugEnable_t.java deleted file mode 100644 index 3011524c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DebugEnable_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t) - * } - */ -public class sdrplay_api_DebugEnable_t { - - sdrplay_api_DebugEnable_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int dbgLvl); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DecimationT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DecimationT.java deleted file mode 100644 index e7d089dc..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DecimationT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char enable; - * unsigned char decimationFactor; - * unsigned char wideBandSignal; - * } - * } - */ -public class sdrplay_api_DecimationT { - - sdrplay_api_DecimationT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("enable"), - sdrplay_api_h.C_CHAR.withName("decimationFactor"), - sdrplay_api_h.C_CHAR.withName("wideBandSignal") - ).withName("$anon$29:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final OfByte enable$layout() { - return enable$LAYOUT; - } - - private static final long enable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final long enable$offset() { - return enable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static byte enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static void enable(MemorySegment struct, byte fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - private static final OfByte decimationFactor$LAYOUT = (OfByte)$LAYOUT.select(groupElement("decimationFactor")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final OfByte decimationFactor$layout() { - return decimationFactor$LAYOUT; - } - - private static final long decimationFactor$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final long decimationFactor$offset() { - return decimationFactor$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static byte decimationFactor(MemorySegment struct) { - return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static void decimationFactor(MemorySegment struct, byte fieldValue) { - struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue); - } - - private static final OfByte wideBandSignal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("wideBandSignal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final OfByte wideBandSignal$layout() { - return wideBandSignal$LAYOUT; - } - - private static final long wideBandSignal$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final long wideBandSignal$offset() { - return wideBandSignal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static byte wideBandSignal(MemorySegment struct) { - return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static void wideBandSignal(MemorySegment struct, byte fieldValue) { - struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DevParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DevParamsT.java deleted file mode 100644 index 3664bd85..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DevParamsT.java +++ /dev/null @@ -1,563 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * double ppm; - * sdrplay_api_FsFreqT fsFreq; - * sdrplay_api_SyncUpdateT syncUpdate; - * sdrplay_api_ResetFlagsT resetFlags; - * sdrplay_api_TransferModeT mode; - * unsigned int samplesPerPkt; - * sdrplay_api_Rsp1aParamsT rsp1aParams; - * sdrplay_api_Rsp2ParamsT rsp2Params; - * sdrplay_api_RspDuoParamsT rspDuoParams; - * sdrplay_api_RspDxParamsT rspDxParams; - * } - * } - */ -public class sdrplay_api_DevParamsT { - - sdrplay_api_DevParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("ppm"), - sdrplay_api_FsFreqT.layout().withName("fsFreq"), - sdrplay_api_SyncUpdateT.layout().withName("syncUpdate"), - sdrplay_api_ResetFlagsT.layout().withName("resetFlags"), - MemoryLayout.paddingLayout(1), - sdrplay_api_h.C_INT.withName("mode"), - sdrplay_api_h.C_INT.withName("samplesPerPkt"), - sdrplay_api_Rsp1aParamsT.layout().withName("rsp1aParams"), - sdrplay_api_Rsp2ParamsT.layout().withName("rsp2Params"), - MemoryLayout.paddingLayout(1), - sdrplay_api_RspDuoParamsT.layout().withName("rspDuoParams"), - sdrplay_api_RspDxParamsT.layout().withName("rspDxParams") - ).withName("$anon$37:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble ppm$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("ppm")); - - /** - * Layout for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final OfDouble ppm$layout() { - return ppm$LAYOUT; - } - - private static final long ppm$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final long ppm$offset() { - return ppm$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static double ppm(MemorySegment struct) { - return struct.get(ppm$LAYOUT, ppm$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static void ppm(MemorySegment struct, double fieldValue) { - struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue); - } - - private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final GroupLayout fsFreq$layout() { - return fsFreq$LAYOUT; - } - - private static final long fsFreq$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final long fsFreq$offset() { - return fsFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static MemorySegment fsFreq(MemorySegment struct) { - return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static void fsFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout syncUpdate$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final GroupLayout syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static MemorySegment syncUpdate(MemorySegment struct) { - return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final GroupLayout resetFlags$layout() { - return resetFlags$LAYOUT; - } - - private static final long resetFlags$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final long resetFlags$offset() { - return resetFlags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static MemorySegment resetFlags(MemorySegment struct) { - return struct.asSlice(resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static void resetFlags(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - private static final OfInt mode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final OfInt mode$layout() { - return mode$LAYOUT; - } - - private static final long mode$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final long mode$offset() { - return mode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static int mode(MemorySegment struct) { - return struct.get(mode$LAYOUT, mode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static void mode(MemorySegment struct, int fieldValue) { - struct.set(mode$LAYOUT, mode$OFFSET, fieldValue); - } - - private static final OfInt samplesPerPkt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("samplesPerPkt")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final OfInt samplesPerPkt$layout() { - return samplesPerPkt$LAYOUT; - } - - private static final long samplesPerPkt$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final long samplesPerPkt$offset() { - return samplesPerPkt$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static int samplesPerPkt(MemorySegment struct) { - return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static void samplesPerPkt(MemorySegment struct, int fieldValue) { - struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue); - } - - private static final GroupLayout rsp1aParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final GroupLayout rsp1aParams$layout() { - return rsp1aParams$LAYOUT; - } - - private static final long rsp1aParams$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final long rsp1aParams$offset() { - return rsp1aParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static MemorySegment rsp1aParams(MemorySegment struct) { - return struct.asSlice(rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static void rsp1aParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2Params$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2Params")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final GroupLayout rsp2Params$layout() { - return rsp2Params$LAYOUT; - } - - private static final long rsp2Params$OFFSET = 46; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final long rsp2Params$offset() { - return rsp2Params$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static MemorySegment rsp2Params(MemorySegment struct) { - return struct.asSlice(rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static void rsp2Params(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final GroupLayout rspDuoParams$layout() { - return rspDuoParams$LAYOUT; - } - - private static final long rspDuoParams$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final long rspDuoParams$offset() { - return rspDuoParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static MemorySegment rspDuoParams(MemorySegment struct) { - return struct.asSlice(rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static void rspDuoParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final GroupLayout rspDxParams$layout() { - return rspDxParams$LAYOUT; - } - - private static final long rspDxParams$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final long rspDxParams$offset() { - return rspDxParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static MemorySegment rspDxParams(MemorySegment struct) { - return struct.asSlice(rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static void rspDxParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceParamsT.java deleted file mode 100644 index bda26c2b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceParamsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DevParamsT *devParams; - * sdrplay_api_RxChannelParamsT *rxChannelA; - * sdrplay_api_RxChannelParamsT *rxChannelB; - * } - * } - */ -public class sdrplay_api_DeviceParamsT { - - sdrplay_api_DeviceParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_POINTER.withName("devParams"), - sdrplay_api_h.C_POINTER.withName("rxChannelA"), - sdrplay_api_h.C_POINTER.withName("rxChannelB") - ).withName("$anon$153:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout devParams$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("devParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final AddressLayout devParams$layout() { - return devParams$LAYOUT; - } - - private static final long devParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final long devParams$offset() { - return devParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static MemorySegment devParams(MemorySegment struct) { - return struct.get(devParams$LAYOUT, devParams$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static void devParams(MemorySegment struct, MemorySegment fieldValue) { - struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelA$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelA")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final AddressLayout rxChannelA$layout() { - return rxChannelA$LAYOUT; - } - - private static final long rxChannelA$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final long rxChannelA$offset() { - return rxChannelA$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static MemorySegment rxChannelA(MemorySegment struct) { - return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelB$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelB")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final AddressLayout rxChannelB$layout() { - return rxChannelB$LAYOUT; - } - - private static final long rxChannelB$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final long rxChannelB$offset() { - return rxChannelB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static MemorySegment rxChannelB(MemorySegment struct) { - return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceT.java deleted file mode 100644 index b7a5b39b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DeviceT.java +++ /dev/null @@ -1,417 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char SerNo[64]; - * unsigned char hwVer; - * sdrplay_api_TunerSelectT tuner; - * sdrplay_api_RspDuoModeT rspDuoMode; - * double rspDuoSampleFreq; - * HANDLE dev; - * } - * } - */ -public class sdrplay_api_DeviceT { - - sdrplay_api_DeviceT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, sdrplay_api_h.C_CHAR).withName("SerNo"), - sdrplay_api_h.C_CHAR.withName("hwVer"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner"), - sdrplay_api_h.C_INT.withName("rspDuoMode"), - MemoryLayout.paddingLayout(4), - sdrplay_api_h.C_DOUBLE.withName("rspDuoSampleFreq"), - sdrplay_api_h.C_POINTER.withName("dev") - ).withName("$anon$142:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout SerNo$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("SerNo")); - - /** - * Layout for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final SequenceLayout SerNo$layout() { - return SerNo$LAYOUT; - } - - private static final long SerNo$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final long SerNo$offset() { - return SerNo$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static MemorySegment SerNo(MemorySegment struct) { - return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - private static long[] SerNo$DIMS = { 64 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static long[] SerNo$dimensions() { - return SerNo$DIMS; - } - private static final VarHandle SerNo$ELEM_HANDLE = SerNo$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static byte SerNo(MemorySegment struct, long index0) { - return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, long index0, byte fieldValue) { - SerNo$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfByte hwVer$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hwVer")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final OfByte hwVer$layout() { - return hwVer$LAYOUT; - } - - private static final long hwVer$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final long hwVer$offset() { - return hwVer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static byte hwVer(MemorySegment struct) { - return struct.get(hwVer$LAYOUT, hwVer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static void hwVer(MemorySegment struct, byte fieldValue) { - struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue); - } - - private static final OfInt tuner$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final OfInt tuner$layout() { - return tuner$LAYOUT; - } - - private static final long tuner$OFFSET = 68; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final long tuner$offset() { - return tuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static int tuner(MemorySegment struct) { - return struct.get(tuner$LAYOUT, tuner$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static void tuner(MemorySegment struct, int fieldValue) { - struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue); - } - - private static final OfInt rspDuoMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rspDuoMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final OfInt rspDuoMode$layout() { - return rspDuoMode$LAYOUT; - } - - private static final long rspDuoMode$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final long rspDuoMode$offset() { - return rspDuoMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static int rspDuoMode(MemorySegment struct) { - return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static void rspDuoMode(MemorySegment struct, int fieldValue) { - struct.set(rspDuoMode$LAYOUT, rspDuoMode$OFFSET, fieldValue); - } - - private static final OfDouble rspDuoSampleFreq$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rspDuoSampleFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final OfDouble rspDuoSampleFreq$layout() { - return rspDuoSampleFreq$LAYOUT; - } - - private static final long rspDuoSampleFreq$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final long rspDuoSampleFreq$offset() { - return rspDuoSampleFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static double rspDuoSampleFreq(MemorySegment struct) { - return struct.get(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static void rspDuoSampleFreq(MemorySegment struct, double fieldValue) { - struct.set(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET, fieldValue); - } - - private static final AddressLayout dev$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dev")); - - /** - * Layout for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final AddressLayout dev$layout() { - return dev$LAYOUT; - } - - private static final long dev$OFFSET = 88; - - /** - * Offset for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final long dev$offset() { - return dev$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static MemorySegment dev(MemorySegment struct) { - return struct.get(dev$LAYOUT, dev$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static void dev(MemorySegment struct, MemorySegment fieldValue) { - struct.set(dev$LAYOUT, dev$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DisableHeartbeat_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DisableHeartbeat_t.java deleted file mode 100644 index ecde690b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_DisableHeartbeat_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void) - * } - */ -public class sdrplay_api_DisableHeartbeat_t { - - sdrplay_api_DisableHeartbeat_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ErrorInfoT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ErrorInfoT.java deleted file mode 100644 index ac3725a4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ErrorInfoT.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char file[256]; - * char function[256]; - * int line; - * char message[1024]; - * } - * } - */ -public class sdrplay_api_ErrorInfoT { - - sdrplay_api_ErrorInfoT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"), - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"), - sdrplay_api_h.C_INT.withName("line"), - MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message") - ).withName("$anon$161:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file")); - - /** - * Layout for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final SequenceLayout file$layout() { - return file$LAYOUT; - } - - private static final long file$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final long file$offset() { - return file$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static MemorySegment file(MemorySegment struct) { - return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize()); - } - - private static long[] file$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static long[] file$dimensions() { - return file$DIMS; - } - private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static byte file(MemorySegment struct, long index0) { - return (byte)file$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, long index0, byte fieldValue) { - file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function")); - - /** - * Layout for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final SequenceLayout function$layout() { - return function$LAYOUT; - } - - private static final long function$OFFSET = 256; - - /** - * Offset for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final long function$offset() { - return function$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static MemorySegment function(MemorySegment struct) { - return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize()); - } - - private static long[] function$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static long[] function$dimensions() { - return function$DIMS; - } - private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static byte function(MemorySegment struct, long index0) { - return (byte)function$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, long index0, byte fieldValue) { - function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line")); - - /** - * Layout for field: - * {@snippet lang=c : - * int line - * } - */ - public static final OfInt line$layout() { - return line$LAYOUT; - } - - private static final long line$OFFSET = 512; - - /** - * Offset for field: - * {@snippet lang=c : - * int line - * } - */ - public static final long line$offset() { - return line$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int line - * } - */ - public static int line(MemorySegment struct) { - return struct.get(line$LAYOUT, line$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int line - * } - */ - public static void line(MemorySegment struct, int fieldValue) { - struct.set(line$LAYOUT, line$OFFSET, fieldValue); - } - - private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message")); - - /** - * Layout for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final SequenceLayout message$layout() { - return message$LAYOUT; - } - - private static final long message$OFFSET = 516; - - /** - * Offset for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final long message$offset() { - return message$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static MemorySegment message(MemorySegment struct) { - return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize()); - } - - private static long[] message$DIMS = { 1024 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static long[] message$dimensions() { - return message$DIMS; - } - private static final VarHandle message$ELEM_HANDLE = message$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static byte message(MemorySegment struct, long index0) { - return (byte)message$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, long index0, byte fieldValue) { - message$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventCallback_t.java deleted file mode 100644 index 5f0d31a3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventCallback_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *) - * } - */ -public class sdrplay_api_EventCallback_t { - - sdrplay_api_EventCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventParamsT.java deleted file mode 100644 index ca131745..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_EventParamsT.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * union { - * sdrplay_api_GainCbParamT gainParams; - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * } - * } - */ -public class sdrplay_api_EventParamsT { - - sdrplay_api_EventParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( - sdrplay_api_GainCbParamT.layout().withName("gainParams"), - sdrplay_api_PowerOverloadCbParamT.layout().withName("powerOverloadParams"), - sdrplay_api_RspDuoModeCbParamT.layout().withName("rspDuoModeParams") - ).withName("$anon$49:9"); - - /** - * The layout of this union - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout gainParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final GroupLayout gainParams$layout() { - return gainParams$LAYOUT; - } - - private static final long gainParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final long gainParams$offset() { - return gainParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static MemorySegment gainParams(MemorySegment union) { - return union.asSlice(gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static void gainParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - private static final GroupLayout powerOverloadParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("powerOverloadParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final GroupLayout powerOverloadParams$layout() { - return powerOverloadParams$LAYOUT; - } - - private static final long powerOverloadParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final long powerOverloadParams$offset() { - return powerOverloadParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static MemorySegment powerOverloadParams(MemorySegment union) { - return union.asSlice(powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static void powerOverloadParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoModeParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoModeParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final GroupLayout rspDuoModeParams$layout() { - return rspDuoModeParams$LAYOUT; - } - - private static final long rspDuoModeParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final long rspDuoModeParams$offset() { - return rspDuoModeParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static MemorySegment rspDuoModeParams(MemorySegment union) { - return union.asSlice(rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static void rspDuoModeParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this union - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_FsFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_FsFreqT.java deleted file mode 100644 index d2e84540..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_FsFreqT.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double fsHz; - * unsigned char syncUpdate; - * unsigned char reCal; - * } - * } - */ -public class sdrplay_api_FsFreqT { - - sdrplay_api_FsFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("fsHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - sdrplay_api_h.C_CHAR.withName("reCal"), - MemoryLayout.paddingLayout(6) - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final OfDouble fsHz$layout() { - return fsHz$LAYOUT; - } - - private static final long fsHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final long fsHz$offset() { - return fsHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static double fsHz(MemorySegment struct) { - return struct.get(fsHz$LAYOUT, fsHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static void fsHz(MemorySegment struct, double fieldValue) { - struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfByte reCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("reCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final OfByte reCal$layout() { - return reCal$LAYOUT; - } - - private static final long reCal$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final long reCal$offset() { - return reCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static byte reCal(MemorySegment struct) { - return struct.get(reCal$LAYOUT, reCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static void reCal(MemorySegment struct, byte fieldValue) { - struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainCbParamT.java deleted file mode 100644 index 1b3c7e75..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainCbParamT.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned int gRdB; - * unsigned int lnaGRdB; - * double currGain; - * } - * } - */ -public class sdrplay_api_GainCbParamT { - - sdrplay_api_GainCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_INT.withName("lnaGRdB"), - sdrplay_api_h.C_DOUBLE.withName("currGain") - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfInt lnaGRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("lnaGRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final OfInt lnaGRdB$layout() { - return lnaGRdB$LAYOUT; - } - - private static final long lnaGRdB$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final long lnaGRdB$offset() { - return lnaGRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static int lnaGRdB(MemorySegment struct) { - return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static void lnaGRdB(MemorySegment struct, int fieldValue) { - struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue); - } - - private static final OfDouble currGain$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("currGain")); - - /** - * Layout for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final OfDouble currGain$layout() { - return currGain$LAYOUT; - } - - private static final long currGain$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final long currGain$offset() { - return currGain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static double currGain(MemorySegment struct) { - return struct.get(currGain$LAYOUT, currGain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static void currGain(MemorySegment struct, double fieldValue) { - struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainT.java deleted file mode 100644 index 60d428db..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainT.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * int gRdB; - * unsigned char LNAstate; - * unsigned char syncUpdate; - * sdrplay_api_MinGainReductionT minGr; - * sdrplay_api_GainValuesT gainVals; - * } - * } - */ -public class sdrplay_api_GainT { - - sdrplay_api_GainT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_CHAR.withName("LNAstate"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("minGr"), - sdrplay_api_GainValuesT.layout().withName("gainVals") - ).withName("$anon$60:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfByte LNAstate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("LNAstate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final OfByte LNAstate$layout() { - return LNAstate$LAYOUT; - } - - private static final long LNAstate$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final long LNAstate$offset() { - return LNAstate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static byte LNAstate(MemorySegment struct) { - return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static void LNAstate(MemorySegment struct, byte fieldValue) { - struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 5; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfInt minGr$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minGr")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final OfInt minGr$layout() { - return minGr$LAYOUT; - } - - private static final long minGr$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final long minGr$offset() { - return minGr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static int minGr(MemorySegment struct) { - return struct.get(minGr$LAYOUT, minGr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static void minGr(MemorySegment struct, int fieldValue) { - struct.set(minGr$LAYOUT, minGr$OFFSET, fieldValue); - } - - private static final GroupLayout gainVals$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainVals")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final GroupLayout gainVals$layout() { - return gainVals$LAYOUT; - } - - private static final long gainVals$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final long gainVals$offset() { - return gainVals$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static MemorySegment gainVals(MemorySegment struct) { - return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static void gainVals(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainValuesT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainValuesT.java deleted file mode 100644 index 4847603e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GainValuesT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfFloat; - -/** - * {@snippet lang=c : - * struct { - * float curr; - * float max; - * float min; - * } - * } - */ -public class sdrplay_api_GainValuesT { - - sdrplay_api_GainValuesT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_FLOAT.withName("curr"), - sdrplay_api_h.C_FLOAT.withName("max"), - sdrplay_api_h.C_FLOAT.withName("min") - ).withName("$anon$53:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr")); - - /** - * Layout for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final OfFloat curr$layout() { - return curr$LAYOUT; - } - - private static final long curr$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final long curr$offset() { - return curr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static float curr(MemorySegment struct) { - return struct.get(curr$LAYOUT, curr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static void curr(MemorySegment struct, float fieldValue) { - struct.set(curr$LAYOUT, curr$OFFSET, fieldValue); - } - - private static final OfFloat max$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("max")); - - /** - * Layout for field: - * {@snippet lang=c : - * float max - * } - */ - public static final OfFloat max$layout() { - return max$LAYOUT; - } - - private static final long max$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * float max - * } - */ - public static final long max$offset() { - return max$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float max - * } - */ - public static float max(MemorySegment struct) { - return struct.get(max$LAYOUT, max$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float max - * } - */ - public static void max(MemorySegment struct, float fieldValue) { - struct.set(max$LAYOUT, max$OFFSET, fieldValue); - } - - private static final OfFloat min$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("min")); - - /** - * Layout for field: - * {@snippet lang=c : - * float min - * } - */ - public static final OfFloat min$layout() { - return min$LAYOUT; - } - - private static final long min$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * float min - * } - */ - public static final long min$offset() { - return min$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float min - * } - */ - public static float min(MemorySegment struct) { - return struct.get(min$LAYOUT, min$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float min - * } - */ - public static void min(MemorySegment struct, float fieldValue) { - struct.set(min$LAYOUT, min$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDeviceParams_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDeviceParams_t.java deleted file mode 100644 index 1d2605d7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDeviceParams_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **) - * } - */ -public class sdrplay_api_GetDeviceParams_t { - - sdrplay_api_GetDeviceParams_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment deviceParams); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDevices_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDevices_t.java deleted file mode 100644 index cae0ac9e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetDevices_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int) - * } - */ -public class sdrplay_api_GetDevices_t { - - sdrplay_api_GetDevices_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetErrorString_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetErrorString_t.java deleted file mode 100644 index 6c4f3529..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetErrorString_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT) - * } - */ -public class sdrplay_api_GetErrorString_t { - - sdrplay_api_GetErrorString_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(int err); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,int err) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetLastError_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetLastError_t.java deleted file mode 100644 index a73dad14..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_GetLastError_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_GetLastError_t { - - sdrplay_api_GetLastError_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Init_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Init_t.java deleted file mode 100644 index a5ba0030..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Init_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *) - * } - */ -public class sdrplay_api_Init_t { - - sdrplay_api_Init_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_LockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_LockDeviceApi_t.java deleted file mode 100644 index 44fce499..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_LockDeviceApi_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_LockDeviceApi_t { - - sdrplay_api_LockDeviceApi_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Open_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Open_t.java deleted file mode 100644 index f3f33417..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Open_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void) - * } - */ -public class sdrplay_api_Open_t { - - sdrplay_api_Open_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_PowerOverloadCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_PowerOverloadCbParamT.java deleted file mode 100644 index db34076b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_PowerOverloadCbParamT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * } - * } - */ -public class sdrplay_api_PowerOverloadCbParamT { - - sdrplay_api_PowerOverloadCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("powerOverloadChangeType") - ).withName("$anon$38:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final OfInt powerOverloadChangeType$layout() { - return powerOverloadChangeType$LAYOUT; - } - - private static final long powerOverloadChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final long powerOverloadChangeType$offset() { - return powerOverloadChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static int powerOverloadChangeType(MemorySegment struct) { - return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) { - struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ReleaseDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ReleaseDevice_t.java deleted file mode 100644 index 7e19244a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ReleaseDevice_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_ReleaseDevice_t { - - sdrplay_api_ReleaseDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ResetFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ResetFlagsT.java deleted file mode 100644 index f02f9672..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_ResetFlagsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * unsigned char resetFsUpdate; - * } - * } - */ -public class sdrplay_api_ResetFlagsT { - - sdrplay_api_ResetFlagsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), - sdrplay_api_h.C_CHAR.withName("resetRfUpdate"), - sdrplay_api_h.C_CHAR.withName("resetFsUpdate") - ).withName("$anon$30:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final OfByte resetGainUpdate$layout() { - return resetGainUpdate$LAYOUT; - } - - private static final long resetGainUpdate$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final long resetGainUpdate$offset() { - return resetGainUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static byte resetGainUpdate(MemorySegment struct) { - return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetRfUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetRfUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final OfByte resetRfUpdate$layout() { - return resetRfUpdate$LAYOUT; - } - - private static final long resetRfUpdate$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final long resetRfUpdate$offset() { - return resetRfUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static byte resetRfUpdate(MemorySegment struct) { - return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetFsUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetFsUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final OfByte resetFsUpdate$layout() { - return resetFsUpdate$LAYOUT; - } - - private static final long resetFsUpdate$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final long resetFsUpdate$offset() { - return resetFsUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static byte resetFsUpdate(MemorySegment struct) { - return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static void resetFsUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RfFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RfFreqT.java deleted file mode 100644 index 450fa5a8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RfFreqT.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double rfHz; - * unsigned char syncUpdate; - * } - * } - */ -public class sdrplay_api_RfFreqT { - - sdrplay_api_RfFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("rfHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(7) - ).withName("$anon$69:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final OfDouble rfHz$layout() { - return rfHz$LAYOUT; - } - - private static final long rfHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final long rfHz$offset() { - return rfHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static double rfHz(MemorySegment struct) { - return struct.get(rfHz$LAYOUT, rfHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static void rfHz(MemorySegment struct, double fieldValue) { - struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aParamsT.java deleted file mode 100644 index dbaf54df..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aParamsT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aParamsT { - - sdrplay_api_Rsp1aParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable") - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aTunerParamsT.java deleted file mode 100644 index 77d1051e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp1aTunerParamsT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aTunerParamsT { - - sdrplay_api_Rsp1aTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable") - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2ParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2ParamsT.java deleted file mode 100644 index 2d8f6c04..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2ParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char extRefOutputEn; - * } - * } - */ -public class sdrplay_api_Rsp2ParamsT { - - sdrplay_api_Rsp2ParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("extRefOutputEn") - ).withName("$anon$22:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final OfByte extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static byte extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, byte fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2TunerParamsT.java deleted file mode 100644 index 4782664c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Rsp2TunerParamsT.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp2TunerParamsT { - - sdrplay_api_Rsp2TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("amPortSel"), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(3) - ).withName("$anon$27:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt amPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("amPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final OfInt amPortSel$layout() { - return amPortSel$LAYOUT; - } - - private static final long amPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final long amPortSel$offset() { - return amPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static int amPortSel(MemorySegment struct) { - return struct.get(amPortSel$LAYOUT, amPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static void amPortSel(MemorySegment struct, int fieldValue) { - struct.set(amPortSel$LAYOUT, amPortSel$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoModeCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoModeCbParamT.java deleted file mode 100644 index def8c8aa..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoModeCbParamT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * } - * } - */ -public class sdrplay_api_RspDuoModeCbParamT { - - sdrplay_api_RspDuoModeCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("modeChangeType") - ).withName("$anon$43:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt modeChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("modeChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final OfInt modeChangeType$layout() { - return modeChangeType$LAYOUT; - } - - private static final long modeChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final long modeChangeType$offset() { - return modeChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static int modeChangeType(MemorySegment struct) { - return struct.get(modeChangeType$LAYOUT, modeChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static void modeChangeType(MemorySegment struct, int fieldValue) { - struct.set(modeChangeType$LAYOUT, modeChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoParamsT.java deleted file mode 100644 index e405b7ca..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * int extRefOutputEn; - * } - * } - */ -public class sdrplay_api_RspDuoParamsT { - - sdrplay_api_RspDuoParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("extRefOutputEn") - ).withName("$anon$26:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt extRefOutputEn$LAYOUT = (OfInt)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final OfInt extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static int extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, int fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoTunerParamsT.java deleted file mode 100644 index 82538861..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDuoTunerParamsT.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; - * unsigned char tuner1AmNotchEnable; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_RspDuoTunerParamsT { - - sdrplay_api_RspDuoTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner1AmPortSel"), - sdrplay_api_h.C_CHAR.withName("tuner1AmNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(1) - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt tuner1AmPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner1AmPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final OfInt tuner1AmPortSel$layout() { - return tuner1AmPortSel$LAYOUT; - } - - private static final long tuner1AmPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final long tuner1AmPortSel$offset() { - return tuner1AmPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static int tuner1AmPortSel(MemorySegment struct) { - return struct.get(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static void tuner1AmPortSel(MemorySegment struct, int fieldValue) { - struct.set(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET, fieldValue); - } - - private static final OfByte tuner1AmNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("tuner1AmNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final OfByte tuner1AmNotchEnable$layout() { - return tuner1AmNotchEnable$LAYOUT; - } - - private static final long tuner1AmNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final long tuner1AmNotchEnable$offset() { - return tuner1AmNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static byte tuner1AmNotchEnable(MemorySegment struct) { - return struct.get(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static void tuner1AmNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 10; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxParamsT.java deleted file mode 100644 index 5df47a6a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxParamsT.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char hdrEnable; - * unsigned char biasTEnable; - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_RspDxParamsT { - - sdrplay_api_RspDxParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("hdrEnable"), - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(2) - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte hdrEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hdrEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final OfByte hdrEnable$layout() { - return hdrEnable$LAYOUT; - } - - private static final long hdrEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final long hdrEnable$offset() { - return hdrEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static byte hdrEnable(MemorySegment struct) { - return struct.get(hdrEnable$LAYOUT, hdrEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static void hdrEnable(MemorySegment struct, byte fieldValue) { - struct.set(hdrEnable$LAYOUT, hdrEnable$OFFSET, fieldValue); - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxTunerParamsT.java deleted file mode 100644 index 167ac3ad..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RspDxTunerParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * } - * } - */ -public class sdrplay_api_RspDxTunerParamsT { - - sdrplay_api_RspDxTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("hdrBw") - ).withName("$anon$40:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt hdrBw$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hdrBw")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final OfInt hdrBw$layout() { - return hdrBw$LAYOUT; - } - - private static final long hdrBw$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final long hdrBw$offset() { - return hdrBw$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static int hdrBw(MemorySegment struct) { - return struct.get(hdrBw$LAYOUT, hdrBw$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static void hdrBw(MemorySegment struct, int fieldValue) { - struct.set(hdrBw$LAYOUT, hdrBw$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RxChannelParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RxChannelParamsT.java deleted file mode 100644 index e4f0f43e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_RxChannelParamsT.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * 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; - * } - * } - */ -public class sdrplay_api_RxChannelParamsT { - - sdrplay_api_RxChannelParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_TunerParamsT.layout().withName("tunerParams"), - sdrplay_api_ControlParamsT.layout().withName("ctrlParams"), - sdrplay_api_Rsp1aTunerParamsT.layout().withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(3), - sdrplay_api_Rsp2TunerParamsT.layout().withName("rsp2TunerParams"), - sdrplay_api_RspDuoTunerParamsT.layout().withName("rspDuoTunerParams"), - sdrplay_api_RspDxTunerParamsT.layout().withName("rspDxTunerParams"), - MemoryLayout.paddingLayout(4) - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout tunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("tunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final GroupLayout tunerParams$layout() { - return tunerParams$LAYOUT; - } - - private static final long tunerParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final long tunerParams$offset() { - return tunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static MemorySegment tunerParams(MemorySegment struct) { - return struct.asSlice(tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static void tunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout ctrlParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("ctrlParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final GroupLayout ctrlParams$layout() { - return ctrlParams$LAYOUT; - } - - private static final long ctrlParams$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final long ctrlParams$offset() { - return ctrlParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static MemorySegment ctrlParams(MemorySegment struct) { - return struct.asSlice(ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static void ctrlParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp1aTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final GroupLayout rsp1aTunerParams$layout() { - return rsp1aTunerParams$LAYOUT; - } - - private static final long rsp1aTunerParams$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final long rsp1aTunerParams$offset() { - return rsp1aTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static MemorySegment rsp1aTunerParams(MemorySegment struct) { - return struct.asSlice(rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static void rsp1aTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2TunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2TunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final GroupLayout rsp2TunerParams$layout() { - return rsp2TunerParams$LAYOUT; - } - - private static final long rsp2TunerParams$OFFSET = 108; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final long rsp2TunerParams$offset() { - return rsp2TunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static MemorySegment rsp2TunerParams(MemorySegment struct) { - return struct.asSlice(rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static void rsp2TunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final GroupLayout rspDuoTunerParams$layout() { - return rspDuoTunerParams$LAYOUT; - } - - private static final long rspDuoTunerParams$OFFSET = 124; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final long rspDuoTunerParams$offset() { - return rspDuoTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static MemorySegment rspDuoTunerParams(MemorySegment struct) { - return struct.asSlice(rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static void rspDuoTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final GroupLayout rspDxTunerParams$layout() { - return rspDxTunerParams$LAYOUT; - } - - private static final long rspDxTunerParams$OFFSET = 136; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final long rspDxTunerParams$offset() { - return rspDxTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static MemorySegment rspDxTunerParams(MemorySegment struct) { - return struct.asSlice(rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static void rspDxTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SelectDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SelectDevice_t.java deleted file mode 100644 index f6d93c4f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SelectDevice_t.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_SelectDevice_t { - - sdrplay_api_SelectDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SelectDevice_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_SelectDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCallback_t.java deleted file mode 100644 index 823949d7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCallback_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_StreamCallback_t)(short *, short *, sdrplay_api_StreamCbParamsT *, unsigned int, unsigned int, void *) - * } - */ -public class sdrplay_api_StreamCallback_t { - - sdrplay_api_StreamCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - 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_StreamCallback_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_StreamCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, xi, xq, params, numSamples, reset, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCbParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCbParamsT.java deleted file mode 100644 index ac468322..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_StreamCbParamsT.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned int firstSampleNum; - * int grChanged; - * int rfChanged; - * int fsChanged; - * unsigned int numSamples; - * } - * } - */ -public class sdrplay_api_StreamCbParamsT { - - sdrplay_api_StreamCbParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("firstSampleNum"), - sdrplay_api_h.C_INT.withName("grChanged"), - sdrplay_api_h.C_INT.withName("rfChanged"), - sdrplay_api_h.C_INT.withName("fsChanged"), - sdrplay_api_h.C_INT.withName("numSamples") - ).withName("$anon$57:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt firstSampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("firstSampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final OfInt firstSampleNum$layout() { - return firstSampleNum$LAYOUT; - } - - private static final long firstSampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final long firstSampleNum$offset() { - return firstSampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static int firstSampleNum(MemorySegment struct) { - return struct.get(firstSampleNum$LAYOUT, firstSampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static void firstSampleNum(MemorySegment struct, int fieldValue) { - struct.set(firstSampleNum$LAYOUT, firstSampleNum$OFFSET, fieldValue); - } - - private static final OfInt grChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("grChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final OfInt grChanged$layout() { - return grChanged$LAYOUT; - } - - private static final long grChanged$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final long grChanged$offset() { - return grChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static int grChanged(MemorySegment struct) { - return struct.get(grChanged$LAYOUT, grChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static void grChanged(MemorySegment struct, int fieldValue) { - struct.set(grChanged$LAYOUT, grChanged$OFFSET, fieldValue); - } - - private static final OfInt rfChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rfChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final OfInt rfChanged$layout() { - return rfChanged$LAYOUT; - } - - private static final long rfChanged$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final long rfChanged$offset() { - return rfChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static int rfChanged(MemorySegment struct) { - return struct.get(rfChanged$LAYOUT, rfChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static void rfChanged(MemorySegment struct, int fieldValue) { - struct.set(rfChanged$LAYOUT, rfChanged$OFFSET, fieldValue); - } - - private static final OfInt fsChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("fsChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final OfInt fsChanged$layout() { - return fsChanged$LAYOUT; - } - - private static final long fsChanged$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final long fsChanged$offset() { - return fsChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static int fsChanged(MemorySegment struct) { - return struct.get(fsChanged$LAYOUT, fsChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static void fsChanged(MemorySegment struct, int fieldValue) { - struct.set(fsChanged$LAYOUT, fsChanged$OFFSET, fieldValue); - } - - private static final OfInt numSamples$LAYOUT = (OfInt)$LAYOUT.select(groupElement("numSamples")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final OfInt numSamples$layout() { - return numSamples$LAYOUT; - } - - private static final long numSamples$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final long numSamples$offset() { - return numSamples$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static int numSamples(MemorySegment struct) { - return struct.get(numSamples$LAYOUT, numSamples$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static void numSamples(MemorySegment struct, int fieldValue) { - struct.set(numSamples$LAYOUT, numSamples$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoActiveTuner_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoActiveTuner_t.java deleted file mode 100644 index 302a9922..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoActiveTuner_t.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE, sdrplay_api_TunerSelectT *, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoActiveTuner_t { - - sdrplay_api_SwapRspDuoActiveTuner_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_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_SwapRspDuoActiveTuner_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java deleted file mode 100644 index 2f1fee7a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *) - * } - */ -public class sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - - sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currentSampleRate); - } - - 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_SwapRspDuoDualTunerModeSampleRate_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_SwapRspDuoDualTunerModeSampleRate_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 currentSampleRate) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoMode_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoMode_t.java deleted file mode 100644 index 040537b6..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SwapRspDuoMode_t.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *, sdrplay_api_DeviceParamsT **, sdrplay_api_RspDuoModeT, double, sdrplay_api_TunerSelectT, sdrplay_api_Bw_MHzT, sdrplay_api_If_kHzT, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoMode_t { - - sdrplay_api_SwapRspDuoMode_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_DOUBLE, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_SwapRspDuoMode_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_SwapRspDuoMode_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 currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SyncUpdateT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SyncUpdateT.java deleted file mode 100644 index e6765eed..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_SyncUpdateT.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned int sampleNum; - * unsigned int period; - * } - * } - */ -public class sdrplay_api_SyncUpdateT { - - sdrplay_api_SyncUpdateT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("sampleNum"), - sdrplay_api_h.C_INT.withName("period") - ).withName("$anon$24:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt sampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final OfInt sampleNum$layout() { - return sampleNum$LAYOUT; - } - - private static final long sampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final long sampleNum$offset() { - return sampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static int sampleNum(MemorySegment struct) { - return struct.get(sampleNum$LAYOUT, sampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static void sampleNum(MemorySegment struct, int fieldValue) { - struct.set(sampleNum$LAYOUT, sampleNum$OFFSET, fieldValue); - } - - private static final OfInt period$LAYOUT = (OfInt)$LAYOUT.select(groupElement("period")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final OfInt period$layout() { - return period$LAYOUT; - } - - private static final long period$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final long period$offset() { - return period$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static int period(MemorySegment struct) { - return struct.get(period$LAYOUT, period$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static void period(MemorySegment struct, int fieldValue) { - struct.set(period$LAYOUT, period$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_TunerParamsT.java deleted file mode 100644 index e33730e8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_TunerParamsT.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_Bw_MHzT bwType; - * sdrplay_api_If_kHzT ifType; - * sdrplay_api_LoModeT loMode; - * sdrplay_api_GainT gain; - * sdrplay_api_RfFreqT rfFreq; - * sdrplay_api_DcOffsetTunerT dcOffsetTuner; - * } - * } - */ -public class sdrplay_api_TunerParamsT { - - sdrplay_api_TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("bwType"), - sdrplay_api_h.C_INT.withName("ifType"), - sdrplay_api_h.C_INT.withName("loMode"), - sdrplay_api_GainT.layout().withName("gain"), - MemoryLayout.paddingLayout(4), - sdrplay_api_RfFreqT.layout().withName("rfFreq"), - sdrplay_api_DcOffsetTunerT.layout().withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(4) - ).withName("$anon$83:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt bwType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("bwType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final OfInt bwType$layout() { - return bwType$LAYOUT; - } - - private static final long bwType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final long bwType$offset() { - return bwType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static int bwType(MemorySegment struct) { - return struct.get(bwType$LAYOUT, bwType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static void bwType(MemorySegment struct, int fieldValue) { - struct.set(bwType$LAYOUT, bwType$OFFSET, fieldValue); - } - - private static final OfInt ifType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ifType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final OfInt ifType$layout() { - return ifType$LAYOUT; - } - - private static final long ifType$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final long ifType$offset() { - return ifType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static int ifType(MemorySegment struct) { - return struct.get(ifType$LAYOUT, ifType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static void ifType(MemorySegment struct, int fieldValue) { - struct.set(ifType$LAYOUT, ifType$OFFSET, fieldValue); - } - - private static final OfInt loMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("loMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final OfInt loMode$layout() { - return loMode$LAYOUT; - } - - private static final long loMode$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final long loMode$offset() { - return loMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static int loMode(MemorySegment struct) { - return struct.get(loMode$LAYOUT, loMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static void loMode(MemorySegment struct, int fieldValue) { - struct.set(loMode$LAYOUT, loMode$OFFSET, fieldValue); - } - - private static final GroupLayout gain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gain")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final GroupLayout gain$layout() { - return gain$LAYOUT; - } - - private static final long gain$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final long gain$offset() { - return gain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static MemorySegment gain(MemorySegment struct) { - return struct.asSlice(gain$OFFSET, gain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static void gain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gain$OFFSET, gain$LAYOUT.byteSize()); - } - - private static final GroupLayout rfFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rfFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final GroupLayout rfFreq$layout() { - return rfFreq$LAYOUT; - } - - private static final long rfFreq$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final long rfFreq$offset() { - return rfFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static MemorySegment rfFreq(MemorySegment struct) { - return struct.asSlice(rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static void rfFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout dcOffsetTuner$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffsetTuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final GroupLayout dcOffsetTuner$layout() { - return dcOffsetTuner$LAYOUT; - } - - private static final long dcOffsetTuner$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final long dcOffsetTuner$offset() { - return dcOffsetTuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static MemorySegment dcOffsetTuner(MemorySegment struct) { - return struct.asSlice(dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static void dcOffsetTuner(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Uninit_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Uninit_t.java deleted file mode 100644 index 302b639a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Uninit_t.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE) - * } - */ -public class sdrplay_api_Uninit_t { - - sdrplay_api_Uninit_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev); - } - - 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_Uninit_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_Uninit_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_UnlockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_UnlockDeviceApi_t.java deleted file mode 100644 index bce38dad..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_UnlockDeviceApi_t.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_UnlockDeviceApi_t { - - sdrplay_api_UnlockDeviceApi_t() { - // Should not be called directly - } - - /** - * 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_UnlockDeviceApi_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_UnlockDeviceApi_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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Update_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Update_t.java deleted file mode 100644 index c3c4e358..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_Update_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE, sdrplay_api_TunerSelectT, sdrplay_api_ReasonForUpdateT, sdrplay_api_ReasonForUpdateExtension1T) - * } - */ -public class sdrplay_api_Update_t { - - sdrplay_api_Update_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_Update_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_Update_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_h.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_h.java deleted file mode 100644 index dd5fccf0..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/sdrplay_api_h.java +++ /dev/null @@ -1,2736 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayLibraryHelper; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.Arena; -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.PaddingLayout; -import java.lang.foreign.SequenceLayout; -import java.lang.foreign.StructLayout; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.util.Arrays; -import java.util.stream.Collectors; - -import static java.lang.foreign.ValueLayout.JAVA_BYTE; - -public class sdrplay_api_h { - - sdrplay_api_h() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - if(SYMBOL_LOOKUP == null) - { - throw new UnsatisfiedLinkError("unresolved symbol:" + symbol); - } - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library - static SymbolLookup SYMBOL_LOOKUP; - static - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e) - { - if(SDRPlayLibraryHelper.LOADED_FROM_PATH) - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(SDRPlayLibraryHelper.LIBRARY_PATH, LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e2) - { - SYMBOL_LOOKUP = null; - } - } - else - { - SYMBOL_LOOKUP = null; - } - } - } - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; - private static final int RSPIA_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES 10 - * } - */ - public static int RSPIA_NUM_LNA_STATES() { - return RSPIA_NUM_LNA_STATES; - } - private static final int RSPIA_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPIA_NUM_LNA_STATES_AM() { - return RSPIA_NUM_LNA_STATES_AM; - } - private static final int RSPIA_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPIA_NUM_LNA_STATES_LBAND() { - return RSPIA_NUM_LNA_STATES_LBAND; - } - private static final int RSPII_NUM_LNA_STATES = (int)9L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES 9 - * } - */ - public static int RSPII_NUM_LNA_STATES() { - return RSPII_NUM_LNA_STATES; - } - private static final int RSPII_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPII_NUM_LNA_STATES_AMPORT() { - return RSPII_NUM_LNA_STATES_AMPORT; - } - private static final int RSPII_NUM_LNA_STATES_420MHZ = (int)6L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_420MHZ 6 - * } - */ - public static int RSPII_NUM_LNA_STATES_420MHZ() { - return RSPII_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDUO_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES 10 - * } - */ - public static int RSPDUO_NUM_LNA_STATES() { - return RSPDUO_NUM_LNA_STATES; - } - private static final int RSPDUO_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return RSPDUO_NUM_LNA_STATES_AMPORT; - } - private static final int RSPDUO_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AM() { - return RSPDUO_NUM_LNA_STATES_AM; - } - private static final int RSPDUO_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return RSPDUO_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES = (int)28L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES 28 - * } - */ - public static int RSPDX_NUM_LNA_STATES() { - return RSPDX_NUM_LNA_STATES; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_0_12 = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return RSPDX_NUM_LNA_STATES_AMPORT2_0_12; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_12_60 = (int)20L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_60 20 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_60() { - return RSPDX_NUM_LNA_STATES_AMPORT2_12_60; - } - private static final int RSPDX_NUM_LNA_STATES_VHF_BAND3 = (int)27L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 - * } - */ - public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return RSPDX_NUM_LNA_STATES_VHF_BAND3; - } - private static final int RSPDX_NUM_LNA_STATES_420MHZ = (int)21L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_420MHZ 21 - * } - */ - public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return RSPDX_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDX_NUM_LNA_STATES_LBAND = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_LBAND 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_LBAND() { - return RSPDX_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES_DX = (int)26L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_DX 26 - * } - */ - public static int RSPDX_NUM_LNA_STATES_DX() { - return RSPDX_NUM_LNA_STATES_DX; - } - private static final int sdrplay_api_Rsp2_ANTENNA_A = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_A() { - return sdrplay_api_Rsp2_ANTENNA_A; - } - private static final int sdrplay_api_Rsp2_ANTENNA_B = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_B() { - return sdrplay_api_Rsp2_ANTENNA_B; - } - private static final int sdrplay_api_Rsp2_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_1() { - return sdrplay_api_Rsp2_AMPORT_1; - } - private static final int sdrplay_api_Rsp2_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_2() { - return sdrplay_api_Rsp2_AMPORT_2; - } - private static final int sdrplay_api_RspDuoMode_Unknown = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Unknown = 0 - * } - */ - public static int sdrplay_api_RspDuoMode_Unknown() { - return sdrplay_api_RspDuoMode_Unknown; - } - private static final int sdrplay_api_RspDuoMode_Single_Tuner = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1 - * } - */ - public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return sdrplay_api_RspDuoMode_Single_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Dual_Tuner = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2 - * } - */ - public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return sdrplay_api_RspDuoMode_Dual_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Master = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Master = 4 - * } - */ - public static int sdrplay_api_RspDuoMode_Master() { - return sdrplay_api_RspDuoMode_Master; - } - private static final int sdrplay_api_RspDuoMode_Slave = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Slave = 8 - * } - */ - public static int sdrplay_api_RspDuoMode_Slave() { - return sdrplay_api_RspDuoMode_Slave; - } - private static final int sdrplay_api_RspDuo_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_1() { - return sdrplay_api_RspDuo_AMPORT_1; - } - private static final int sdrplay_api_RspDuo_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_2() { - return sdrplay_api_RspDuo_AMPORT_2; - } - private static final int sdrplay_api_BW_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_Undefined = 0 - * } - */ - public static int sdrplay_api_BW_Undefined() { - return sdrplay_api_BW_Undefined; - } - private static final int sdrplay_api_BW_0_200 = (int)200L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_200 = 200 - * } - */ - public static int sdrplay_api_BW_0_200() { - return sdrplay_api_BW_0_200; - } - private static final int sdrplay_api_BW_0_300 = (int)300L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_300 = 300 - * } - */ - public static int sdrplay_api_BW_0_300() { - return sdrplay_api_BW_0_300; - } - private static final int sdrplay_api_BW_0_600 = (int)600L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_600 = 600 - * } - */ - public static int sdrplay_api_BW_0_600() { - return sdrplay_api_BW_0_600; - } - private static final int sdrplay_api_BW_1_536 = (int)1536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_1_536 = 1536 - * } - */ - public static int sdrplay_api_BW_1_536() { - return sdrplay_api_BW_1_536; - } - private static final int sdrplay_api_BW_5_000 = (int)5000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_5_000 = 5000 - * } - */ - public static int sdrplay_api_BW_5_000() { - return sdrplay_api_BW_5_000; - } - private static final int sdrplay_api_BW_6_000 = (int)6000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_6_000 = 6000 - * } - */ - public static int sdrplay_api_BW_6_000() { - return sdrplay_api_BW_6_000; - } - private static final int sdrplay_api_BW_7_000 = (int)7000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_7_000 = 7000 - * } - */ - public static int sdrplay_api_BW_7_000() { - return sdrplay_api_BW_7_000; - } - private static final int sdrplay_api_BW_8_000 = (int)8000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_8_000 = 8000 - * } - */ - public static int sdrplay_api_BW_8_000() { - return sdrplay_api_BW_8_000; - } - private static final int sdrplay_api_IF_Undefined = (int)-1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Undefined = -1 - * } - */ - public static int sdrplay_api_IF_Undefined() { - return sdrplay_api_IF_Undefined; - } - private static final int sdrplay_api_IF_Zero = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Zero = 0 - * } - */ - public static int sdrplay_api_IF_Zero() { - return sdrplay_api_IF_Zero; - } - private static final int sdrplay_api_IF_0_450 = (int)450L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_0_450 = 450 - * } - */ - public static int sdrplay_api_IF_0_450() { - return sdrplay_api_IF_0_450; - } - private static final int sdrplay_api_IF_1_620 = (int)1620L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_1_620 = 1620 - * } - */ - public static int sdrplay_api_IF_1_620() { - return sdrplay_api_IF_1_620; - } - private static final int sdrplay_api_IF_2_048 = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_2_048 = 2048 - * } - */ - public static int sdrplay_api_IF_2_048() { - return sdrplay_api_IF_2_048; - } - private static final int sdrplay_api_LO_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Undefined = 0 - * } - */ - public static int sdrplay_api_LO_Undefined() { - return sdrplay_api_LO_Undefined; - } - private static final int sdrplay_api_LO_Auto = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Auto = 1 - * } - */ - public static int sdrplay_api_LO_Auto() { - return sdrplay_api_LO_Auto; - } - private static final int sdrplay_api_LO_120MHz = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_120MHz = 2 - * } - */ - public static int sdrplay_api_LO_120MHz() { - return sdrplay_api_LO_120MHz; - } - private static final int sdrplay_api_LO_144MHz = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_144MHz = 3 - * } - */ - public static int sdrplay_api_LO_144MHz() { - return sdrplay_api_LO_144MHz; - } - private static final int sdrplay_api_LO_168MHz = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_168MHz = 4 - * } - */ - public static int sdrplay_api_LO_168MHz() { - return sdrplay_api_LO_168MHz; - } - private static final int sdrplay_api_EXTENDED_MIN_GR = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0 - * } - */ - public static int sdrplay_api_EXTENDED_MIN_GR() { - return sdrplay_api_EXTENDED_MIN_GR; - } - private static final int sdrplay_api_NORMAL_MIN_GR = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NORMAL_MIN_GR = 20 - * } - */ - public static int sdrplay_api_NORMAL_MIN_GR() { - return sdrplay_api_NORMAL_MIN_GR; - } - private static final int sdrplay_api_Tuner_Neither = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Neither = 0 - * } - */ - public static int sdrplay_api_Tuner_Neither() { - return sdrplay_api_Tuner_Neither; - } - private static final int sdrplay_api_Tuner_A = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_A = 1 - * } - */ - public static int sdrplay_api_Tuner_A() { - return sdrplay_api_Tuner_A; - } - private static final int sdrplay_api_Tuner_B = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_B = 2 - * } - */ - public static int sdrplay_api_Tuner_B() { - return sdrplay_api_Tuner_B; - } - private static final int sdrplay_api_Tuner_Both = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Both = 3 - * } - */ - public static int sdrplay_api_Tuner_Both() { - return sdrplay_api_Tuner_Both; - } - private static final int sdrplay_api_RspDx_ANTENNA_A = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_A() { - return sdrplay_api_RspDx_ANTENNA_A; - } - private static final int sdrplay_api_RspDx_ANTENNA_B = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_B() { - return sdrplay_api_RspDx_ANTENNA_B; - } - private static final int sdrplay_api_RspDx_ANTENNA_C = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_C() { - return sdrplay_api_RspDx_ANTENNA_C; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_200 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return sdrplay_api_RspDx_HDRMODE_BW_0_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_500 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return sdrplay_api_RspDx_HDRMODE_BW_0_500; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_200 = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return sdrplay_api_RspDx_HDRMODE_BW_1_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_700 = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return sdrplay_api_RspDx_HDRMODE_BW_1_700; - } - private static final int sdrplay_api_ISOCH = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ISOCH = 0 - * } - */ - public static int sdrplay_api_ISOCH() { - return sdrplay_api_ISOCH; - } - private static final int sdrplay_api_BULK = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BULK = 1 - * } - */ - public static int sdrplay_api_BULK() { - return sdrplay_api_BULK; - } - private static final int sdrplay_api_AGC_DISABLE = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_DISABLE = 0 - * } - */ - public static int sdrplay_api_AGC_DISABLE() { - return sdrplay_api_AGC_DISABLE; - } - private static final int sdrplay_api_AGC_100HZ = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_100HZ = 1 - * } - */ - public static int sdrplay_api_AGC_100HZ() { - return sdrplay_api_AGC_100HZ; - } - private static final int sdrplay_api_AGC_50HZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_50HZ = 2 - * } - */ - public static int sdrplay_api_AGC_50HZ() { - return sdrplay_api_AGC_50HZ; - } - private static final int sdrplay_api_AGC_5HZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_5HZ = 3 - * } - */ - public static int sdrplay_api_AGC_5HZ() { - return sdrplay_api_AGC_5HZ; - } - private static final int sdrplay_api_AGC_CTRL_EN = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_CTRL_EN = 4 - * } - */ - public static int sdrplay_api_AGC_CTRL_EN() { - return sdrplay_api_AGC_CTRL_EN; - } - private static final int sdrplay_api_ADSB_DECIMATION = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_DECIMATION = 0 - * } - */ - public static int sdrplay_api_ADSB_DECIMATION() { - return sdrplay_api_ADSB_DECIMATION; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return sdrplay_api_ADSB_NO_DECIMATION_LOWPASS; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ; - } - private static final int sdrplay_api_Overload_Detected = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Detected = 0 - * } - */ - public static int sdrplay_api_Overload_Detected() { - return sdrplay_api_Overload_Detected; - } - private static final int sdrplay_api_Overload_Corrected = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Corrected = 1 - * } - */ - public static int sdrplay_api_Overload_Corrected() { - return sdrplay_api_Overload_Corrected; - } - private static final int sdrplay_api_MasterInitialised = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterInitialised = 0 - * } - */ - public static int sdrplay_api_MasterInitialised() { - return sdrplay_api_MasterInitialised; - } - private static final int sdrplay_api_SlaveAttached = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveAttached = 1 - * } - */ - public static int sdrplay_api_SlaveAttached() { - return sdrplay_api_SlaveAttached; - } - private static final int sdrplay_api_SlaveDetached = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDetached = 2 - * } - */ - public static int sdrplay_api_SlaveDetached() { - return sdrplay_api_SlaveDetached; - } - private static final int sdrplay_api_SlaveInitialised = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveInitialised = 3 - * } - */ - public static int sdrplay_api_SlaveInitialised() { - return sdrplay_api_SlaveInitialised; - } - private static final int sdrplay_api_SlaveUninitialised = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveUninitialised = 4 - * } - */ - public static int sdrplay_api_SlaveUninitialised() { - return sdrplay_api_SlaveUninitialised; - } - private static final int sdrplay_api_MasterDllDisappeared = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterDllDisappeared = 5 - * } - */ - public static int sdrplay_api_MasterDllDisappeared() { - return sdrplay_api_MasterDllDisappeared; - } - private static final int sdrplay_api_SlaveDllDisappeared = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDllDisappeared = 6 - * } - */ - public static int sdrplay_api_SlaveDllDisappeared() { - return sdrplay_api_SlaveDllDisappeared; - } - private static final int sdrplay_api_GainChange = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainChange = 0 - * } - */ - public static int sdrplay_api_GainChange() { - return sdrplay_api_GainChange; - } - private static final int sdrplay_api_PowerOverloadChange = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_PowerOverloadChange = 1 - * } - */ - public static int sdrplay_api_PowerOverloadChange() { - return sdrplay_api_PowerOverloadChange; - } - private static final int sdrplay_api_DeviceRemoved = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DeviceRemoved = 2 - * } - */ - public static int sdrplay_api_DeviceRemoved() { - return sdrplay_api_DeviceRemoved; - } - private static final int sdrplay_api_RspDuoModeChange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoModeChange = 3 - * } - */ - public static int sdrplay_api_RspDuoModeChange() { - return sdrplay_api_RspDuoModeChange; - } - /** - * {@snippet lang=c : - * typedef void *HANDLE - * } - */ - public static final AddressLayout HANDLE = sdrplay_api_h.C_POINTER; - private static final int sdrplay_api_Success = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Success = 0 - * } - */ - public static int sdrplay_api_Success() { - return sdrplay_api_Success; - } - private static final int sdrplay_api_Fail = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Fail = 1 - * } - */ - public static int sdrplay_api_Fail() { - return sdrplay_api_Fail; - } - private static final int sdrplay_api_InvalidParam = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidParam = 2 - * } - */ - public static int sdrplay_api_InvalidParam() { - return sdrplay_api_InvalidParam; - } - private static final int sdrplay_api_OutOfRange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfRange = 3 - * } - */ - public static int sdrplay_api_OutOfRange() { - return sdrplay_api_OutOfRange; - } - private static final int sdrplay_api_GainUpdateError = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainUpdateError = 4 - * } - */ - public static int sdrplay_api_GainUpdateError() { - return sdrplay_api_GainUpdateError; - } - private static final int sdrplay_api_RfUpdateError = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RfUpdateError = 5 - * } - */ - public static int sdrplay_api_RfUpdateError() { - return sdrplay_api_RfUpdateError; - } - private static final int sdrplay_api_FsUpdateError = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FsUpdateError = 6 - * } - */ - public static int sdrplay_api_FsUpdateError() { - return sdrplay_api_FsUpdateError; - } - private static final int sdrplay_api_HwError = (int)7L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwError = 7 - * } - */ - public static int sdrplay_api_HwError() { - return sdrplay_api_HwError; - } - private static final int sdrplay_api_AliasingError = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AliasingError = 8 - * } - */ - public static int sdrplay_api_AliasingError() { - return sdrplay_api_AliasingError; - } - private static final int sdrplay_api_AlreadyInitialised = (int)9L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AlreadyInitialised = 9 - * } - */ - public static int sdrplay_api_AlreadyInitialised() { - return sdrplay_api_AlreadyInitialised; - } - private static final int sdrplay_api_NotInitialised = (int)10L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotInitialised = 10 - * } - */ - public static int sdrplay_api_NotInitialised() { - return sdrplay_api_NotInitialised; - } - private static final int sdrplay_api_NotEnabled = (int)11L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotEnabled = 11 - * } - */ - public static int sdrplay_api_NotEnabled() { - return sdrplay_api_NotEnabled; - } - private static final int sdrplay_api_HwVerError = (int)12L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwVerError = 12 - * } - */ - public static int sdrplay_api_HwVerError() { - return sdrplay_api_HwVerError; - } - private static final int sdrplay_api_OutOfMemError = (int)13L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfMemError = 13 - * } - */ - public static int sdrplay_api_OutOfMemError() { - return sdrplay_api_OutOfMemError; - } - private static final int sdrplay_api_ServiceNotResponding = (int)14L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ServiceNotResponding = 14 - * } - */ - public static int sdrplay_api_ServiceNotResponding() { - return sdrplay_api_ServiceNotResponding; - } - private static final int sdrplay_api_StartPending = (int)15L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StartPending = 15 - * } - */ - public static int sdrplay_api_StartPending() { - return sdrplay_api_StartPending; - } - private static final int sdrplay_api_StopPending = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StopPending = 16 - * } - */ - public static int sdrplay_api_StopPending() { - return sdrplay_api_StopPending; - } - private static final int sdrplay_api_InvalidMode = (int)17L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidMode = 17 - * } - */ - public static int sdrplay_api_InvalidMode() { - return sdrplay_api_InvalidMode; - } - private static final int sdrplay_api_FailedVerification1 = (int)18L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification1 = 18 - * } - */ - public static int sdrplay_api_FailedVerification1() { - return sdrplay_api_FailedVerification1; - } - private static final int sdrplay_api_FailedVerification2 = (int)19L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification2 = 19 - * } - */ - public static int sdrplay_api_FailedVerification2() { - return sdrplay_api_FailedVerification2; - } - private static final int sdrplay_api_FailedVerification3 = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification3 = 20 - * } - */ - public static int sdrplay_api_FailedVerification3() { - return sdrplay_api_FailedVerification3; - } - private static final int sdrplay_api_FailedVerification4 = (int)21L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification4 = 21 - * } - */ - public static int sdrplay_api_FailedVerification4() { - return sdrplay_api_FailedVerification4; - } - private static final int sdrplay_api_FailedVerification5 = (int)22L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification5 = 22 - * } - */ - public static int sdrplay_api_FailedVerification5() { - return sdrplay_api_FailedVerification5; - } - private static final int sdrplay_api_FailedVerification6 = (int)23L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification6 = 23 - * } - */ - public static int sdrplay_api_FailedVerification6() { - return sdrplay_api_FailedVerification6; - } - private static final int sdrplay_api_InvalidServiceVersion = (int)24L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidServiceVersion = 24 - * } - */ - public static int sdrplay_api_InvalidServiceVersion() { - return sdrplay_api_InvalidServiceVersion; - } - private static final int sdrplay_api_Update_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_None = 0 - * } - */ - public static int sdrplay_api_Update_None() { - return sdrplay_api_Update_None; - } - private static final int sdrplay_api_Update_Dev_Fs = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Fs = 1 - * } - */ - public static int sdrplay_api_Update_Dev_Fs() { - return sdrplay_api_Update_Dev_Fs; - } - private static final int sdrplay_api_Update_Dev_Ppm = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Ppm = 2 - * } - */ - public static int sdrplay_api_Update_Dev_Ppm() { - return sdrplay_api_Update_Dev_Ppm; - } - private static final int sdrplay_api_Update_Dev_SyncUpdate = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4 - * } - */ - public static int sdrplay_api_Update_Dev_SyncUpdate() { - return sdrplay_api_Update_Dev_SyncUpdate; - } - private static final int sdrplay_api_Update_Dev_ResetFlags = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8 - * } - */ - public static int sdrplay_api_Update_Dev_ResetFlags() { - return sdrplay_api_Update_Dev_ResetFlags; - } - private static final int sdrplay_api_Update_Rsp1a_BiasTControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16 - * } - */ - public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return sdrplay_api_Update_Rsp1a_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfNotchControl = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return sdrplay_api_Update_Rsp1a_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfDabNotchControl = (int)64L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return sdrplay_api_Update_Rsp1a_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_BiasTControl = (int)128L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128 - * } - */ - public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return sdrplay_api_Update_Rsp2_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp2_AmPortSelect = (int)256L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256 - * } - */ - public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return sdrplay_api_Update_Rsp2_AmPortSelect; - } - private static final int sdrplay_api_Update_Rsp2_AntennaControl = (int)512L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512 - * } - */ - public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return sdrplay_api_Update_Rsp2_AntennaControl; - } - private static final int sdrplay_api_Update_Rsp2_RfNotchControl = (int)1024L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024 - * } - */ - public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return sdrplay_api_Update_Rsp2_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_ExtRefControl = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048 - * } - */ - public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return sdrplay_api_Update_Rsp2_ExtRefControl; - } - private static final int sdrplay_api_Update_RspDuo_ExtRefControl = (int)4096L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096 - * } - */ - public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return sdrplay_api_Update_RspDuo_ExtRefControl; - } - private static final int sdrplay_api_Update_Master_Spare_1 = (int)8192L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192 - * } - */ - public static int sdrplay_api_Update_Master_Spare_1() { - return sdrplay_api_Update_Master_Spare_1; - } - private static final int sdrplay_api_Update_Master_Spare_2 = (int)16384L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384 - * } - */ - public static int sdrplay_api_Update_Master_Spare_2() { - return sdrplay_api_Update_Master_Spare_2; - } - private static final int sdrplay_api_Update_Tuner_Gr = (int)32768L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Gr = 32768 - * } - */ - public static int sdrplay_api_Update_Tuner_Gr() { - return sdrplay_api_Update_Tuner_Gr; - } - private static final int sdrplay_api_Update_Tuner_GrLimits = (int)65536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536 - * } - */ - public static int sdrplay_api_Update_Tuner_GrLimits() { - return sdrplay_api_Update_Tuner_GrLimits; - } - private static final int sdrplay_api_Update_Tuner_Frf = (int)131072L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Frf = 131072 - * } - */ - public static int sdrplay_api_Update_Tuner_Frf() { - return sdrplay_api_Update_Tuner_Frf; - } - private static final int sdrplay_api_Update_Tuner_BwType = (int)262144L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_BwType = 262144 - * } - */ - public static int sdrplay_api_Update_Tuner_BwType() { - return sdrplay_api_Update_Tuner_BwType; - } - private static final int sdrplay_api_Update_Tuner_IfType = (int)524288L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_IfType = 524288 - * } - */ - public static int sdrplay_api_Update_Tuner_IfType() { - return sdrplay_api_Update_Tuner_IfType; - } - private static final int sdrplay_api_Update_Tuner_DcOffset = (int)1048576L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576 - * } - */ - public static int sdrplay_api_Update_Tuner_DcOffset() { - return sdrplay_api_Update_Tuner_DcOffset; - } - private static final int sdrplay_api_Update_Tuner_LoMode = (int)2097152L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152 - * } - */ - public static int sdrplay_api_Update_Tuner_LoMode() { - return sdrplay_api_Update_Tuner_LoMode; - } - private static final int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = (int)4194304L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304 - * } - */ - public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return sdrplay_api_Update_Ctrl_DCoffsetIQimbalance; - } - private static final int sdrplay_api_Update_Ctrl_Decimation = (int)8388608L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608 - * } - */ - public static int sdrplay_api_Update_Ctrl_Decimation() { - return sdrplay_api_Update_Ctrl_Decimation; - } - private static final int sdrplay_api_Update_Ctrl_Agc = (int)16777216L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216 - * } - */ - public static int sdrplay_api_Update_Ctrl_Agc() { - return sdrplay_api_Update_Ctrl_Agc; - } - private static final int sdrplay_api_Update_Ctrl_AdsbMode = (int)33554432L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432 - * } - */ - public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return sdrplay_api_Update_Ctrl_AdsbMode; - } - private static final int sdrplay_api_Update_Ctrl_OverloadMsgAck = (int)67108864L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864 - * } - */ - public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return sdrplay_api_Update_Ctrl_OverloadMsgAck; - } - private static final int sdrplay_api_Update_RspDuo_BiasTControl = (int)134217728L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728 - * } - */ - public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return sdrplay_api_Update_RspDuo_BiasTControl; - } - private static final int sdrplay_api_Update_RspDuo_AmPortSelect = (int)268435456L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456 - * } - */ - public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return sdrplay_api_Update_RspDuo_AmPortSelect; - } - private static final int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = (int)536870912L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912 - * } - */ - public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return sdrplay_api_Update_RspDuo_Tuner1AmNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfNotchControl = (int)1073741824L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return sdrplay_api_Update_RspDuo_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfDabNotchControl = (int)-2147483648L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return sdrplay_api_Update_RspDuo_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Ext1_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ext1_None = 0 - * } - */ - public static int sdrplay_api_Update_Ext1_None() { - return sdrplay_api_Update_Ext1_None; - } - private static final int sdrplay_api_Update_RspDx_HdrEnable = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrEnable() { - return sdrplay_api_Update_RspDx_HdrEnable; - } - private static final int sdrplay_api_Update_RspDx_BiasTControl = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2 - * } - */ - public static int sdrplay_api_Update_RspDx_BiasTControl() { - return sdrplay_api_Update_RspDx_BiasTControl; - } - private static final int sdrplay_api_Update_RspDx_AntennaControl = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4 - * } - */ - public static int sdrplay_api_Update_RspDx_AntennaControl() { - return sdrplay_api_Update_RspDx_AntennaControl; - } - private static final int sdrplay_api_Update_RspDx_RfNotchControl = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8 - * } - */ - public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return sdrplay_api_Update_RspDx_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDx_RfDabNotchControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16 - * } - */ - public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return sdrplay_api_Update_RspDx_RfDabNotchControl; - } - private static final int sdrplay_api_Update_RspDx_HdrBw = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrBw() { - return sdrplay_api_Update_RspDx_HdrBw; - } - private static final int sdrplay_api_DbgLvl_Disable = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Disable = 0 - * } - */ - public static int sdrplay_api_DbgLvl_Disable() { - return sdrplay_api_DbgLvl_Disable; - } - private static final int sdrplay_api_DbgLvl_Verbose = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Verbose = 1 - * } - */ - public static int sdrplay_api_DbgLvl_Verbose() { - return sdrplay_api_DbgLvl_Verbose; - } - private static final int sdrplay_api_DbgLvl_Warning = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Warning = 2 - * } - */ - public static int sdrplay_api_DbgLvl_Warning() { - return sdrplay_api_DbgLvl_Warning; - } - private static final int sdrplay_api_DbgLvl_Error = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Error = 3 - * } - */ - public static int sdrplay_api_DbgLvl_Error() { - return sdrplay_api_DbgLvl_Error; - } - private static final int sdrplay_api_DbgLvl_Message = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Message = 4 - * } - */ - public static int sdrplay_api_DbgLvl_Message() { - return sdrplay_api_DbgLvl_Message; - } - - private static class sdrplay_api_Open { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Open"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static FunctionDescriptor sdrplay_api_Open$descriptor() { - return sdrplay_api_Open.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static MethodHandle sdrplay_api_Open$handle() { - return sdrplay_api_Open.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static MemorySegment sdrplay_api_Open$address() { - return sdrplay_api_Open.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static int sdrplay_api_Open() { - var mh$ = sdrplay_api_Open.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Open"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Close { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Close"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static FunctionDescriptor sdrplay_api_Close$descriptor() { - return sdrplay_api_Close.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static MethodHandle sdrplay_api_Close$handle() { - return sdrplay_api_Close.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static MemorySegment sdrplay_api_Close$address() { - return sdrplay_api_Close.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static int sdrplay_api_Close() { - var mh$ = sdrplay_api_Close.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Close"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_ApiVersion { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_ApiVersion"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static FunctionDescriptor sdrplay_api_ApiVersion$descriptor() { - return sdrplay_api_ApiVersion.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static MethodHandle sdrplay_api_ApiVersion$handle() { - return sdrplay_api_ApiVersion.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static MemorySegment sdrplay_api_ApiVersion$address() { - return sdrplay_api_ApiVersion.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static int sdrplay_api_ApiVersion(MemorySegment apiVer) { - var mh$ = sdrplay_api_ApiVersion.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_ApiVersion", apiVer); - } - return (int)mh$.invokeExact(apiVer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_LockDeviceApi { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_LockDeviceApi"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static FunctionDescriptor sdrplay_api_LockDeviceApi$descriptor() { - return sdrplay_api_LockDeviceApi.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static MethodHandle sdrplay_api_LockDeviceApi$handle() { - return sdrplay_api_LockDeviceApi.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static MemorySegment sdrplay_api_LockDeviceApi$address() { - return sdrplay_api_LockDeviceApi.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static int sdrplay_api_LockDeviceApi() { - var mh$ = sdrplay_api_LockDeviceApi.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_LockDeviceApi"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_UnlockDeviceApi { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_UnlockDeviceApi"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static FunctionDescriptor sdrplay_api_UnlockDeviceApi$descriptor() { - return sdrplay_api_UnlockDeviceApi.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static MethodHandle sdrplay_api_UnlockDeviceApi$handle() { - return sdrplay_api_UnlockDeviceApi.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static MemorySegment sdrplay_api_UnlockDeviceApi$address() { - return sdrplay_api_UnlockDeviceApi.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static int sdrplay_api_UnlockDeviceApi() { - var mh$ = sdrplay_api_UnlockDeviceApi.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_UnlockDeviceApi"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetDevices { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetDevices"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static FunctionDescriptor sdrplay_api_GetDevices$descriptor() { - return sdrplay_api_GetDevices.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static MethodHandle sdrplay_api_GetDevices$handle() { - return sdrplay_api_GetDevices.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static MemorySegment sdrplay_api_GetDevices$address() { - return sdrplay_api_GetDevices.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static int sdrplay_api_GetDevices(MemorySegment devices, MemorySegment numDevs, int maxDevs) { - var mh$ = sdrplay_api_GetDevices.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetDevices", devices, numDevs, maxDevs); - } - return (int)mh$.invokeExact(devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SelectDevice { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SelectDevice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_SelectDevice$descriptor() { - return sdrplay_api_SelectDevice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_SelectDevice$handle() { - return sdrplay_api_SelectDevice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_SelectDevice$address() { - return sdrplay_api_SelectDevice.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static int sdrplay_api_SelectDevice(MemorySegment device) { - var mh$ = sdrplay_api_SelectDevice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SelectDevice", device); - } - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_ReleaseDevice { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_ReleaseDevice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_ReleaseDevice$descriptor() { - return sdrplay_api_ReleaseDevice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_ReleaseDevice$handle() { - return sdrplay_api_ReleaseDevice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_ReleaseDevice$address() { - return sdrplay_api_ReleaseDevice.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static int sdrplay_api_ReleaseDevice(MemorySegment device) { - var mh$ = sdrplay_api_ReleaseDevice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_ReleaseDevice", device); - } - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetErrorString { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetErrorString"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static FunctionDescriptor sdrplay_api_GetErrorString$descriptor() { - return sdrplay_api_GetErrorString.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MethodHandle sdrplay_api_GetErrorString$handle() { - return sdrplay_api_GetErrorString.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MemorySegment sdrplay_api_GetErrorString$address() { - return sdrplay_api_GetErrorString.ADDR; - } - - /** - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MemorySegment sdrplay_api_GetErrorString(int err) { - var mh$ = sdrplay_api_GetErrorString.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetErrorString", err); - } - return (MemorySegment)mh$.invokeExact(err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetLastError { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetLastError"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_GetLastError$descriptor() { - return sdrplay_api_GetLastError.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_GetLastError$handle() { - return sdrplay_api_GetLastError.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_GetLastError$address() { - return sdrplay_api_GetLastError.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_GetLastError(MemorySegment device) { - var mh$ = sdrplay_api_GetLastError.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetLastError", device); - } - return (MemorySegment)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_DisableHeartbeat { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_DisableHeartbeat"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static FunctionDescriptor sdrplay_api_DisableHeartbeat$descriptor() { - return sdrplay_api_DisableHeartbeat.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static MethodHandle sdrplay_api_DisableHeartbeat$handle() { - return sdrplay_api_DisableHeartbeat.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static MemorySegment sdrplay_api_DisableHeartbeat$address() { - return sdrplay_api_DisableHeartbeat.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static int sdrplay_api_DisableHeartbeat() { - var mh$ = sdrplay_api_DisableHeartbeat.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_DisableHeartbeat"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_DebugEnable { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_DebugEnable"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static FunctionDescriptor sdrplay_api_DebugEnable$descriptor() { - return sdrplay_api_DebugEnable.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static MethodHandle sdrplay_api_DebugEnable$handle() { - return sdrplay_api_DebugEnable.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static MemorySegment sdrplay_api_DebugEnable$address() { - return sdrplay_api_DebugEnable.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static int sdrplay_api_DebugEnable(MemorySegment dev, int enable) { - var mh$ = sdrplay_api_DebugEnable.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_DebugEnable", dev, enable); - } - return (int)mh$.invokeExact(dev, enable); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetDeviceParams { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetDeviceParams"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static FunctionDescriptor sdrplay_api_GetDeviceParams$descriptor() { - return sdrplay_api_GetDeviceParams.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static MethodHandle sdrplay_api_GetDeviceParams$handle() { - return sdrplay_api_GetDeviceParams.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static MemorySegment sdrplay_api_GetDeviceParams$address() { - return sdrplay_api_GetDeviceParams.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static int sdrplay_api_GetDeviceParams(MemorySegment dev, MemorySegment deviceParams) { - var mh$ = sdrplay_api_GetDeviceParams.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetDeviceParams", dev, deviceParams); - } - return (int)mh$.invokeExact(dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Init { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Init"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static FunctionDescriptor sdrplay_api_Init$descriptor() { - return sdrplay_api_Init.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static MethodHandle sdrplay_api_Init$handle() { - return sdrplay_api_Init.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static MemorySegment sdrplay_api_Init$address() { - return sdrplay_api_Init.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static int sdrplay_api_Init(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { - var mh$ = sdrplay_api_Init.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Init", dev, callbackFns, cbContext); - } - return (int)mh$.invokeExact(dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Uninit { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Uninit"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static FunctionDescriptor sdrplay_api_Uninit$descriptor() { - return sdrplay_api_Uninit.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static MethodHandle sdrplay_api_Uninit$handle() { - return sdrplay_api_Uninit.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static MemorySegment sdrplay_api_Uninit$address() { - return sdrplay_api_Uninit.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static int sdrplay_api_Uninit(MemorySegment dev) { - var mh$ = sdrplay_api_Uninit.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Uninit", dev); - } - return (int)mh$.invokeExact(dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Update { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Update"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static FunctionDescriptor sdrplay_api_Update$descriptor() { - return sdrplay_api_Update.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static MethodHandle sdrplay_api_Update$handle() { - return sdrplay_api_Update.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static MemorySegment sdrplay_api_Update$address() { - return sdrplay_api_Update.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static int sdrplay_api_Update(MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1) { - var mh$ = sdrplay_api_Update.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Update", dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } - return (int)mh$.invokeExact(dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoActiveTuner { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoActiveTuner"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner$descriptor() { - return sdrplay_api_SwapRspDuoActiveTuner.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoActiveTuner$handle() { - return sdrplay_api_SwapRspDuoActiveTuner.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoActiveTuner$address() { - return sdrplay_api_SwapRspDuoActiveTuner.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static int sdrplay_api_SwapRspDuoActiveTuner(MemorySegment dev, MemorySegment currentTuner, int tuner1AmPortSel) { - var mh$ = sdrplay_api_SwapRspDuoActiveTuner.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoActiveTuner", dev, currentTuner, tuner1AmPortSel); - } - return (int)mh$.invokeExact(dev, currentTuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoDualTunerModeSampleRate { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoDualTunerModeSampleRate"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate$descriptor() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$handle() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoDualTunerModeSampleRate$address() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate) - * } - */ - public static int sdrplay_api_SwapRspDuoDualTunerModeSampleRate(MemorySegment dev, MemorySegment currentSampleRate) { - var mh$ = sdrplay_api_SwapRspDuoDualTunerModeSampleRate.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoDualTunerModeSampleRate", dev, currentSampleRate); - } - return (int)mh$.invokeExact(dev, currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoMode { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_DOUBLE, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoMode"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * 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) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoMode$descriptor() { - return sdrplay_api_SwapRspDuoMode.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * 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) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoMode$handle() { - return sdrplay_api_SwapRspDuoMode.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * 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) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoMode$address() { - return sdrplay_api_SwapRspDuoMode.ADDR; - } - - /** - * {@snippet lang=c : - * 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) - * } - */ - public static int sdrplay_api_SwapRspDuoMode(MemorySegment currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel) { - var mh$ = sdrplay_api_SwapRspDuoMode.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoMode", currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } - return (int)mh$.invokeExact(currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int MAX_BB_GR = (int)59L; - /** - * {@snippet lang=c : - * #define MAX_BB_GR 59 - * } - */ - public static int MAX_BB_GR() { - return MAX_BB_GR; - } - private static final float SDRPLAY_API_VERSION = 3.069999933242798f; - /** - * {@snippet lang=c : - * #define SDRPLAY_API_VERSION 3.069999933242798 - * } - */ - public static float SDRPLAY_API_VERSION() { - return SDRPLAY_API_VERSION; - } - private static final int SDRPLAY_MAX_DEVICES = (int)16L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_DEVICES 16 - * } - */ - public static int SDRPLAY_MAX_DEVICES() { - return SDRPLAY_MAX_DEVICES; - } - private static final int SDRPLAY_MAX_TUNERS_PER_DEVICE = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 - * } - */ - public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return SDRPLAY_MAX_TUNERS_PER_DEVICE; - } - private static final int SDRPLAY_MAX_SER_NO_LEN = (int)64L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_SER_NO_LEN 64 - * } - */ - public static int SDRPLAY_MAX_SER_NO_LEN() { - return SDRPLAY_MAX_SER_NO_LEN; - } - private static final int SDRPLAY_MAX_ROOT_NM_LEN = (int)32L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_ROOT_NM_LEN 32 - * } - */ - public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return SDRPLAY_MAX_ROOT_NM_LEN; - } - private static final int SDRPLAY_RSP1_ID = (int)1L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1_ID 1 - * } - */ - public static int SDRPLAY_RSP1_ID() { - return SDRPLAY_RSP1_ID; - } - private static final int SDRPLAY_RSP1A_ID = (int)255L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1A_ID 255 - * } - */ - public static int SDRPLAY_RSP1A_ID() { - return SDRPLAY_RSP1A_ID; - } - private static final int SDRPLAY_RSP2_ID = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP2_ID 2 - * } - */ - public static int SDRPLAY_RSP2_ID() { - return SDRPLAY_RSP2_ID; - } - private static final int SDRPLAY_RSPduo_ID = (int)3L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPduo_ID 3 - * } - */ - public static int SDRPLAY_RSPduo_ID() { - return SDRPLAY_RSPduo_ID; - } - private static final int SDRPLAY_RSPdx_ID = (int)4L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPdx_ID 4 - * } - */ - public static int SDRPLAY_RSPdx_ID() { - return SDRPLAY_RSPdx_ID; - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_AgcT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_AgcT.java deleted file mode 100644 index 4ef29628..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_AgcT.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.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 lang=c : - * struct { - * sdrplay_api_AgcControlT enable; - * int setPoint_dBfs; - * unsigned short attack_ms; - * unsigned short decay_ms; - * unsigned short decay_delay_ms; - * unsigned short decay_threshold_dB; - * int syncUpdate; - * } - * } - */ -public class sdrplay_api_AgcT { - - sdrplay_api_AgcT() { - // Should not be called directly - } - - 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 lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static int enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static void enable(MemorySegment struct, int fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int setPoint_dBfs - * } - */ - public static int setPoint_dBfs(MemorySegment struct) { - return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int setPoint_dBfs - * } - */ - public static void setPoint_dBfs(MemorySegment struct, int fieldValue) { - struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short attack_ms - * } - */ - public static short attack_ms(MemorySegment struct) { - return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short attack_ms - * } - */ - public static void attack_ms(MemorySegment struct, short fieldValue) { - struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_ms - * } - */ - public static short decay_ms(MemorySegment struct) { - return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_ms - * } - */ - public static void decay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_delay_ms - * } - */ - public static short decay_delay_ms(MemorySegment struct) { - return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_delay_ms - * } - */ - public static void decay_delay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static short decay_threshold_dB(MemorySegment struct) { - return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static void decay_threshold_dB(MemorySegment struct, short fieldValue) { - struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int syncUpdate - * } - */ - public static int syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, int fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ApiVersion_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ApiVersion_t.java deleted file mode 100644 index c2242733..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ApiVersion_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *) - * } - */ -public class sdrplay_api_ApiVersion_t { - - sdrplay_api_ApiVersion_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_CallbackFnsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_CallbackFnsT.java deleted file mode 100644 index a9b9e2fb..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_CallbackFnsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_StreamCallback_t StreamACbFn; - * sdrplay_api_StreamCallback_t StreamBCbFn; - * sdrplay_api_EventCallback_t EventCbFn; - * } - * } - */ -public class sdrplay_api_CallbackFnsT { - - sdrplay_api_CallbackFnsT() { - // Should not be called directly - } - - 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 lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static MemorySegment StreamACbFn(MemorySegment struct) { - return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static void StreamACbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamACbFn$LAYOUT, StreamACbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static MemorySegment StreamBCbFn(MemorySegment struct) { - return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static MemorySegment EventCbFn(MemorySegment struct) { - return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Close_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Close_t.java deleted file mode 100644 index c90f9403..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Close_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void) - * } - */ -public class sdrplay_api_Close_t { - - sdrplay_api_Close_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ControlParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ControlParamsT.java deleted file mode 100644 index 7f60a6a8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ControlParamsT.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DcOffsetT dcOffset; - * sdrplay_api_DecimationT decimation; - * sdrplay_api_AgcT agc; - * sdrplay_api_AdsbModeT adsbMode; - * } - * } - */ -public class sdrplay_api_ControlParamsT { - - sdrplay_api_ControlParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_DcOffsetT.layout().withName("dcOffset"), - sdrplay_api_DecimationT.layout().withName("decimation"), - MemoryLayout.paddingLayout(3), - sdrplay_api_AgcT.layout().withName("agc"), - sdrplay_api_h.C_INT.withName("adsbMode") - ).withName("$anon$47:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout dcOffset$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffset")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final GroupLayout dcOffset$layout() { - return dcOffset$LAYOUT; - } - - private static final long dcOffset$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final long dcOffset$offset() { - return dcOffset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static MemorySegment dcOffset(MemorySegment struct) { - return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final GroupLayout decimation$layout() { - return decimation$LAYOUT; - } - - private static final long decimation$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final long decimation$offset() { - return decimation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static MemorySegment decimation(MemorySegment struct) { - return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static void decimation(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - private static final GroupLayout agc$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("agc")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final GroupLayout agc$layout() { - return agc$LAYOUT; - } - - private static final long agc$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final long agc$offset() { - return agc$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static MemorySegment agc(MemorySegment struct) { - return struct.asSlice(agc$OFFSET, agc$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static void agc(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, agc$OFFSET, agc$LAYOUT.byteSize()); - } - - private static final OfInt adsbMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("adsbMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final OfInt adsbMode$layout() { - return adsbMode$LAYOUT; - } - - private static final long adsbMode$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final long adsbMode$offset() { - return adsbMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static int adsbMode(MemorySegment struct) { - return struct.get(adsbMode$LAYOUT, adsbMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static void adsbMode(MemorySegment struct, int fieldValue) { - struct.set(adsbMode$LAYOUT, adsbMode$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetT.java deleted file mode 100644 index 49f555c1..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char DCenable; - * unsigned char IQenable; - * } - * } - */ -public class sdrplay_api_DcOffsetT { - - sdrplay_api_DcOffsetT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("DCenable"), - sdrplay_api_h.C_CHAR.withName("IQenable") - ).withName("$anon$23:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final OfByte DCenable$layout() { - return DCenable$LAYOUT; - } - - private static final long DCenable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final long DCenable$offset() { - return DCenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static byte DCenable(MemorySegment struct) { - return struct.get(DCenable$LAYOUT, DCenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static void DCenable(MemorySegment struct, byte fieldValue) { - struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue); - } - - private static final OfByte IQenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("IQenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final OfByte IQenable$layout() { - return IQenable$LAYOUT; - } - - private static final long IQenable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final long IQenable$offset() { - return IQenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static byte IQenable(MemorySegment struct) { - return struct.get(IQenable$LAYOUT, IQenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static void IQenable(MemorySegment struct, byte fieldValue) { - struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetTunerT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetTunerT.java deleted file mode 100644 index 1178e9e3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DcOffsetTunerT.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char dcCal; - * unsigned char speedUp; - * int trackTime; - * int refreshRateTime; - * } - * } - */ -public class sdrplay_api_DcOffsetTunerT { - - sdrplay_api_DcOffsetTunerT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("dcCal"), - sdrplay_api_h.C_CHAR.withName("speedUp"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("trackTime"), - sdrplay_api_h.C_INT.withName("refreshRateTime") - ).withName("$anon$75:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte dcCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("dcCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final OfByte dcCal$layout() { - return dcCal$LAYOUT; - } - - private static final long dcCal$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final long dcCal$offset() { - return dcCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static byte dcCal(MemorySegment struct) { - return struct.get(dcCal$LAYOUT, dcCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static void dcCal(MemorySegment struct, byte fieldValue) { - struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue); - } - - private static final OfByte speedUp$LAYOUT = (OfByte)$LAYOUT.select(groupElement("speedUp")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final OfByte speedUp$layout() { - return speedUp$LAYOUT; - } - - private static final long speedUp$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final long speedUp$offset() { - return speedUp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static byte speedUp(MemorySegment struct) { - return struct.get(speedUp$LAYOUT, speedUp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static void speedUp(MemorySegment struct, byte fieldValue) { - struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue); - } - - private static final OfInt trackTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("trackTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final OfInt trackTime$layout() { - return trackTime$LAYOUT; - } - - private static final long trackTime$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final long trackTime$offset() { - return trackTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static int trackTime(MemorySegment struct) { - return struct.get(trackTime$LAYOUT, trackTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static void trackTime(MemorySegment struct, int fieldValue) { - struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue); - } - - private static final OfInt refreshRateTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("refreshRateTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final OfInt refreshRateTime$layout() { - return refreshRateTime$LAYOUT; - } - - private static final long refreshRateTime$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final long refreshRateTime$offset() { - return refreshRateTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static int refreshRateTime(MemorySegment struct) { - return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static void refreshRateTime(MemorySegment struct, int fieldValue) { - struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DebugEnable_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DebugEnable_t.java deleted file mode 100644 index c59c5f00..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DebugEnable_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t) - * } - */ -public class sdrplay_api_DebugEnable_t { - - sdrplay_api_DebugEnable_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int dbgLvl); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DecimationT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DecimationT.java deleted file mode 100644 index 90262c73..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DecimationT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char enable; - * unsigned char decimationFactor; - * unsigned char wideBandSignal; - * } - * } - */ -public class sdrplay_api_DecimationT { - - sdrplay_api_DecimationT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("enable"), - sdrplay_api_h.C_CHAR.withName("decimationFactor"), - sdrplay_api_h.C_CHAR.withName("wideBandSignal") - ).withName("$anon$29:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final OfByte enable$layout() { - return enable$LAYOUT; - } - - private static final long enable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final long enable$offset() { - return enable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static byte enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static void enable(MemorySegment struct, byte fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - private static final OfByte decimationFactor$LAYOUT = (OfByte)$LAYOUT.select(groupElement("decimationFactor")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final OfByte decimationFactor$layout() { - return decimationFactor$LAYOUT; - } - - private static final long decimationFactor$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final long decimationFactor$offset() { - return decimationFactor$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static byte decimationFactor(MemorySegment struct) { - return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static void decimationFactor(MemorySegment struct, byte fieldValue) { - struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue); - } - - private static final OfByte wideBandSignal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("wideBandSignal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final OfByte wideBandSignal$layout() { - return wideBandSignal$LAYOUT; - } - - private static final long wideBandSignal$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final long wideBandSignal$offset() { - return wideBandSignal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static byte wideBandSignal(MemorySegment struct) { - return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static void wideBandSignal(MemorySegment struct, byte fieldValue) { - struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DevParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DevParamsT.java deleted file mode 100644 index 3767288c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DevParamsT.java +++ /dev/null @@ -1,563 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * double ppm; - * sdrplay_api_FsFreqT fsFreq; - * sdrplay_api_SyncUpdateT syncUpdate; - * sdrplay_api_ResetFlagsT resetFlags; - * sdrplay_api_TransferModeT mode; - * unsigned int samplesPerPkt; - * sdrplay_api_Rsp1aParamsT rsp1aParams; - * sdrplay_api_Rsp2ParamsT rsp2Params; - * sdrplay_api_RspDuoParamsT rspDuoParams; - * sdrplay_api_RspDxParamsT rspDxParams; - * } - * } - */ -public class sdrplay_api_DevParamsT { - - sdrplay_api_DevParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("ppm"), - sdrplay_api_FsFreqT.layout().withName("fsFreq"), - sdrplay_api_SyncUpdateT.layout().withName("syncUpdate"), - sdrplay_api_ResetFlagsT.layout().withName("resetFlags"), - MemoryLayout.paddingLayout(1), - sdrplay_api_h.C_INT.withName("mode"), - sdrplay_api_h.C_INT.withName("samplesPerPkt"), - sdrplay_api_Rsp1aParamsT.layout().withName("rsp1aParams"), - sdrplay_api_Rsp2ParamsT.layout().withName("rsp2Params"), - MemoryLayout.paddingLayout(1), - sdrplay_api_RspDuoParamsT.layout().withName("rspDuoParams"), - sdrplay_api_RspDxParamsT.layout().withName("rspDxParams") - ).withName("$anon$37:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble ppm$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("ppm")); - - /** - * Layout for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final OfDouble ppm$layout() { - return ppm$LAYOUT; - } - - private static final long ppm$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final long ppm$offset() { - return ppm$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static double ppm(MemorySegment struct) { - return struct.get(ppm$LAYOUT, ppm$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static void ppm(MemorySegment struct, double fieldValue) { - struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue); - } - - private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final GroupLayout fsFreq$layout() { - return fsFreq$LAYOUT; - } - - private static final long fsFreq$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final long fsFreq$offset() { - return fsFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static MemorySegment fsFreq(MemorySegment struct) { - return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static void fsFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout syncUpdate$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final GroupLayout syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static MemorySegment syncUpdate(MemorySegment struct) { - return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final GroupLayout resetFlags$layout() { - return resetFlags$LAYOUT; - } - - private static final long resetFlags$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final long resetFlags$offset() { - return resetFlags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static MemorySegment resetFlags(MemorySegment struct) { - return struct.asSlice(resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static void resetFlags(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - private static final OfInt mode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final OfInt mode$layout() { - return mode$LAYOUT; - } - - private static final long mode$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final long mode$offset() { - return mode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static int mode(MemorySegment struct) { - return struct.get(mode$LAYOUT, mode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static void mode(MemorySegment struct, int fieldValue) { - struct.set(mode$LAYOUT, mode$OFFSET, fieldValue); - } - - private static final OfInt samplesPerPkt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("samplesPerPkt")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final OfInt samplesPerPkt$layout() { - return samplesPerPkt$LAYOUT; - } - - private static final long samplesPerPkt$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final long samplesPerPkt$offset() { - return samplesPerPkt$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static int samplesPerPkt(MemorySegment struct) { - return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static void samplesPerPkt(MemorySegment struct, int fieldValue) { - struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue); - } - - private static final GroupLayout rsp1aParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final GroupLayout rsp1aParams$layout() { - return rsp1aParams$LAYOUT; - } - - private static final long rsp1aParams$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final long rsp1aParams$offset() { - return rsp1aParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static MemorySegment rsp1aParams(MemorySegment struct) { - return struct.asSlice(rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static void rsp1aParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2Params$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2Params")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final GroupLayout rsp2Params$layout() { - return rsp2Params$LAYOUT; - } - - private static final long rsp2Params$OFFSET = 46; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final long rsp2Params$offset() { - return rsp2Params$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static MemorySegment rsp2Params(MemorySegment struct) { - return struct.asSlice(rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static void rsp2Params(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final GroupLayout rspDuoParams$layout() { - return rspDuoParams$LAYOUT; - } - - private static final long rspDuoParams$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final long rspDuoParams$offset() { - return rspDuoParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static MemorySegment rspDuoParams(MemorySegment struct) { - return struct.asSlice(rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static void rspDuoParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final GroupLayout rspDxParams$layout() { - return rspDxParams$LAYOUT; - } - - private static final long rspDxParams$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final long rspDxParams$offset() { - return rspDxParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static MemorySegment rspDxParams(MemorySegment struct) { - return struct.asSlice(rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static void rspDxParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceParamsT.java deleted file mode 100644 index 6af72cd3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceParamsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DevParamsT *devParams; - * sdrplay_api_RxChannelParamsT *rxChannelA; - * sdrplay_api_RxChannelParamsT *rxChannelB; - * } - * } - */ -public class sdrplay_api_DeviceParamsT { - - sdrplay_api_DeviceParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_POINTER.withName("devParams"), - sdrplay_api_h.C_POINTER.withName("rxChannelA"), - sdrplay_api_h.C_POINTER.withName("rxChannelB") - ).withName("$anon$154:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout devParams$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("devParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final AddressLayout devParams$layout() { - return devParams$LAYOUT; - } - - private static final long devParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final long devParams$offset() { - return devParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static MemorySegment devParams(MemorySegment struct) { - return struct.get(devParams$LAYOUT, devParams$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static void devParams(MemorySegment struct, MemorySegment fieldValue) { - struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelA$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelA")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final AddressLayout rxChannelA$layout() { - return rxChannelA$LAYOUT; - } - - private static final long rxChannelA$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final long rxChannelA$offset() { - return rxChannelA$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static MemorySegment rxChannelA(MemorySegment struct) { - return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelB$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelB")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final AddressLayout rxChannelB$layout() { - return rxChannelB$LAYOUT; - } - - private static final long rxChannelB$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final long rxChannelB$offset() { - return rxChannelB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static MemorySegment rxChannelB(MemorySegment struct) { - return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceT.java deleted file mode 100644 index a9d88b68..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DeviceT.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char SerNo[64]; - * unsigned char hwVer; - * sdrplay_api_TunerSelectT tuner; - * sdrplay_api_RspDuoModeT rspDuoMode; - * unsigned char valid; - * double rspDuoSampleFreq; - * HANDLE dev; - * } - * } - */ -public class sdrplay_api_DeviceT { - - sdrplay_api_DeviceT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, sdrplay_api_h.C_CHAR).withName("SerNo"), - sdrplay_api_h.C_CHAR.withName("hwVer"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner"), - sdrplay_api_h.C_INT.withName("rspDuoMode"), - sdrplay_api_h.C_CHAR.withName("valid"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_DOUBLE.withName("rspDuoSampleFreq"), - sdrplay_api_h.C_POINTER.withName("dev") - ).withName("$anon$142:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout SerNo$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("SerNo")); - - /** - * Layout for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final SequenceLayout SerNo$layout() { - return SerNo$LAYOUT; - } - - private static final long SerNo$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final long SerNo$offset() { - return SerNo$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static MemorySegment SerNo(MemorySegment struct) { - return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - private static long[] SerNo$DIMS = { 64 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static long[] SerNo$dimensions() { - return SerNo$DIMS; - } - private static final VarHandle SerNo$ELEM_HANDLE = SerNo$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static byte SerNo(MemorySegment struct, long index0) { - return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, long index0, byte fieldValue) { - SerNo$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfByte hwVer$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hwVer")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final OfByte hwVer$layout() { - return hwVer$LAYOUT; - } - - private static final long hwVer$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final long hwVer$offset() { - return hwVer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static byte hwVer(MemorySegment struct) { - return struct.get(hwVer$LAYOUT, hwVer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static void hwVer(MemorySegment struct, byte fieldValue) { - struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue); - } - - private static final OfInt tuner$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final OfInt tuner$layout() { - return tuner$LAYOUT; - } - - private static final long tuner$OFFSET = 68; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final long tuner$offset() { - return tuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static int tuner(MemorySegment struct) { - return struct.get(tuner$LAYOUT, tuner$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static void tuner(MemorySegment struct, int fieldValue) { - struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue); - } - - private static final OfInt rspDuoMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rspDuoMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final OfInt rspDuoMode$layout() { - return rspDuoMode$LAYOUT; - } - - private static final long rspDuoMode$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final long rspDuoMode$offset() { - return rspDuoMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static int rspDuoMode(MemorySegment struct) { - return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static void rspDuoMode(MemorySegment struct, int fieldValue) { - struct.set(rspDuoMode$LAYOUT, rspDuoMode$OFFSET, fieldValue); - } - - private static final OfByte valid$LAYOUT = (OfByte)$LAYOUT.select(groupElement("valid")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static final OfByte valid$layout() { - return valid$LAYOUT; - } - - private static final long valid$OFFSET = 76; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static final long valid$offset() { - return valid$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static byte valid(MemorySegment struct) { - return struct.get(valid$LAYOUT, valid$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static void valid(MemorySegment struct, byte fieldValue) { - struct.set(valid$LAYOUT, valid$OFFSET, fieldValue); - } - - private static final OfDouble rspDuoSampleFreq$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rspDuoSampleFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final OfDouble rspDuoSampleFreq$layout() { - return rspDuoSampleFreq$LAYOUT; - } - - private static final long rspDuoSampleFreq$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final long rspDuoSampleFreq$offset() { - return rspDuoSampleFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static double rspDuoSampleFreq(MemorySegment struct) { - return struct.get(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static void rspDuoSampleFreq(MemorySegment struct, double fieldValue) { - struct.set(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET, fieldValue); - } - - private static final AddressLayout dev$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dev")); - - /** - * Layout for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final AddressLayout dev$layout() { - return dev$LAYOUT; - } - - private static final long dev$OFFSET = 88; - - /** - * Offset for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final long dev$offset() { - return dev$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static MemorySegment dev(MemorySegment struct) { - return struct.get(dev$LAYOUT, dev$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static void dev(MemorySegment struct, MemorySegment fieldValue) { - struct.set(dev$LAYOUT, dev$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DisableHeartbeat_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DisableHeartbeat_t.java deleted file mode 100644 index 09922760..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_DisableHeartbeat_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void) - * } - */ -public class sdrplay_api_DisableHeartbeat_t { - - sdrplay_api_DisableHeartbeat_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ErrorInfoT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ErrorInfoT.java deleted file mode 100644 index d9fdeaab..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ErrorInfoT.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char file[256]; - * char function[256]; - * int line; - * char message[1024]; - * } - * } - */ -public class sdrplay_api_ErrorInfoT { - - sdrplay_api_ErrorInfoT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"), - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"), - sdrplay_api_h.C_INT.withName("line"), - MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message") - ).withName("$anon$162:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file")); - - /** - * Layout for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final SequenceLayout file$layout() { - return file$LAYOUT; - } - - private static final long file$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final long file$offset() { - return file$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static MemorySegment file(MemorySegment struct) { - return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize()); - } - - private static long[] file$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static long[] file$dimensions() { - return file$DIMS; - } - private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static byte file(MemorySegment struct, long index0) { - return (byte)file$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, long index0, byte fieldValue) { - file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function")); - - /** - * Layout for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final SequenceLayout function$layout() { - return function$LAYOUT; - } - - private static final long function$OFFSET = 256; - - /** - * Offset for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final long function$offset() { - return function$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static MemorySegment function(MemorySegment struct) { - return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize()); - } - - private static long[] function$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static long[] function$dimensions() { - return function$DIMS; - } - private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static byte function(MemorySegment struct, long index0) { - return (byte)function$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, long index0, byte fieldValue) { - function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line")); - - /** - * Layout for field: - * {@snippet lang=c : - * int line - * } - */ - public static final OfInt line$layout() { - return line$LAYOUT; - } - - private static final long line$OFFSET = 512; - - /** - * Offset for field: - * {@snippet lang=c : - * int line - * } - */ - public static final long line$offset() { - return line$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int line - * } - */ - public static int line(MemorySegment struct) { - return struct.get(line$LAYOUT, line$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int line - * } - */ - public static void line(MemorySegment struct, int fieldValue) { - struct.set(line$LAYOUT, line$OFFSET, fieldValue); - } - - private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message")); - - /** - * Layout for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final SequenceLayout message$layout() { - return message$LAYOUT; - } - - private static final long message$OFFSET = 516; - - /** - * Offset for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final long message$offset() { - return message$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static MemorySegment message(MemorySegment struct) { - return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize()); - } - - private static long[] message$DIMS = { 1024 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static long[] message$dimensions() { - return message$DIMS; - } - private static final VarHandle message$ELEM_HANDLE = message$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static byte message(MemorySegment struct, long index0) { - return (byte)message$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, long index0, byte fieldValue) { - message$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventCallback_t.java deleted file mode 100644 index 40f66056..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventCallback_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *) - * } - */ -public class sdrplay_api_EventCallback_t { - - sdrplay_api_EventCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventParamsT.java deleted file mode 100644 index 736706cb..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_EventParamsT.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * union { - * sdrplay_api_GainCbParamT gainParams; - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * } - * } - */ -public class sdrplay_api_EventParamsT { - - sdrplay_api_EventParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( - sdrplay_api_GainCbParamT.layout().withName("gainParams"), - sdrplay_api_PowerOverloadCbParamT.layout().withName("powerOverloadParams"), - sdrplay_api_RspDuoModeCbParamT.layout().withName("rspDuoModeParams") - ).withName("$anon$49:9"); - - /** - * The layout of this union - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout gainParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final GroupLayout gainParams$layout() { - return gainParams$LAYOUT; - } - - private static final long gainParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final long gainParams$offset() { - return gainParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static MemorySegment gainParams(MemorySegment union) { - return union.asSlice(gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static void gainParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - private static final GroupLayout powerOverloadParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("powerOverloadParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final GroupLayout powerOverloadParams$layout() { - return powerOverloadParams$LAYOUT; - } - - private static final long powerOverloadParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final long powerOverloadParams$offset() { - return powerOverloadParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static MemorySegment powerOverloadParams(MemorySegment union) { - return union.asSlice(powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static void powerOverloadParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoModeParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoModeParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final GroupLayout rspDuoModeParams$layout() { - return rspDuoModeParams$LAYOUT; - } - - private static final long rspDuoModeParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final long rspDuoModeParams$offset() { - return rspDuoModeParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static MemorySegment rspDuoModeParams(MemorySegment union) { - return union.asSlice(rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static void rspDuoModeParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this union - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_FsFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_FsFreqT.java deleted file mode 100644 index 3ef51f53..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_FsFreqT.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double fsHz; - * unsigned char syncUpdate; - * unsigned char reCal; - * } - * } - */ -public class sdrplay_api_FsFreqT { - - sdrplay_api_FsFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("fsHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - sdrplay_api_h.C_CHAR.withName("reCal"), - MemoryLayout.paddingLayout(6) - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final OfDouble fsHz$layout() { - return fsHz$LAYOUT; - } - - private static final long fsHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final long fsHz$offset() { - return fsHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static double fsHz(MemorySegment struct) { - return struct.get(fsHz$LAYOUT, fsHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static void fsHz(MemorySegment struct, double fieldValue) { - struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfByte reCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("reCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final OfByte reCal$layout() { - return reCal$LAYOUT; - } - - private static final long reCal$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final long reCal$offset() { - return reCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static byte reCal(MemorySegment struct) { - return struct.get(reCal$LAYOUT, reCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static void reCal(MemorySegment struct, byte fieldValue) { - struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainCbParamT.java deleted file mode 100644 index b47e6064..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainCbParamT.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned int gRdB; - * unsigned int lnaGRdB; - * double currGain; - * } - * } - */ -public class sdrplay_api_GainCbParamT { - - sdrplay_api_GainCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_INT.withName("lnaGRdB"), - sdrplay_api_h.C_DOUBLE.withName("currGain") - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfInt lnaGRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("lnaGRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final OfInt lnaGRdB$layout() { - return lnaGRdB$LAYOUT; - } - - private static final long lnaGRdB$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final long lnaGRdB$offset() { - return lnaGRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static int lnaGRdB(MemorySegment struct) { - return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static void lnaGRdB(MemorySegment struct, int fieldValue) { - struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue); - } - - private static final OfDouble currGain$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("currGain")); - - /** - * Layout for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final OfDouble currGain$layout() { - return currGain$LAYOUT; - } - - private static final long currGain$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final long currGain$offset() { - return currGain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static double currGain(MemorySegment struct) { - return struct.get(currGain$LAYOUT, currGain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static void currGain(MemorySegment struct, double fieldValue) { - struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainT.java deleted file mode 100644 index 233aa7d3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainT.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * int gRdB; - * unsigned char LNAstate; - * unsigned char syncUpdate; - * sdrplay_api_MinGainReductionT minGr; - * sdrplay_api_GainValuesT gainVals; - * } - * } - */ -public class sdrplay_api_GainT { - - sdrplay_api_GainT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_CHAR.withName("LNAstate"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("minGr"), - sdrplay_api_GainValuesT.layout().withName("gainVals") - ).withName("$anon$60:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfByte LNAstate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("LNAstate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final OfByte LNAstate$layout() { - return LNAstate$LAYOUT; - } - - private static final long LNAstate$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final long LNAstate$offset() { - return LNAstate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static byte LNAstate(MemorySegment struct) { - return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static void LNAstate(MemorySegment struct, byte fieldValue) { - struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 5; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfInt minGr$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minGr")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final OfInt minGr$layout() { - return minGr$LAYOUT; - } - - private static final long minGr$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final long minGr$offset() { - return minGr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static int minGr(MemorySegment struct) { - return struct.get(minGr$LAYOUT, minGr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static void minGr(MemorySegment struct, int fieldValue) { - struct.set(minGr$LAYOUT, minGr$OFFSET, fieldValue); - } - - private static final GroupLayout gainVals$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainVals")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final GroupLayout gainVals$layout() { - return gainVals$LAYOUT; - } - - private static final long gainVals$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final long gainVals$offset() { - return gainVals$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static MemorySegment gainVals(MemorySegment struct) { - return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static void gainVals(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainValuesT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainValuesT.java deleted file mode 100644 index 0db1272c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GainValuesT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfFloat; - -/** - * {@snippet lang=c : - * struct { - * float curr; - * float max; - * float min; - * } - * } - */ -public class sdrplay_api_GainValuesT { - - sdrplay_api_GainValuesT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_FLOAT.withName("curr"), - sdrplay_api_h.C_FLOAT.withName("max"), - sdrplay_api_h.C_FLOAT.withName("min") - ).withName("$anon$53:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr")); - - /** - * Layout for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final OfFloat curr$layout() { - return curr$LAYOUT; - } - - private static final long curr$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final long curr$offset() { - return curr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static float curr(MemorySegment struct) { - return struct.get(curr$LAYOUT, curr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static void curr(MemorySegment struct, float fieldValue) { - struct.set(curr$LAYOUT, curr$OFFSET, fieldValue); - } - - private static final OfFloat max$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("max")); - - /** - * Layout for field: - * {@snippet lang=c : - * float max - * } - */ - public static final OfFloat max$layout() { - return max$LAYOUT; - } - - private static final long max$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * float max - * } - */ - public static final long max$offset() { - return max$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float max - * } - */ - public static float max(MemorySegment struct) { - return struct.get(max$LAYOUT, max$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float max - * } - */ - public static void max(MemorySegment struct, float fieldValue) { - struct.set(max$LAYOUT, max$OFFSET, fieldValue); - } - - private static final OfFloat min$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("min")); - - /** - * Layout for field: - * {@snippet lang=c : - * float min - * } - */ - public static final OfFloat min$layout() { - return min$LAYOUT; - } - - private static final long min$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * float min - * } - */ - public static final long min$offset() { - return min$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float min - * } - */ - public static float min(MemorySegment struct) { - return struct.get(min$LAYOUT, min$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float min - * } - */ - public static void min(MemorySegment struct, float fieldValue) { - struct.set(min$LAYOUT, min$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDeviceParams_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDeviceParams_t.java deleted file mode 100644 index 27f2ec89..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDeviceParams_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **) - * } - */ -public class sdrplay_api_GetDeviceParams_t { - - sdrplay_api_GetDeviceParams_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment deviceParams); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDevices_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDevices_t.java deleted file mode 100644 index ca13f220..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetDevices_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int) - * } - */ -public class sdrplay_api_GetDevices_t { - - sdrplay_api_GetDevices_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetErrorString_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetErrorString_t.java deleted file mode 100644 index 052714f6..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetErrorString_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT) - * } - */ -public class sdrplay_api_GetErrorString_t { - - sdrplay_api_GetErrorString_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(int err); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,int err) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetLastError_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetLastError_t.java deleted file mode 100644 index fe3c4c2b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_GetLastError_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_GetLastError_t { - - sdrplay_api_GetLastError_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Init_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Init_t.java deleted file mode 100644 index daf00830..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Init_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *) - * } - */ -public class sdrplay_api_Init_t { - - sdrplay_api_Init_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_LockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_LockDeviceApi_t.java deleted file mode 100644 index e1a7e512..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_LockDeviceApi_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_LockDeviceApi_t { - - sdrplay_api_LockDeviceApi_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Open_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Open_t.java deleted file mode 100644 index 0e78a556..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Open_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void) - * } - */ -public class sdrplay_api_Open_t { - - sdrplay_api_Open_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_PowerOverloadCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_PowerOverloadCbParamT.java deleted file mode 100644 index 33e82fff..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_PowerOverloadCbParamT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * } - * } - */ -public class sdrplay_api_PowerOverloadCbParamT { - - sdrplay_api_PowerOverloadCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("powerOverloadChangeType") - ).withName("$anon$38:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final OfInt powerOverloadChangeType$layout() { - return powerOverloadChangeType$LAYOUT; - } - - private static final long powerOverloadChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final long powerOverloadChangeType$offset() { - return powerOverloadChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static int powerOverloadChangeType(MemorySegment struct) { - return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) { - struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ReleaseDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ReleaseDevice_t.java deleted file mode 100644 index 80ee1c06..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ReleaseDevice_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_ReleaseDevice_t { - - sdrplay_api_ReleaseDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ResetFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ResetFlagsT.java deleted file mode 100644 index f9f9763e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_ResetFlagsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * unsigned char resetFsUpdate; - * } - * } - */ -public class sdrplay_api_ResetFlagsT { - - sdrplay_api_ResetFlagsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), - sdrplay_api_h.C_CHAR.withName("resetRfUpdate"), - sdrplay_api_h.C_CHAR.withName("resetFsUpdate") - ).withName("$anon$30:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final OfByte resetGainUpdate$layout() { - return resetGainUpdate$LAYOUT; - } - - private static final long resetGainUpdate$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final long resetGainUpdate$offset() { - return resetGainUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static byte resetGainUpdate(MemorySegment struct) { - return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetRfUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetRfUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final OfByte resetRfUpdate$layout() { - return resetRfUpdate$LAYOUT; - } - - private static final long resetRfUpdate$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final long resetRfUpdate$offset() { - return resetRfUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static byte resetRfUpdate(MemorySegment struct) { - return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetFsUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetFsUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final OfByte resetFsUpdate$layout() { - return resetFsUpdate$LAYOUT; - } - - private static final long resetFsUpdate$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final long resetFsUpdate$offset() { - return resetFsUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static byte resetFsUpdate(MemorySegment struct) { - return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static void resetFsUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RfFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RfFreqT.java deleted file mode 100644 index 301c9fc8..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RfFreqT.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double rfHz; - * unsigned char syncUpdate; - * } - * } - */ -public class sdrplay_api_RfFreqT { - - sdrplay_api_RfFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("rfHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(7) - ).withName("$anon$69:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final OfDouble rfHz$layout() { - return rfHz$LAYOUT; - } - - private static final long rfHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final long rfHz$offset() { - return rfHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static double rfHz(MemorySegment struct) { - return struct.get(rfHz$LAYOUT, rfHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static void rfHz(MemorySegment struct, double fieldValue) { - struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aParamsT.java deleted file mode 100644 index 3176ade0..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aParamsT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aParamsT { - - sdrplay_api_Rsp1aParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable") - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aTunerParamsT.java deleted file mode 100644 index c1c55e67..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp1aTunerParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aTunerParamsT { - - sdrplay_api_Rsp1aTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable") - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2ParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2ParamsT.java deleted file mode 100644 index d3bc00dd..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2ParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char extRefOutputEn; - * } - * } - */ -public class sdrplay_api_Rsp2ParamsT { - - sdrplay_api_Rsp2ParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("extRefOutputEn") - ).withName("$anon$22:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final OfByte extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static byte extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, byte fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2TunerParamsT.java deleted file mode 100644 index 93b0cb32..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Rsp2TunerParamsT.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp2TunerParamsT { - - sdrplay_api_Rsp2TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("amPortSel"), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(3) - ).withName("$anon$27:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt amPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("amPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final OfInt amPortSel$layout() { - return amPortSel$LAYOUT; - } - - private static final long amPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final long amPortSel$offset() { - return amPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static int amPortSel(MemorySegment struct) { - return struct.get(amPortSel$LAYOUT, amPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static void amPortSel(MemorySegment struct, int fieldValue) { - struct.set(amPortSel$LAYOUT, amPortSel$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoModeCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoModeCbParamT.java deleted file mode 100644 index 781ca76f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoModeCbParamT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * } - * } - */ -public class sdrplay_api_RspDuoModeCbParamT { - - sdrplay_api_RspDuoModeCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("modeChangeType") - ).withName("$anon$43:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt modeChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("modeChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final OfInt modeChangeType$layout() { - return modeChangeType$LAYOUT; - } - - private static final long modeChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final long modeChangeType$offset() { - return modeChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static int modeChangeType(MemorySegment struct) { - return struct.get(modeChangeType$LAYOUT, modeChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static void modeChangeType(MemorySegment struct, int fieldValue) { - struct.set(modeChangeType$LAYOUT, modeChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoParamsT.java deleted file mode 100644 index 774b8d50..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * int extRefOutputEn; - * } - * } - */ -public class sdrplay_api_RspDuoParamsT { - - sdrplay_api_RspDuoParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("extRefOutputEn") - ).withName("$anon$26:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt extRefOutputEn$LAYOUT = (OfInt)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final OfInt extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static int extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, int fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoTunerParamsT.java deleted file mode 100644 index e72044de..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDuoTunerParamsT.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; - * unsigned char tuner1AmNotchEnable; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_RspDuoTunerParamsT { - - sdrplay_api_RspDuoTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner1AmPortSel"), - sdrplay_api_h.C_CHAR.withName("tuner1AmNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(1) - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt tuner1AmPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner1AmPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final OfInt tuner1AmPortSel$layout() { - return tuner1AmPortSel$LAYOUT; - } - - private static final long tuner1AmPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final long tuner1AmPortSel$offset() { - return tuner1AmPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static int tuner1AmPortSel(MemorySegment struct) { - return struct.get(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static void tuner1AmPortSel(MemorySegment struct, int fieldValue) { - struct.set(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET, fieldValue); - } - - private static final OfByte tuner1AmNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("tuner1AmNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final OfByte tuner1AmNotchEnable$layout() { - return tuner1AmNotchEnable$LAYOUT; - } - - private static final long tuner1AmNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final long tuner1AmNotchEnable$offset() { - return tuner1AmNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static byte tuner1AmNotchEnable(MemorySegment struct) { - return struct.get(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static void tuner1AmNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 10; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxParamsT.java deleted file mode 100644 index 1c571b98..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxParamsT.java +++ /dev/null @@ -1,328 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned char hdrEnable; - * unsigned char biasTEnable; - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_RspDxParamsT { - - sdrplay_api_RspDxParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("hdrEnable"), - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(2) - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte hdrEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hdrEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final OfByte hdrEnable$layout() { - return hdrEnable$LAYOUT; - } - - private static final long hdrEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final long hdrEnable$offset() { - return hdrEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static byte hdrEnable(MemorySegment struct) { - return struct.get(hdrEnable$LAYOUT, hdrEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static void hdrEnable(MemorySegment struct, byte fieldValue) { - struct.set(hdrEnable$LAYOUT, hdrEnable$OFFSET, fieldValue); - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxTunerParamsT.java deleted file mode 100644 index f342f388..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RspDxTunerParamsT.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * } - * } - */ -public class sdrplay_api_RspDxTunerParamsT { - - sdrplay_api_RspDxTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("hdrBw") - ).withName("$anon$40:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt hdrBw$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hdrBw")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final OfInt hdrBw$layout() { - return hdrBw$LAYOUT; - } - - private static final long hdrBw$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final long hdrBw$offset() { - return hdrBw$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static int hdrBw(MemorySegment struct) { - return struct.get(hdrBw$LAYOUT, hdrBw$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static void hdrBw(MemorySegment struct, int fieldValue) { - struct.set(hdrBw$LAYOUT, hdrBw$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RxChannelParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RxChannelParamsT.java deleted file mode 100644 index 96becf39..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_RxChannelParamsT.java +++ /dev/null @@ -1,373 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * 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; - * } - * } - */ -public class sdrplay_api_RxChannelParamsT { - - sdrplay_api_RxChannelParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_TunerParamsT.layout().withName("tunerParams"), - sdrplay_api_ControlParamsT.layout().withName("ctrlParams"), - sdrplay_api_Rsp1aTunerParamsT.layout().withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(3), - sdrplay_api_Rsp2TunerParamsT.layout().withName("rsp2TunerParams"), - sdrplay_api_RspDuoTunerParamsT.layout().withName("rspDuoTunerParams"), - sdrplay_api_RspDxTunerParamsT.layout().withName("rspDxTunerParams"), - MemoryLayout.paddingLayout(4) - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout tunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("tunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final GroupLayout tunerParams$layout() { - return tunerParams$LAYOUT; - } - - private static final long tunerParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final long tunerParams$offset() { - return tunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static MemorySegment tunerParams(MemorySegment struct) { - return struct.asSlice(tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static void tunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout ctrlParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("ctrlParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final GroupLayout ctrlParams$layout() { - return ctrlParams$LAYOUT; - } - - private static final long ctrlParams$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final long ctrlParams$offset() { - return ctrlParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static MemorySegment ctrlParams(MemorySegment struct) { - return struct.asSlice(ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static void ctrlParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp1aTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final GroupLayout rsp1aTunerParams$layout() { - return rsp1aTunerParams$LAYOUT; - } - - private static final long rsp1aTunerParams$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final long rsp1aTunerParams$offset() { - return rsp1aTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static MemorySegment rsp1aTunerParams(MemorySegment struct) { - return struct.asSlice(rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static void rsp1aTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2TunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2TunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final GroupLayout rsp2TunerParams$layout() { - return rsp2TunerParams$LAYOUT; - } - - private static final long rsp2TunerParams$OFFSET = 108; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final long rsp2TunerParams$offset() { - return rsp2TunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static MemorySegment rsp2TunerParams(MemorySegment struct) { - return struct.asSlice(rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static void rsp2TunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final GroupLayout rspDuoTunerParams$layout() { - return rspDuoTunerParams$LAYOUT; - } - - private static final long rspDuoTunerParams$OFFSET = 124; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final long rspDuoTunerParams$offset() { - return rspDuoTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static MemorySegment rspDuoTunerParams(MemorySegment struct) { - return struct.asSlice(rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static void rspDuoTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final GroupLayout rspDxTunerParams$layout() { - return rspDxTunerParams$LAYOUT; - } - - private static final long rspDxTunerParams$OFFSET = 136; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final long rspDxTunerParams$offset() { - return rspDxTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static MemorySegment rspDxTunerParams(MemorySegment struct) { - return struct.asSlice(rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static void rspDxTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SelectDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SelectDevice_t.java deleted file mode 100644 index 1cf4652d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SelectDevice_t.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_SelectDevice_t { - - sdrplay_api_SelectDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SelectDevice_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_SelectDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCallback_t.java deleted file mode 100644 index 6e49f8ff..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCallback_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_StreamCallback_t)(short *, short *, sdrplay_api_StreamCbParamsT *, unsigned int, unsigned int, void *) - * } - */ -public class sdrplay_api_StreamCallback_t { - - sdrplay_api_StreamCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - 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_StreamCallback_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_StreamCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, xi, xq, params, numSamples, reset, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCbParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCbParamsT.java deleted file mode 100644 index 19d33d4f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_StreamCbParamsT.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned int firstSampleNum; - * int grChanged; - * int rfChanged; - * int fsChanged; - * unsigned int numSamples; - * } - * } - */ -public class sdrplay_api_StreamCbParamsT { - - sdrplay_api_StreamCbParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("firstSampleNum"), - sdrplay_api_h.C_INT.withName("grChanged"), - sdrplay_api_h.C_INT.withName("rfChanged"), - sdrplay_api_h.C_INT.withName("fsChanged"), - sdrplay_api_h.C_INT.withName("numSamples") - ).withName("$anon$57:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt firstSampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("firstSampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final OfInt firstSampleNum$layout() { - return firstSampleNum$LAYOUT; - } - - private static final long firstSampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final long firstSampleNum$offset() { - return firstSampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static int firstSampleNum(MemorySegment struct) { - return struct.get(firstSampleNum$LAYOUT, firstSampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static void firstSampleNum(MemorySegment struct, int fieldValue) { - struct.set(firstSampleNum$LAYOUT, firstSampleNum$OFFSET, fieldValue); - } - - private static final OfInt grChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("grChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final OfInt grChanged$layout() { - return grChanged$LAYOUT; - } - - private static final long grChanged$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final long grChanged$offset() { - return grChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static int grChanged(MemorySegment struct) { - return struct.get(grChanged$LAYOUT, grChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static void grChanged(MemorySegment struct, int fieldValue) { - struct.set(grChanged$LAYOUT, grChanged$OFFSET, fieldValue); - } - - private static final OfInt rfChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rfChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final OfInt rfChanged$layout() { - return rfChanged$LAYOUT; - } - - private static final long rfChanged$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final long rfChanged$offset() { - return rfChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static int rfChanged(MemorySegment struct) { - return struct.get(rfChanged$LAYOUT, rfChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static void rfChanged(MemorySegment struct, int fieldValue) { - struct.set(rfChanged$LAYOUT, rfChanged$OFFSET, fieldValue); - } - - private static final OfInt fsChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("fsChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final OfInt fsChanged$layout() { - return fsChanged$LAYOUT; - } - - private static final long fsChanged$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final long fsChanged$offset() { - return fsChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static int fsChanged(MemorySegment struct) { - return struct.get(fsChanged$LAYOUT, fsChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static void fsChanged(MemorySegment struct, int fieldValue) { - struct.set(fsChanged$LAYOUT, fsChanged$OFFSET, fieldValue); - } - - private static final OfInt numSamples$LAYOUT = (OfInt)$LAYOUT.select(groupElement("numSamples")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final OfInt numSamples$layout() { - return numSamples$LAYOUT; - } - - private static final long numSamples$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final long numSamples$offset() { - return numSamples$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static int numSamples(MemorySegment struct) { - return struct.get(numSamples$LAYOUT, numSamples$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static void numSamples(MemorySegment struct, int fieldValue) { - struct.set(numSamples$LAYOUT, numSamples$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoActiveTuner_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoActiveTuner_t.java deleted file mode 100644 index 50259779..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoActiveTuner_t.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE, sdrplay_api_TunerSelectT *, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoActiveTuner_t { - - sdrplay_api_SwapRspDuoActiveTuner_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_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_SwapRspDuoActiveTuner_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java deleted file mode 100644 index 1334c8a2..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *, double) - * } - */ -public class sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - - sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currentSampleRate, double newSampleRate); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_DOUBLE - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_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_SwapRspDuoDualTunerModeSampleRate_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 currentSampleRate, double newSampleRate) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currentSampleRate, newSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoMode_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoMode_t.java deleted file mode 100644 index abec063c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SwapRspDuoMode_t.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *, sdrplay_api_DeviceParamsT **, sdrplay_api_RspDuoModeT, double, sdrplay_api_TunerSelectT, sdrplay_api_Bw_MHzT, sdrplay_api_If_kHzT, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoMode_t { - - sdrplay_api_SwapRspDuoMode_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_DOUBLE, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_SwapRspDuoMode_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_SwapRspDuoMode_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 currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SyncUpdateT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SyncUpdateT.java deleted file mode 100644 index f1ebd762..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_SyncUpdateT.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * unsigned int sampleNum; - * unsigned int period; - * } - * } - */ -public class sdrplay_api_SyncUpdateT { - - sdrplay_api_SyncUpdateT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("sampleNum"), - sdrplay_api_h.C_INT.withName("period") - ).withName("$anon$24:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt sampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final OfInt sampleNum$layout() { - return sampleNum$LAYOUT; - } - - private static final long sampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final long sampleNum$offset() { - return sampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static int sampleNum(MemorySegment struct) { - return struct.get(sampleNum$LAYOUT, sampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static void sampleNum(MemorySegment struct, int fieldValue) { - struct.set(sampleNum$LAYOUT, sampleNum$OFFSET, fieldValue); - } - - private static final OfInt period$LAYOUT = (OfInt)$LAYOUT.select(groupElement("period")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final OfInt period$layout() { - return period$LAYOUT; - } - - private static final long period$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final long period$offset() { - return period$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static int period(MemorySegment struct) { - return struct.get(period$LAYOUT, period$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static void period(MemorySegment struct, int fieldValue) { - struct.set(period$LAYOUT, period$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_TunerParamsT.java deleted file mode 100644 index ae3627d4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_TunerParamsT.java +++ /dev/null @@ -1,374 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.*; -import java.util.function.*; - -import static java.lang.foreign.ValueLayout.*; -import static java.lang.foreign.MemoryLayout.PathElement.*; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_Bw_MHzT bwType; - * sdrplay_api_If_kHzT ifType; - * sdrplay_api_LoModeT loMode; - * sdrplay_api_GainT gain; - * sdrplay_api_RfFreqT rfFreq; - * sdrplay_api_DcOffsetTunerT dcOffsetTuner; - * } - * } - */ -public class sdrplay_api_TunerParamsT { - - sdrplay_api_TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("bwType"), - sdrplay_api_h.C_INT.withName("ifType"), - sdrplay_api_h.C_INT.withName("loMode"), - sdrplay_api_GainT.layout().withName("gain"), - MemoryLayout.paddingLayout(4), - sdrplay_api_RfFreqT.layout().withName("rfFreq"), - sdrplay_api_DcOffsetTunerT.layout().withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(4) - ).withName("$anon$83:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt bwType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("bwType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final OfInt bwType$layout() { - return bwType$LAYOUT; - } - - private static final long bwType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final long bwType$offset() { - return bwType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static int bwType(MemorySegment struct) { - return struct.get(bwType$LAYOUT, bwType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static void bwType(MemorySegment struct, int fieldValue) { - struct.set(bwType$LAYOUT, bwType$OFFSET, fieldValue); - } - - private static final OfInt ifType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ifType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final OfInt ifType$layout() { - return ifType$LAYOUT; - } - - private static final long ifType$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final long ifType$offset() { - return ifType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static int ifType(MemorySegment struct) { - return struct.get(ifType$LAYOUT, ifType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static void ifType(MemorySegment struct, int fieldValue) { - struct.set(ifType$LAYOUT, ifType$OFFSET, fieldValue); - } - - private static final OfInt loMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("loMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final OfInt loMode$layout() { - return loMode$LAYOUT; - } - - private static final long loMode$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final long loMode$offset() { - return loMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static int loMode(MemorySegment struct) { - return struct.get(loMode$LAYOUT, loMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static void loMode(MemorySegment struct, int fieldValue) { - struct.set(loMode$LAYOUT, loMode$OFFSET, fieldValue); - } - - private static final GroupLayout gain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gain")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final GroupLayout gain$layout() { - return gain$LAYOUT; - } - - private static final long gain$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final long gain$offset() { - return gain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static MemorySegment gain(MemorySegment struct) { - return struct.asSlice(gain$OFFSET, gain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static void gain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gain$OFFSET, gain$LAYOUT.byteSize()); - } - - private static final GroupLayout rfFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rfFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final GroupLayout rfFreq$layout() { - return rfFreq$LAYOUT; - } - - private static final long rfFreq$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final long rfFreq$offset() { - return rfFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static MemorySegment rfFreq(MemorySegment struct) { - return struct.asSlice(rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static void rfFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout dcOffsetTuner$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffsetTuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final GroupLayout dcOffsetTuner$layout() { - return dcOffsetTuner$LAYOUT; - } - - private static final long dcOffsetTuner$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final long dcOffsetTuner$offset() { - return dcOffsetTuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static MemorySegment dcOffsetTuner(MemorySegment struct) { - return struct.asSlice(dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static void dcOffsetTuner(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Uninit_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Uninit_t.java deleted file mode 100644 index 001e1e4a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Uninit_t.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE) - * } - */ -public class sdrplay_api_Uninit_t { - - sdrplay_api_Uninit_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev); - } - - 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_Uninit_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_Uninit_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_UnlockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_UnlockDeviceApi_t.java deleted file mode 100644 index aa8f7fe2..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_UnlockDeviceApi_t.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_UnlockDeviceApi_t { - - sdrplay_api_UnlockDeviceApi_t() { - // Should not be called directly - } - - /** - * 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_UnlockDeviceApi_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_UnlockDeviceApi_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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Update_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Update_t.java deleted file mode 100644 index 0b6e2426..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_Update_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.invoke.*; -import java.lang.foreign.*; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE, sdrplay_api_TunerSelectT, sdrplay_api_ReasonForUpdateT, sdrplay_api_ReasonForUpdateExtension1T) - * } - */ -public class sdrplay_api_Update_t { - - sdrplay_api_Update_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_Update_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_Update_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_h.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_h.java deleted file mode 100644 index d4f69baf..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/sdrplay_api_h.java +++ /dev/null @@ -1,1625 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayLibraryHelper; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.Arena; -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.PaddingLayout; -import java.lang.foreign.SequenceLayout; -import java.lang.foreign.StructLayout; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.util.Arrays; -import java.util.stream.Collectors; - -import static java.lang.foreign.ValueLayout.JAVA_BYTE; - -public class sdrplay_api_h { - - sdrplay_api_h() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - if(SYMBOL_LOOKUP == null) - { - throw new UnsatisfiedLinkError("unresolved symbol:" + symbol); - } - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library - static SymbolLookup SYMBOL_LOOKUP; - static - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e) - { - if(SDRPlayLibraryHelper.LOADED_FROM_PATH) - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(SDRPlayLibraryHelper.LIBRARY_PATH, LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e2) - { - SYMBOL_LOOKUP = null; - } - } - else - { - SYMBOL_LOOKUP = null; - } - } - } - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; - private static final int RSPIA_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES 10 - * } - */ - public static int RSPIA_NUM_LNA_STATES() { - return RSPIA_NUM_LNA_STATES; - } - private static final int RSPIA_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPIA_NUM_LNA_STATES_AM() { - return RSPIA_NUM_LNA_STATES_AM; - } - private static final int RSPIA_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPIA_NUM_LNA_STATES_LBAND() { - return RSPIA_NUM_LNA_STATES_LBAND; - } - private static final int RSPII_NUM_LNA_STATES = (int)9L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES 9 - * } - */ - public static int RSPII_NUM_LNA_STATES() { - return RSPII_NUM_LNA_STATES; - } - private static final int RSPII_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPII_NUM_LNA_STATES_AMPORT() { - return RSPII_NUM_LNA_STATES_AMPORT; - } - private static final int RSPII_NUM_LNA_STATES_420MHZ = (int)6L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_420MHZ 6 - * } - */ - public static int RSPII_NUM_LNA_STATES_420MHZ() { - return RSPII_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDUO_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES 10 - * } - */ - public static int RSPDUO_NUM_LNA_STATES() { - return RSPDUO_NUM_LNA_STATES; - } - private static final int RSPDUO_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return RSPDUO_NUM_LNA_STATES_AMPORT; - } - private static final int RSPDUO_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AM() { - return RSPDUO_NUM_LNA_STATES_AM; - } - private static final int RSPDUO_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return RSPDUO_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES = (int)28L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES 28 - * } - */ - public static int RSPDX_NUM_LNA_STATES() { - return RSPDX_NUM_LNA_STATES; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_0_12 = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return RSPDX_NUM_LNA_STATES_AMPORT2_0_12; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_12_60 = (int)20L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_60 20 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_60() { - return RSPDX_NUM_LNA_STATES_AMPORT2_12_60; - } - private static final int RSPDX_NUM_LNA_STATES_VHF_BAND3 = (int)27L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 - * } - */ - public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return RSPDX_NUM_LNA_STATES_VHF_BAND3; - } - private static final int RSPDX_NUM_LNA_STATES_420MHZ = (int)21L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_420MHZ 21 - * } - */ - public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return RSPDX_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDX_NUM_LNA_STATES_LBAND = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_LBAND 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_LBAND() { - return RSPDX_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES_DX = (int)26L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_DX 26 - * } - */ - public static int RSPDX_NUM_LNA_STATES_DX() { - return RSPDX_NUM_LNA_STATES_DX; - } - private static final int sdrplay_api_Rsp2_ANTENNA_A = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_A() { - return sdrplay_api_Rsp2_ANTENNA_A; - } - private static final int sdrplay_api_Rsp2_ANTENNA_B = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_B() { - return sdrplay_api_Rsp2_ANTENNA_B; - } - private static final int sdrplay_api_Rsp2_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_1() { - return sdrplay_api_Rsp2_AMPORT_1; - } - private static final int sdrplay_api_Rsp2_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_2() { - return sdrplay_api_Rsp2_AMPORT_2; - } - private static final int sdrplay_api_RspDuoMode_Unknown = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Unknown = 0 - * } - */ - public static int sdrplay_api_RspDuoMode_Unknown() { - return sdrplay_api_RspDuoMode_Unknown; - } - private static final int sdrplay_api_RspDuoMode_Single_Tuner = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1 - * } - */ - public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return sdrplay_api_RspDuoMode_Single_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Dual_Tuner = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2 - * } - */ - public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return sdrplay_api_RspDuoMode_Dual_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Master = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Master = 4 - * } - */ - public static int sdrplay_api_RspDuoMode_Master() { - return sdrplay_api_RspDuoMode_Master; - } - private static final int sdrplay_api_RspDuoMode_Slave = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Slave = 8 - * } - */ - public static int sdrplay_api_RspDuoMode_Slave() { - return sdrplay_api_RspDuoMode_Slave; - } - private static final int sdrplay_api_RspDuo_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_1() { - return sdrplay_api_RspDuo_AMPORT_1; - } - private static final int sdrplay_api_RspDuo_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_2() { - return sdrplay_api_RspDuo_AMPORT_2; - } - private static final int sdrplay_api_BW_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_Undefined = 0 - * } - */ - public static int sdrplay_api_BW_Undefined() { - return sdrplay_api_BW_Undefined; - } - private static final int sdrplay_api_BW_0_200 = (int)200L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_200 = 200 - * } - */ - public static int sdrplay_api_BW_0_200() { - return sdrplay_api_BW_0_200; - } - private static final int sdrplay_api_BW_0_300 = (int)300L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_300 = 300 - * } - */ - public static int sdrplay_api_BW_0_300() { - return sdrplay_api_BW_0_300; - } - private static final int sdrplay_api_BW_0_600 = (int)600L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_600 = 600 - * } - */ - public static int sdrplay_api_BW_0_600() { - return sdrplay_api_BW_0_600; - } - private static final int sdrplay_api_BW_1_536 = (int)1536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_1_536 = 1536 - * } - */ - public static int sdrplay_api_BW_1_536() { - return sdrplay_api_BW_1_536; - } - private static final int sdrplay_api_BW_5_000 = (int)5000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_5_000 = 5000 - * } - */ - public static int sdrplay_api_BW_5_000() { - return sdrplay_api_BW_5_000; - } - private static final int sdrplay_api_BW_6_000 = (int)6000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_6_000 = 6000 - * } - */ - public static int sdrplay_api_BW_6_000() { - return sdrplay_api_BW_6_000; - } - private static final int sdrplay_api_BW_7_000 = (int)7000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_7_000 = 7000 - * } - */ - public static int sdrplay_api_BW_7_000() { - return sdrplay_api_BW_7_000; - } - private static final int sdrplay_api_BW_8_000 = (int)8000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_8_000 = 8000 - * } - */ - public static int sdrplay_api_BW_8_000() { - return sdrplay_api_BW_8_000; - } - private static final int sdrplay_api_IF_Undefined = (int)-1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Undefined = -1 - * } - */ - public static int sdrplay_api_IF_Undefined() { - return sdrplay_api_IF_Undefined; - } - private static final int sdrplay_api_IF_Zero = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Zero = 0 - * } - */ - public static int sdrplay_api_IF_Zero() { - return sdrplay_api_IF_Zero; - } - private static final int sdrplay_api_IF_0_450 = (int)450L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_0_450 = 450 - * } - */ - public static int sdrplay_api_IF_0_450() { - return sdrplay_api_IF_0_450; - } - private static final int sdrplay_api_IF_1_620 = (int)1620L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_1_620 = 1620 - * } - */ - public static int sdrplay_api_IF_1_620() { - return sdrplay_api_IF_1_620; - } - private static final int sdrplay_api_IF_2_048 = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_2_048 = 2048 - * } - */ - public static int sdrplay_api_IF_2_048() { - return sdrplay_api_IF_2_048; - } - private static final int sdrplay_api_LO_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Undefined = 0 - * } - */ - public static int sdrplay_api_LO_Undefined() { - return sdrplay_api_LO_Undefined; - } - private static final int sdrplay_api_LO_Auto = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Auto = 1 - * } - */ - public static int sdrplay_api_LO_Auto() { - return sdrplay_api_LO_Auto; - } - private static final int sdrplay_api_LO_120MHz = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_120MHz = 2 - * } - */ - public static int sdrplay_api_LO_120MHz() { - return sdrplay_api_LO_120MHz; - } - private static final int sdrplay_api_LO_144MHz = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_144MHz = 3 - * } - */ - public static int sdrplay_api_LO_144MHz() { - return sdrplay_api_LO_144MHz; - } - private static final int sdrplay_api_LO_168MHz = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_168MHz = 4 - * } - */ - public static int sdrplay_api_LO_168MHz() { - return sdrplay_api_LO_168MHz; - } - private static final int sdrplay_api_EXTENDED_MIN_GR = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0 - * } - */ - public static int sdrplay_api_EXTENDED_MIN_GR() { - return sdrplay_api_EXTENDED_MIN_GR; - } - private static final int sdrplay_api_NORMAL_MIN_GR = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NORMAL_MIN_GR = 20 - * } - */ - public static int sdrplay_api_NORMAL_MIN_GR() { - return sdrplay_api_NORMAL_MIN_GR; - } - private static final int sdrplay_api_Tuner_Neither = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Neither = 0 - * } - */ - public static int sdrplay_api_Tuner_Neither() { - return sdrplay_api_Tuner_Neither; - } - private static final int sdrplay_api_Tuner_A = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_A = 1 - * } - */ - public static int sdrplay_api_Tuner_A() { - return sdrplay_api_Tuner_A; - } - private static final int sdrplay_api_Tuner_B = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_B = 2 - * } - */ - public static int sdrplay_api_Tuner_B() { - return sdrplay_api_Tuner_B; - } - private static final int sdrplay_api_Tuner_Both = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Both = 3 - * } - */ - public static int sdrplay_api_Tuner_Both() { - return sdrplay_api_Tuner_Both; - } - private static final int sdrplay_api_RspDx_ANTENNA_A = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_A() { - return sdrplay_api_RspDx_ANTENNA_A; - } - private static final int sdrplay_api_RspDx_ANTENNA_B = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_B() { - return sdrplay_api_RspDx_ANTENNA_B; - } - private static final int sdrplay_api_RspDx_ANTENNA_C = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_C() { - return sdrplay_api_RspDx_ANTENNA_C; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_200 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return sdrplay_api_RspDx_HDRMODE_BW_0_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_500 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return sdrplay_api_RspDx_HDRMODE_BW_0_500; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_200 = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return sdrplay_api_RspDx_HDRMODE_BW_1_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_700 = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return sdrplay_api_RspDx_HDRMODE_BW_1_700; - } - private static final int sdrplay_api_ISOCH = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ISOCH = 0 - * } - */ - public static int sdrplay_api_ISOCH() { - return sdrplay_api_ISOCH; - } - private static final int sdrplay_api_BULK = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BULK = 1 - * } - */ - public static int sdrplay_api_BULK() { - return sdrplay_api_BULK; - } - private static final int sdrplay_api_AGC_DISABLE = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_DISABLE = 0 - * } - */ - public static int sdrplay_api_AGC_DISABLE() { - return sdrplay_api_AGC_DISABLE; - } - private static final int sdrplay_api_AGC_100HZ = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_100HZ = 1 - * } - */ - public static int sdrplay_api_AGC_100HZ() { - return sdrplay_api_AGC_100HZ; - } - private static final int sdrplay_api_AGC_50HZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_50HZ = 2 - * } - */ - public static int sdrplay_api_AGC_50HZ() { - return sdrplay_api_AGC_50HZ; - } - private static final int sdrplay_api_AGC_5HZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_5HZ = 3 - * } - */ - public static int sdrplay_api_AGC_5HZ() { - return sdrplay_api_AGC_5HZ; - } - private static final int sdrplay_api_AGC_CTRL_EN = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_CTRL_EN = 4 - * } - */ - public static int sdrplay_api_AGC_CTRL_EN() { - return sdrplay_api_AGC_CTRL_EN; - } - private static final int sdrplay_api_ADSB_DECIMATION = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_DECIMATION = 0 - * } - */ - public static int sdrplay_api_ADSB_DECIMATION() { - return sdrplay_api_ADSB_DECIMATION; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return sdrplay_api_ADSB_NO_DECIMATION_LOWPASS; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ; - } - private static final int sdrplay_api_Overload_Detected = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Detected = 0 - * } - */ - public static int sdrplay_api_Overload_Detected() { - return sdrplay_api_Overload_Detected; - } - private static final int sdrplay_api_Overload_Corrected = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Corrected = 1 - * } - */ - public static int sdrplay_api_Overload_Corrected() { - return sdrplay_api_Overload_Corrected; - } - private static final int sdrplay_api_MasterInitialised = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterInitialised = 0 - * } - */ - public static int sdrplay_api_MasterInitialised() { - return sdrplay_api_MasterInitialised; - } - private static final int sdrplay_api_SlaveAttached = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveAttached = 1 - * } - */ - public static int sdrplay_api_SlaveAttached() { - return sdrplay_api_SlaveAttached; - } - private static final int sdrplay_api_SlaveDetached = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDetached = 2 - * } - */ - public static int sdrplay_api_SlaveDetached() { - return sdrplay_api_SlaveDetached; - } - private static final int sdrplay_api_SlaveInitialised = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveInitialised = 3 - * } - */ - public static int sdrplay_api_SlaveInitialised() { - return sdrplay_api_SlaveInitialised; - } - private static final int sdrplay_api_SlaveUninitialised = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveUninitialised = 4 - * } - */ - public static int sdrplay_api_SlaveUninitialised() { - return sdrplay_api_SlaveUninitialised; - } - private static final int sdrplay_api_MasterDllDisappeared = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterDllDisappeared = 5 - * } - */ - public static int sdrplay_api_MasterDllDisappeared() { - return sdrplay_api_MasterDllDisappeared; - } - private static final int sdrplay_api_SlaveDllDisappeared = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDllDisappeared = 6 - * } - */ - public static int sdrplay_api_SlaveDllDisappeared() { - return sdrplay_api_SlaveDllDisappeared; - } - private static final int sdrplay_api_GainChange = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainChange = 0 - * } - */ - public static int sdrplay_api_GainChange() { - return sdrplay_api_GainChange; - } - private static final int sdrplay_api_PowerOverloadChange = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_PowerOverloadChange = 1 - * } - */ - public static int sdrplay_api_PowerOverloadChange() { - return sdrplay_api_PowerOverloadChange; - } - private static final int sdrplay_api_DeviceRemoved = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DeviceRemoved = 2 - * } - */ - public static int sdrplay_api_DeviceRemoved() { - return sdrplay_api_DeviceRemoved; - } - private static final int sdrplay_api_RspDuoModeChange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoModeChange = 3 - * } - */ - public static int sdrplay_api_RspDuoModeChange() { - return sdrplay_api_RspDuoModeChange; - } - /** - * {@snippet lang=c : - * typedef void *HANDLE - * } - */ - public static final AddressLayout HANDLE = sdrplay_api_h.C_POINTER; - private static final int sdrplay_api_Success = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Success = 0 - * } - */ - public static int sdrplay_api_Success() { - return sdrplay_api_Success; - } - private static final int sdrplay_api_Fail = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Fail = 1 - * } - */ - public static int sdrplay_api_Fail() { - return sdrplay_api_Fail; - } - private static final int sdrplay_api_InvalidParam = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidParam = 2 - * } - */ - public static int sdrplay_api_InvalidParam() { - return sdrplay_api_InvalidParam; - } - private static final int sdrplay_api_OutOfRange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfRange = 3 - * } - */ - public static int sdrplay_api_OutOfRange() { - return sdrplay_api_OutOfRange; - } - private static final int sdrplay_api_GainUpdateError = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainUpdateError = 4 - * } - */ - public static int sdrplay_api_GainUpdateError() { - return sdrplay_api_GainUpdateError; - } - private static final int sdrplay_api_RfUpdateError = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RfUpdateError = 5 - * } - */ - public static int sdrplay_api_RfUpdateError() { - return sdrplay_api_RfUpdateError; - } - private static final int sdrplay_api_FsUpdateError = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FsUpdateError = 6 - * } - */ - public static int sdrplay_api_FsUpdateError() { - return sdrplay_api_FsUpdateError; - } - private static final int sdrplay_api_HwError = (int)7L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwError = 7 - * } - */ - public static int sdrplay_api_HwError() { - return sdrplay_api_HwError; - } - private static final int sdrplay_api_AliasingError = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AliasingError = 8 - * } - */ - public static int sdrplay_api_AliasingError() { - return sdrplay_api_AliasingError; - } - private static final int sdrplay_api_AlreadyInitialised = (int)9L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AlreadyInitialised = 9 - * } - */ - public static int sdrplay_api_AlreadyInitialised() { - return sdrplay_api_AlreadyInitialised; - } - private static final int sdrplay_api_NotInitialised = (int)10L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotInitialised = 10 - * } - */ - public static int sdrplay_api_NotInitialised() { - return sdrplay_api_NotInitialised; - } - private static final int sdrplay_api_NotEnabled = (int)11L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotEnabled = 11 - * } - */ - public static int sdrplay_api_NotEnabled() { - return sdrplay_api_NotEnabled; - } - private static final int sdrplay_api_HwVerError = (int)12L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwVerError = 12 - * } - */ - public static int sdrplay_api_HwVerError() { - return sdrplay_api_HwVerError; - } - private static final int sdrplay_api_OutOfMemError = (int)13L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfMemError = 13 - * } - */ - public static int sdrplay_api_OutOfMemError() { - return sdrplay_api_OutOfMemError; - } - private static final int sdrplay_api_ServiceNotResponding = (int)14L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ServiceNotResponding = 14 - * } - */ - public static int sdrplay_api_ServiceNotResponding() { - return sdrplay_api_ServiceNotResponding; - } - private static final int sdrplay_api_StartPending = (int)15L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StartPending = 15 - * } - */ - public static int sdrplay_api_StartPending() { - return sdrplay_api_StartPending; - } - private static final int sdrplay_api_StopPending = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StopPending = 16 - * } - */ - public static int sdrplay_api_StopPending() { - return sdrplay_api_StopPending; - } - private static final int sdrplay_api_InvalidMode = (int)17L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidMode = 17 - * } - */ - public static int sdrplay_api_InvalidMode() { - return sdrplay_api_InvalidMode; - } - private static final int sdrplay_api_FailedVerification1 = (int)18L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification1 = 18 - * } - */ - public static int sdrplay_api_FailedVerification1() { - return sdrplay_api_FailedVerification1; - } - private static final int sdrplay_api_FailedVerification2 = (int)19L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification2 = 19 - * } - */ - public static int sdrplay_api_FailedVerification2() { - return sdrplay_api_FailedVerification2; - } - private static final int sdrplay_api_FailedVerification3 = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification3 = 20 - * } - */ - public static int sdrplay_api_FailedVerification3() { - return sdrplay_api_FailedVerification3; - } - private static final int sdrplay_api_FailedVerification4 = (int)21L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification4 = 21 - * } - */ - public static int sdrplay_api_FailedVerification4() { - return sdrplay_api_FailedVerification4; - } - private static final int sdrplay_api_FailedVerification5 = (int)22L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification5 = 22 - * } - */ - public static int sdrplay_api_FailedVerification5() { - return sdrplay_api_FailedVerification5; - } - private static final int sdrplay_api_FailedVerification6 = (int)23L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification6 = 23 - * } - */ - public static int sdrplay_api_FailedVerification6() { - return sdrplay_api_FailedVerification6; - } - private static final int sdrplay_api_InvalidServiceVersion = (int)24L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidServiceVersion = 24 - * } - */ - public static int sdrplay_api_InvalidServiceVersion() { - return sdrplay_api_InvalidServiceVersion; - } - private static final int sdrplay_api_Update_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_None = 0 - * } - */ - public static int sdrplay_api_Update_None() { - return sdrplay_api_Update_None; - } - private static final int sdrplay_api_Update_Dev_Fs = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Fs = 1 - * } - */ - public static int sdrplay_api_Update_Dev_Fs() { - return sdrplay_api_Update_Dev_Fs; - } - private static final int sdrplay_api_Update_Dev_Ppm = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Ppm = 2 - * } - */ - public static int sdrplay_api_Update_Dev_Ppm() { - return sdrplay_api_Update_Dev_Ppm; - } - private static final int sdrplay_api_Update_Dev_SyncUpdate = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4 - * } - */ - public static int sdrplay_api_Update_Dev_SyncUpdate() { - return sdrplay_api_Update_Dev_SyncUpdate; - } - private static final int sdrplay_api_Update_Dev_ResetFlags = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8 - * } - */ - public static int sdrplay_api_Update_Dev_ResetFlags() { - return sdrplay_api_Update_Dev_ResetFlags; - } - private static final int sdrplay_api_Update_Rsp1a_BiasTControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16 - * } - */ - public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return sdrplay_api_Update_Rsp1a_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfNotchControl = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return sdrplay_api_Update_Rsp1a_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfDabNotchControl = (int)64L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return sdrplay_api_Update_Rsp1a_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_BiasTControl = (int)128L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128 - * } - */ - public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return sdrplay_api_Update_Rsp2_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp2_AmPortSelect = (int)256L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256 - * } - */ - public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return sdrplay_api_Update_Rsp2_AmPortSelect; - } - private static final int sdrplay_api_Update_Rsp2_AntennaControl = (int)512L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512 - * } - */ - public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return sdrplay_api_Update_Rsp2_AntennaControl; - } - private static final int sdrplay_api_Update_Rsp2_RfNotchControl = (int)1024L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024 - * } - */ - public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return sdrplay_api_Update_Rsp2_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_ExtRefControl = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048 - * } - */ - public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return sdrplay_api_Update_Rsp2_ExtRefControl; - } - private static final int sdrplay_api_Update_RspDuo_ExtRefControl = (int)4096L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096 - * } - */ - public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return sdrplay_api_Update_RspDuo_ExtRefControl; - } - private static final int sdrplay_api_Update_Master_Spare_1 = (int)8192L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192 - * } - */ - public static int sdrplay_api_Update_Master_Spare_1() { - return sdrplay_api_Update_Master_Spare_1; - } - private static final int sdrplay_api_Update_Master_Spare_2 = (int)16384L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384 - * } - */ - public static int sdrplay_api_Update_Master_Spare_2() { - return sdrplay_api_Update_Master_Spare_2; - } - private static final int sdrplay_api_Update_Tuner_Gr = (int)32768L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Gr = 32768 - * } - */ - public static int sdrplay_api_Update_Tuner_Gr() { - return sdrplay_api_Update_Tuner_Gr; - } - private static final int sdrplay_api_Update_Tuner_GrLimits = (int)65536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536 - * } - */ - public static int sdrplay_api_Update_Tuner_GrLimits() { - return sdrplay_api_Update_Tuner_GrLimits; - } - private static final int sdrplay_api_Update_Tuner_Frf = (int)131072L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Frf = 131072 - * } - */ - public static int sdrplay_api_Update_Tuner_Frf() { - return sdrplay_api_Update_Tuner_Frf; - } - private static final int sdrplay_api_Update_Tuner_BwType = (int)262144L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_BwType = 262144 - * } - */ - public static int sdrplay_api_Update_Tuner_BwType() { - return sdrplay_api_Update_Tuner_BwType; - } - private static final int sdrplay_api_Update_Tuner_IfType = (int)524288L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_IfType = 524288 - * } - */ - public static int sdrplay_api_Update_Tuner_IfType() { - return sdrplay_api_Update_Tuner_IfType; - } - private static final int sdrplay_api_Update_Tuner_DcOffset = (int)1048576L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576 - * } - */ - public static int sdrplay_api_Update_Tuner_DcOffset() { - return sdrplay_api_Update_Tuner_DcOffset; - } - private static final int sdrplay_api_Update_Tuner_LoMode = (int)2097152L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152 - * } - */ - public static int sdrplay_api_Update_Tuner_LoMode() { - return sdrplay_api_Update_Tuner_LoMode; - } - private static final int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = (int)4194304L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304 - * } - */ - public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return sdrplay_api_Update_Ctrl_DCoffsetIQimbalance; - } - private static final int sdrplay_api_Update_Ctrl_Decimation = (int)8388608L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608 - * } - */ - public static int sdrplay_api_Update_Ctrl_Decimation() { - return sdrplay_api_Update_Ctrl_Decimation; - } - private static final int sdrplay_api_Update_Ctrl_Agc = (int)16777216L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216 - * } - */ - public static int sdrplay_api_Update_Ctrl_Agc() { - return sdrplay_api_Update_Ctrl_Agc; - } - private static final int sdrplay_api_Update_Ctrl_AdsbMode = (int)33554432L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432 - * } - */ - public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return sdrplay_api_Update_Ctrl_AdsbMode; - } - private static final int sdrplay_api_Update_Ctrl_OverloadMsgAck = (int)67108864L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864 - * } - */ - public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return sdrplay_api_Update_Ctrl_OverloadMsgAck; - } - private static final int sdrplay_api_Update_RspDuo_BiasTControl = (int)134217728L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728 - * } - */ - public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return sdrplay_api_Update_RspDuo_BiasTControl; - } - private static final int sdrplay_api_Update_RspDuo_AmPortSelect = (int)268435456L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456 - * } - */ - public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return sdrplay_api_Update_RspDuo_AmPortSelect; - } - private static final int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = (int)536870912L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912 - * } - */ - public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return sdrplay_api_Update_RspDuo_Tuner1AmNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfNotchControl = (int)1073741824L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return sdrplay_api_Update_RspDuo_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfDabNotchControl = (int)-2147483648L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return sdrplay_api_Update_RspDuo_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Ext1_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ext1_None = 0 - * } - */ - public static int sdrplay_api_Update_Ext1_None() { - return sdrplay_api_Update_Ext1_None; - } - private static final int sdrplay_api_Update_RspDx_HdrEnable = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrEnable() { - return sdrplay_api_Update_RspDx_HdrEnable; - } - private static final int sdrplay_api_Update_RspDx_BiasTControl = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2 - * } - */ - public static int sdrplay_api_Update_RspDx_BiasTControl() { - return sdrplay_api_Update_RspDx_BiasTControl; - } - private static final int sdrplay_api_Update_RspDx_AntennaControl = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4 - * } - */ - public static int sdrplay_api_Update_RspDx_AntennaControl() { - return sdrplay_api_Update_RspDx_AntennaControl; - } - private static final int sdrplay_api_Update_RspDx_RfNotchControl = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8 - * } - */ - public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return sdrplay_api_Update_RspDx_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDx_RfDabNotchControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16 - * } - */ - public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return sdrplay_api_Update_RspDx_RfDabNotchControl; - } - private static final int sdrplay_api_Update_RspDx_HdrBw = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrBw() { - return sdrplay_api_Update_RspDx_HdrBw; - } - private static final int sdrplay_api_DbgLvl_Disable = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Disable = 0 - * } - */ - public static int sdrplay_api_DbgLvl_Disable() { - return sdrplay_api_DbgLvl_Disable; - } - private static final int sdrplay_api_DbgLvl_Verbose = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Verbose = 1 - * } - */ - public static int sdrplay_api_DbgLvl_Verbose() { - return sdrplay_api_DbgLvl_Verbose; - } - private static final int sdrplay_api_DbgLvl_Warning = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Warning = 2 - * } - */ - public static int sdrplay_api_DbgLvl_Warning() { - return sdrplay_api_DbgLvl_Warning; - } - private static final int sdrplay_api_DbgLvl_Error = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Error = 3 - * } - */ - public static int sdrplay_api_DbgLvl_Error() { - return sdrplay_api_DbgLvl_Error; - } - private static final int sdrplay_api_DbgLvl_Message = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Message = 4 - * } - */ - public static int sdrplay_api_DbgLvl_Message() { - return sdrplay_api_DbgLvl_Message; - } - private static final int MAX_BB_GR = (int)59L; - /** - * {@snippet lang=c : - * #define MAX_BB_GR 59 - * } - */ - public static int MAX_BB_GR() { - return MAX_BB_GR; - } - private static final float SDRPLAY_API_VERSION = 3.0799999237060547f; - /** - * {@snippet lang=c : - * #define SDRPLAY_API_VERSION 3.0799999237060547 - * } - */ - public static float SDRPLAY_API_VERSION() { - return SDRPLAY_API_VERSION; - } - private static final int SDRPLAY_MAX_DEVICES = (int)16L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_DEVICES 16 - * } - */ - public static int SDRPLAY_MAX_DEVICES() { - return SDRPLAY_MAX_DEVICES; - } - private static final int SDRPLAY_MAX_TUNERS_PER_DEVICE = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 - * } - */ - public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return SDRPLAY_MAX_TUNERS_PER_DEVICE; - } - private static final int SDRPLAY_MAX_SER_NO_LEN = (int)64L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_SER_NO_LEN 64 - * } - */ - public static int SDRPLAY_MAX_SER_NO_LEN() { - return SDRPLAY_MAX_SER_NO_LEN; - } - private static final int SDRPLAY_MAX_ROOT_NM_LEN = (int)32L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_ROOT_NM_LEN 32 - * } - */ - public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return SDRPLAY_MAX_ROOT_NM_LEN; - } - private static final int SDRPLAY_RSP1_ID = (int)1L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1_ID 1 - * } - */ - public static int SDRPLAY_RSP1_ID() { - return SDRPLAY_RSP1_ID; - } - private static final int SDRPLAY_RSP1A_ID = (int)255L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1A_ID 255 - * } - */ - public static int SDRPLAY_RSP1A_ID() { - return SDRPLAY_RSP1A_ID; - } - private static final int SDRPLAY_RSP2_ID = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP2_ID 2 - * } - */ - public static int SDRPLAY_RSP2_ID() { - return SDRPLAY_RSP2_ID; - } - private static final int SDRPLAY_RSPduo_ID = (int)3L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPduo_ID 3 - * } - */ - public static int SDRPLAY_RSPduo_ID() { - return SDRPLAY_RSPduo_ID; - } - private static final int SDRPLAY_RSPdx_ID = (int)4L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPdx_ID 4 - * } - */ - public static int SDRPLAY_RSPdx_ID() { - return SDRPLAY_RSPdx_ID; - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_AgcT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_AgcT.java deleted file mode 100644 index 8c228626..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_AgcT.java +++ /dev/null @@ -1,423 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.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 lang=c : - * struct { - * sdrplay_api_AgcControlT enable; - * int setPoint_dBfs; - * unsigned short attack_ms; - * unsigned short decay_ms; - * unsigned short decay_delay_ms; - * unsigned short decay_threshold_dB; - * int syncUpdate; - * } - * } - */ -public class sdrplay_api_AgcT { - - sdrplay_api_AgcT() { - // Should not be called directly - } - - 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 lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static int enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcControlT enable - * } - */ - public static void enable(MemorySegment struct, int fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int setPoint_dBfs - * } - */ - public static int setPoint_dBfs(MemorySegment struct) { - return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int setPoint_dBfs - * } - */ - public static void setPoint_dBfs(MemorySegment struct, int fieldValue) { - struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short attack_ms - * } - */ - public static short attack_ms(MemorySegment struct) { - return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short attack_ms - * } - */ - public static void attack_ms(MemorySegment struct, short fieldValue) { - struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_ms - * } - */ - public static short decay_ms(MemorySegment struct) { - return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_ms - * } - */ - public static void decay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_delay_ms - * } - */ - public static short decay_delay_ms(MemorySegment struct) { - return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_delay_ms - * } - */ - public static void decay_delay_ms(MemorySegment struct, short fieldValue) { - struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static short decay_threshold_dB(MemorySegment struct) { - return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned short decay_threshold_dB - * } - */ - public static void decay_threshold_dB(MemorySegment struct, short fieldValue) { - struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * int syncUpdate - * } - */ - public static int syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, int fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ApiVersion_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ApiVersion_t.java deleted file mode 100644 index 24065394..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ApiVersion_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *) - * } - */ -public class sdrplay_api_ApiVersion_t { - - sdrplay_api_ApiVersion_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_CallbackFnsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_CallbackFnsT.java deleted file mode 100644 index 78c5961e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_CallbackFnsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_StreamCallback_t StreamACbFn; - * sdrplay_api_StreamCallback_t StreamBCbFn; - * sdrplay_api_EventCallback_t EventCbFn; - * } - * } - */ -public class sdrplay_api_CallbackFnsT { - - sdrplay_api_CallbackFnsT() { - // Should not be called directly - } - - 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$72: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 lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static MemorySegment StreamACbFn(MemorySegment struct) { - return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamACbFn - * } - */ - public static void StreamACbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamACbFn$LAYOUT, StreamACbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static MemorySegment StreamBCbFn(MemorySegment struct) { - return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_StreamCallback_t StreamBCbFn - * } - */ - public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue); - } - - 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; - } - - 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 lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static MemorySegment EventCbFn(MemorySegment struct) { - return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_EventCallback_t EventCbFn - * } - */ - public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) { - struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Close_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Close_t.java deleted file mode 100644 index 9884e9f4..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Close_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void) - * } - */ -public class sdrplay_api_Close_t { - - sdrplay_api_Close_t() { - // Should not be called directly - } - - /** - * 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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ControlParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ControlParamsT.java deleted file mode 100644 index b77c5ff5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ControlParamsT.java +++ /dev/null @@ -1,285 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DcOffsetT dcOffset; - * sdrplay_api_DecimationT decimation; - * sdrplay_api_AgcT agc; - * sdrplay_api_AdsbModeT adsbMode; - * } - * } - */ -public class sdrplay_api_ControlParamsT { - - sdrplay_api_ControlParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_DcOffsetT.layout().withName("dcOffset"), - sdrplay_api_DecimationT.layout().withName("decimation"), - MemoryLayout.paddingLayout(3), - sdrplay_api_AgcT.layout().withName("agc"), - sdrplay_api_h.C_INT.withName("adsbMode") - ).withName("$anon$47:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout dcOffset$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffset")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final GroupLayout dcOffset$layout() { - return dcOffset$LAYOUT; - } - - private static final long dcOffset$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static final long dcOffset$offset() { - return dcOffset$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static MemorySegment dcOffset(MemorySegment struct) { - return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetT dcOffset - * } - */ - public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); - } - - private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final GroupLayout decimation$layout() { - return decimation$LAYOUT; - } - - private static final long decimation$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static final long decimation$offset() { - return decimation$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static MemorySegment decimation(MemorySegment struct) { - return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DecimationT decimation - * } - */ - public static void decimation(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, decimation$OFFSET, decimation$LAYOUT.byteSize()); - } - - private static final GroupLayout agc$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("agc")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final GroupLayout agc$layout() { - return agc$LAYOUT; - } - - private static final long agc$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static final long agc$offset() { - return agc$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static MemorySegment agc(MemorySegment struct) { - return struct.asSlice(agc$OFFSET, agc$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AgcT agc - * } - */ - public static void agc(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, agc$OFFSET, agc$LAYOUT.byteSize()); - } - - private static final OfInt adsbMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("adsbMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final OfInt adsbMode$layout() { - return adsbMode$LAYOUT; - } - - private static final long adsbMode$OFFSET = 28; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static final long adsbMode$offset() { - return adsbMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static int adsbMode(MemorySegment struct) { - return struct.get(adsbMode$LAYOUT, adsbMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_AdsbModeT adsbMode - * } - */ - public static void adsbMode(MemorySegment struct, int fieldValue) { - struct.set(adsbMode$LAYOUT, adsbMode$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetT.java deleted file mode 100644 index eee8b6e6..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char DCenable; - * unsigned char IQenable; - * } - * } - */ -public class sdrplay_api_DcOffsetT { - - sdrplay_api_DcOffsetT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("DCenable"), - sdrplay_api_h.C_CHAR.withName("IQenable") - ).withName("$anon$23:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final OfByte DCenable$layout() { - return DCenable$LAYOUT; - } - - private static final long DCenable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static final long DCenable$offset() { - return DCenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static byte DCenable(MemorySegment struct) { - return struct.get(DCenable$LAYOUT, DCenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char DCenable - * } - */ - public static void DCenable(MemorySegment struct, byte fieldValue) { - struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue); - } - - private static final OfByte IQenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("IQenable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final OfByte IQenable$layout() { - return IQenable$LAYOUT; - } - - private static final long IQenable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static final long IQenable$offset() { - return IQenable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static byte IQenable(MemorySegment struct) { - return struct.get(IQenable$LAYOUT, IQenable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char IQenable - * } - */ - public static void IQenable(MemorySegment struct, byte fieldValue) { - struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetTunerT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetTunerT.java deleted file mode 100644 index 21eb36ba..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetTunerT.java +++ /dev/null @@ -1,286 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char dcCal; - * unsigned char speedUp; - * int trackTime; - * int refreshRateTime; - * } - * } - */ -public class sdrplay_api_DcOffsetTunerT { - - sdrplay_api_DcOffsetTunerT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("dcCal"), - sdrplay_api_h.C_CHAR.withName("speedUp"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("trackTime"), - sdrplay_api_h.C_INT.withName("refreshRateTime") - ).withName("$anon$75:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte dcCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("dcCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final OfByte dcCal$layout() { - return dcCal$LAYOUT; - } - - private static final long dcCal$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static final long dcCal$offset() { - return dcCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static byte dcCal(MemorySegment struct) { - return struct.get(dcCal$LAYOUT, dcCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char dcCal - * } - */ - public static void dcCal(MemorySegment struct, byte fieldValue) { - struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue); - } - - private static final OfByte speedUp$LAYOUT = (OfByte)$LAYOUT.select(groupElement("speedUp")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final OfByte speedUp$layout() { - return speedUp$LAYOUT; - } - - private static final long speedUp$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static final long speedUp$offset() { - return speedUp$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static byte speedUp(MemorySegment struct) { - return struct.get(speedUp$LAYOUT, speedUp$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char speedUp - * } - */ - public static void speedUp(MemorySegment struct, byte fieldValue) { - struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue); - } - - private static final OfInt trackTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("trackTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final OfInt trackTime$layout() { - return trackTime$LAYOUT; - } - - private static final long trackTime$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static final long trackTime$offset() { - return trackTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static int trackTime(MemorySegment struct) { - return struct.get(trackTime$LAYOUT, trackTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int trackTime - * } - */ - public static void trackTime(MemorySegment struct, int fieldValue) { - struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue); - } - - private static final OfInt refreshRateTime$LAYOUT = (OfInt)$LAYOUT.select(groupElement("refreshRateTime")); - - /** - * Layout for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final OfInt refreshRateTime$layout() { - return refreshRateTime$LAYOUT; - } - - private static final long refreshRateTime$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static final long refreshRateTime$offset() { - return refreshRateTime$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static int refreshRateTime(MemorySegment struct) { - return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int refreshRateTime - * } - */ - public static void refreshRateTime(MemorySegment struct, int fieldValue) { - struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DebugEnable_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DebugEnable_t.java deleted file mode 100644 index cb2e5cf7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DebugEnable_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t) - * } - */ -public class sdrplay_api_DebugEnable_t { - - sdrplay_api_DebugEnable_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int dbgLvl); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DecimationT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DecimationT.java deleted file mode 100644 index 4dd25001..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DecimationT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char enable; - * unsigned char decimationFactor; - * unsigned char wideBandSignal; - * } - * } - */ -public class sdrplay_api_DecimationT { - - sdrplay_api_DecimationT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("enable"), - sdrplay_api_h.C_CHAR.withName("decimationFactor"), - sdrplay_api_h.C_CHAR.withName("wideBandSignal") - ).withName("$anon$29:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final OfByte enable$layout() { - return enable$LAYOUT; - } - - private static final long enable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static final long enable$offset() { - return enable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static byte enable(MemorySegment struct) { - return struct.get(enable$LAYOUT, enable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char enable - * } - */ - public static void enable(MemorySegment struct, byte fieldValue) { - struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); - } - - private static final OfByte decimationFactor$LAYOUT = (OfByte)$LAYOUT.select(groupElement("decimationFactor")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final OfByte decimationFactor$layout() { - return decimationFactor$LAYOUT; - } - - private static final long decimationFactor$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static final long decimationFactor$offset() { - return decimationFactor$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static byte decimationFactor(MemorySegment struct) { - return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char decimationFactor - * } - */ - public static void decimationFactor(MemorySegment struct, byte fieldValue) { - struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue); - } - - private static final OfByte wideBandSignal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("wideBandSignal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final OfByte wideBandSignal$layout() { - return wideBandSignal$LAYOUT; - } - - private static final long wideBandSignal$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static final long wideBandSignal$offset() { - return wideBandSignal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static byte wideBandSignal(MemorySegment struct) { - return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char wideBandSignal - * } - */ - public static void wideBandSignal(MemorySegment struct, byte fieldValue) { - struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DevParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DevParamsT.java deleted file mode 100644 index 26994427..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DevParamsT.java +++ /dev/null @@ -1,563 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * double ppm; - * sdrplay_api_FsFreqT fsFreq; - * sdrplay_api_SyncUpdateT syncUpdate; - * sdrplay_api_ResetFlagsT resetFlags; - * sdrplay_api_TransferModeT mode; - * unsigned int samplesPerPkt; - * sdrplay_api_Rsp1aParamsT rsp1aParams; - * sdrplay_api_Rsp2ParamsT rsp2Params; - * sdrplay_api_RspDuoParamsT rspDuoParams; - * sdrplay_api_RspDxParamsT rspDxParams; - * } - * } - */ -public class sdrplay_api_DevParamsT { - - sdrplay_api_DevParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("ppm"), - sdrplay_api_FsFreqT.layout().withName("fsFreq"), - sdrplay_api_SyncUpdateT.layout().withName("syncUpdate"), - sdrplay_api_ResetFlagsT.layout().withName("resetFlags"), - MemoryLayout.paddingLayout(1), - sdrplay_api_h.C_INT.withName("mode"), - sdrplay_api_h.C_INT.withName("samplesPerPkt"), - sdrplay_api_Rsp1aParamsT.layout().withName("rsp1aParams"), - sdrplay_api_Rsp2ParamsT.layout().withName("rsp2Params"), - MemoryLayout.paddingLayout(1), - sdrplay_api_RspDuoParamsT.layout().withName("rspDuoParams"), - sdrplay_api_RspDxParamsT.layout().withName("rspDxParams") - ).withName("$anon$37:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble ppm$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("ppm")); - - /** - * Layout for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final OfDouble ppm$layout() { - return ppm$LAYOUT; - } - - private static final long ppm$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static final long ppm$offset() { - return ppm$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static double ppm(MemorySegment struct) { - return struct.get(ppm$LAYOUT, ppm$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double ppm - * } - */ - public static void ppm(MemorySegment struct, double fieldValue) { - struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue); - } - - private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final GroupLayout fsFreq$layout() { - return fsFreq$LAYOUT; - } - - private static final long fsFreq$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static final long fsFreq$offset() { - return fsFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static MemorySegment fsFreq(MemorySegment struct) { - return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_FsFreqT fsFreq - * } - */ - public static void fsFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout syncUpdate$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final GroupLayout syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 24; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static MemorySegment syncUpdate(MemorySegment struct) { - return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_SyncUpdateT syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); - } - - private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final GroupLayout resetFlags$layout() { - return resetFlags$LAYOUT; - } - - private static final long resetFlags$OFFSET = 32; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static final long resetFlags$offset() { - return resetFlags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static MemorySegment resetFlags(MemorySegment struct) { - return struct.asSlice(resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ResetFlagsT resetFlags - * } - */ - public static void resetFlags(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, resetFlags$OFFSET, resetFlags$LAYOUT.byteSize()); - } - - private static final OfInt mode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("mode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final OfInt mode$layout() { - return mode$LAYOUT; - } - - private static final long mode$OFFSET = 36; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static final long mode$offset() { - return mode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static int mode(MemorySegment struct) { - return struct.get(mode$LAYOUT, mode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TransferModeT mode - * } - */ - public static void mode(MemorySegment struct, int fieldValue) { - struct.set(mode$LAYOUT, mode$OFFSET, fieldValue); - } - - private static final OfInt samplesPerPkt$LAYOUT = (OfInt)$LAYOUT.select(groupElement("samplesPerPkt")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final OfInt samplesPerPkt$layout() { - return samplesPerPkt$LAYOUT; - } - - private static final long samplesPerPkt$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static final long samplesPerPkt$offset() { - return samplesPerPkt$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static int samplesPerPkt(MemorySegment struct) { - return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int samplesPerPkt - * } - */ - public static void samplesPerPkt(MemorySegment struct, int fieldValue) { - struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue); - } - - private static final GroupLayout rsp1aParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final GroupLayout rsp1aParams$layout() { - return rsp1aParams$LAYOUT; - } - - private static final long rsp1aParams$OFFSET = 44; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static final long rsp1aParams$offset() { - return rsp1aParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static MemorySegment rsp1aParams(MemorySegment struct) { - return struct.asSlice(rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aParamsT rsp1aParams - * } - */ - public static void rsp1aParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aParams$OFFSET, rsp1aParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2Params$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2Params")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final GroupLayout rsp2Params$layout() { - return rsp2Params$LAYOUT; - } - - private static final long rsp2Params$OFFSET = 46; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static final long rsp2Params$offset() { - return rsp2Params$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static MemorySegment rsp2Params(MemorySegment struct) { - return struct.asSlice(rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2ParamsT rsp2Params - * } - */ - public static void rsp2Params(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2Params$OFFSET, rsp2Params$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final GroupLayout rspDuoParams$layout() { - return rspDuoParams$LAYOUT; - } - - private static final long rspDuoParams$OFFSET = 48; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static final long rspDuoParams$offset() { - return rspDuoParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static MemorySegment rspDuoParams(MemorySegment struct) { - return struct.asSlice(rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoParamsT rspDuoParams - * } - */ - public static void rspDuoParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoParams$OFFSET, rspDuoParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final GroupLayout rspDxParams$layout() { - return rspDxParams$LAYOUT; - } - - private static final long rspDxParams$OFFSET = 52; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static final long rspDxParams$offset() { - return rspDxParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static MemorySegment rspDxParams(MemorySegment struct) { - return struct.asSlice(rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxParamsT rspDxParams - * } - */ - public static void rspDxParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxParams$OFFSET, rspDxParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceParamsT.java deleted file mode 100644 index 8ef7adab..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceParamsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_DevParamsT *devParams; - * sdrplay_api_RxChannelParamsT *rxChannelA; - * sdrplay_api_RxChannelParamsT *rxChannelB; - * } - * } - */ -public class sdrplay_api_DeviceParamsT { - - sdrplay_api_DeviceParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_POINTER.withName("devParams"), - sdrplay_api_h.C_POINTER.withName("rxChannelA"), - sdrplay_api_h.C_POINTER.withName("rxChannelB") - ).withName("$anon$157:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final AddressLayout devParams$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("devParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final AddressLayout devParams$layout() { - return devParams$LAYOUT; - } - - private static final long devParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static final long devParams$offset() { - return devParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static MemorySegment devParams(MemorySegment struct) { - return struct.get(devParams$LAYOUT, devParams$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DevParamsT *devParams - * } - */ - public static void devParams(MemorySegment struct, MemorySegment fieldValue) { - struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelA$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelA")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final AddressLayout rxChannelA$layout() { - return rxChannelA$LAYOUT; - } - - private static final long rxChannelA$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static final long rxChannelA$offset() { - return rxChannelA$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static MemorySegment rxChannelA(MemorySegment struct) { - return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelA - * } - */ - public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue); - } - - private static final AddressLayout rxChannelB$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("rxChannelB")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final AddressLayout rxChannelB$layout() { - return rxChannelB$LAYOUT; - } - - private static final long rxChannelB$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static final long rxChannelB$offset() { - return rxChannelB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static MemorySegment rxChannelB(MemorySegment struct) { - return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RxChannelParamsT *rxChannelB - * } - */ - public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) { - struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceT.java deleted file mode 100644 index 1467972f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceT.java +++ /dev/null @@ -1,463 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char SerNo[64]; - * unsigned char hwVer; - * sdrplay_api_TunerSelectT tuner; - * sdrplay_api_RspDuoModeT rspDuoMode; - * unsigned char valid; - * double rspDuoSampleFreq; - * HANDLE dev; - * } - * } - */ -public class sdrplay_api_DeviceT { - - sdrplay_api_DeviceT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, sdrplay_api_h.C_CHAR).withName("SerNo"), - sdrplay_api_h.C_CHAR.withName("hwVer"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner"), - sdrplay_api_h.C_INT.withName("rspDuoMode"), - sdrplay_api_h.C_CHAR.withName("valid"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_DOUBLE.withName("rspDuoSampleFreq"), - sdrplay_api_h.C_POINTER.withName("dev") - ).withName("$anon$145:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout SerNo$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("SerNo")); - - /** - * Layout for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final SequenceLayout SerNo$layout() { - return SerNo$LAYOUT; - } - - private static final long SerNo$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static final long SerNo$offset() { - return SerNo$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static MemorySegment SerNo(MemorySegment struct) { - return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, SerNo$OFFSET, SerNo$LAYOUT.byteSize()); - } - - private static long[] SerNo$DIMS = { 64 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static long[] SerNo$dimensions() { - return SerNo$DIMS; - } - private static final VarHandle SerNo$ELEM_HANDLE = SerNo$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static byte SerNo(MemorySegment struct, long index0) { - return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char SerNo[64] - * } - */ - public static void SerNo(MemorySegment struct, long index0, byte fieldValue) { - SerNo$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfByte hwVer$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hwVer")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final OfByte hwVer$layout() { - return hwVer$LAYOUT; - } - - private static final long hwVer$OFFSET = 64; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static final long hwVer$offset() { - return hwVer$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static byte hwVer(MemorySegment struct) { - return struct.get(hwVer$LAYOUT, hwVer$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hwVer - * } - */ - public static void hwVer(MemorySegment struct, byte fieldValue) { - struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue); - } - - private static final OfInt tuner$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final OfInt tuner$layout() { - return tuner$LAYOUT; - } - - private static final long tuner$OFFSET = 68; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static final long tuner$offset() { - return tuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static int tuner(MemorySegment struct) { - return struct.get(tuner$LAYOUT, tuner$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerSelectT tuner - * } - */ - public static void tuner(MemorySegment struct, int fieldValue) { - struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue); - } - - private static final OfInt rspDuoMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rspDuoMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final OfInt rspDuoMode$layout() { - return rspDuoMode$LAYOUT; - } - - private static final long rspDuoMode$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static final long rspDuoMode$offset() { - return rspDuoMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static int rspDuoMode(MemorySegment struct) { - return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeT rspDuoMode - * } - */ - public static void rspDuoMode(MemorySegment struct, int fieldValue) { - struct.set(rspDuoMode$LAYOUT, rspDuoMode$OFFSET, fieldValue); - } - - private static final OfByte valid$LAYOUT = (OfByte)$LAYOUT.select(groupElement("valid")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static final OfByte valid$layout() { - return valid$LAYOUT; - } - - private static final long valid$OFFSET = 76; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static final long valid$offset() { - return valid$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static byte valid(MemorySegment struct) { - return struct.get(valid$LAYOUT, valid$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char valid - * } - */ - public static void valid(MemorySegment struct, byte fieldValue) { - struct.set(valid$LAYOUT, valid$OFFSET, fieldValue); - } - - private static final OfDouble rspDuoSampleFreq$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rspDuoSampleFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final OfDouble rspDuoSampleFreq$layout() { - return rspDuoSampleFreq$LAYOUT; - } - - private static final long rspDuoSampleFreq$OFFSET = 80; - - /** - * Offset for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static final long rspDuoSampleFreq$offset() { - return rspDuoSampleFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static double rspDuoSampleFreq(MemorySegment struct) { - return struct.get(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rspDuoSampleFreq - * } - */ - public static void rspDuoSampleFreq(MemorySegment struct, double fieldValue) { - struct.set(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET, fieldValue); - } - - private static final AddressLayout dev$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("dev")); - - /** - * Layout for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final AddressLayout dev$layout() { - return dev$LAYOUT; - } - - private static final long dev$OFFSET = 88; - - /** - * Offset for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static final long dev$offset() { - return dev$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static MemorySegment dev(MemorySegment struct) { - return struct.get(dev$LAYOUT, dev$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * HANDLE dev - * } - */ - public static void dev(MemorySegment struct, MemorySegment fieldValue) { - struct.set(dev$LAYOUT, dev$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DisableHeartbeat_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DisableHeartbeat_t.java deleted file mode 100644 index 1c8da1fc..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DisableHeartbeat_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void) - * } - */ -public class sdrplay_api_DisableHeartbeat_t { - - sdrplay_api_DisableHeartbeat_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ErrorInfoT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ErrorInfoT.java deleted file mode 100644 index 518b1514..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ErrorInfoT.java +++ /dev/null @@ -1,386 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.SequenceLayout; -import java.lang.invoke.VarHandle; -import java.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * char file[256]; - * char function[256]; - * int line; - * char message[1024]; - * } - * } - */ -public class sdrplay_api_ErrorInfoT { - - sdrplay_api_ErrorInfoT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"), - MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"), - sdrplay_api_h.C_INT.withName("line"), - MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message") - ).withName("$anon$165:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file")); - - /** - * Layout for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final SequenceLayout file$layout() { - return file$LAYOUT; - } - - private static final long file$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static final long file$offset() { - return file$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static MemorySegment file(MemorySegment struct) { - return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize()); - } - - private static long[] file$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static long[] file$dimensions() { - return file$DIMS; - } - private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static byte file(MemorySegment struct, long index0) { - return (byte)file$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char file[256] - * } - */ - public static void file(MemorySegment struct, long index0, byte fieldValue) { - file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function")); - - /** - * Layout for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final SequenceLayout function$layout() { - return function$LAYOUT; - } - - private static final long function$OFFSET = 256; - - /** - * Offset for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static final long function$offset() { - return function$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static MemorySegment function(MemorySegment struct) { - return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize()); - } - - private static long[] function$DIMS = { 256 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static long[] function$dimensions() { - return function$DIMS; - } - private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static byte function(MemorySegment struct, long index0) { - return (byte)function$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char function[256] - * } - */ - public static void function(MemorySegment struct, long index0, byte fieldValue) { - function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line")); - - /** - * Layout for field: - * {@snippet lang=c : - * int line - * } - */ - public static final OfInt line$layout() { - return line$LAYOUT; - } - - private static final long line$OFFSET = 512; - - /** - * Offset for field: - * {@snippet lang=c : - * int line - * } - */ - public static final long line$offset() { - return line$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int line - * } - */ - public static int line(MemorySegment struct) { - return struct.get(line$LAYOUT, line$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int line - * } - */ - public static void line(MemorySegment struct, int fieldValue) { - struct.set(line$LAYOUT, line$OFFSET, fieldValue); - } - - private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message")); - - /** - * Layout for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final SequenceLayout message$layout() { - return message$LAYOUT; - } - - private static final long message$OFFSET = 516; - - /** - * Offset for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static final long message$offset() { - return message$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static MemorySegment message(MemorySegment struct) { - return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize()); - } - - private static long[] message$DIMS = { 1024 }; - - /** - * Dimensions for array field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static long[] message$dimensions() { - return message$DIMS; - } - private static final VarHandle message$ELEM_HANDLE = message$LAYOUT.varHandle(sequenceElement()); - - /** - * Indexed getter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static byte message(MemorySegment struct, long index0) { - return (byte)message$ELEM_HANDLE.get(struct, 0L, index0); - } - - /** - * Indexed setter for field: - * {@snippet lang=c : - * char message[1024] - * } - */ - public static void message(MemorySegment struct, long index0, byte fieldValue) { - message$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventCallback_t.java deleted file mode 100644 index 82531494..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventCallback_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *) - * } - */ -public class sdrplay_api_EventCallback_t { - - sdrplay_api_EventCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventParamsT.java deleted file mode 100644 index 94c6c82a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventParamsT.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * union { - * sdrplay_api_GainCbParamT gainParams; - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * } - * } - */ -public class sdrplay_api_EventParamsT { - - sdrplay_api_EventParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.unionLayout( - sdrplay_api_GainCbParamT.layout().withName("gainParams"), - sdrplay_api_PowerOverloadCbParamT.layout().withName("powerOverloadParams"), - sdrplay_api_RspDuoModeCbParamT.layout().withName("rspDuoModeParams") - ).withName("$anon$50:9"); - - /** - * The layout of this union - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout gainParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final GroupLayout gainParams$layout() { - return gainParams$LAYOUT; - } - - private static final long gainParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static final long gainParams$offset() { - return gainParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static MemorySegment gainParams(MemorySegment union) { - return union.asSlice(gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainCbParamT gainParams - * } - */ - public static void gainParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, gainParams$OFFSET, gainParams$LAYOUT.byteSize()); - } - - private static final GroupLayout powerOverloadParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("powerOverloadParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final GroupLayout powerOverloadParams$layout() { - return powerOverloadParams$LAYOUT; - } - - private static final long powerOverloadParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static final long powerOverloadParams$offset() { - return powerOverloadParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static MemorySegment powerOverloadParams(MemorySegment union) { - return union.asSlice(powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams - * } - */ - public static void powerOverloadParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, powerOverloadParams$OFFSET, powerOverloadParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoModeParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoModeParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final GroupLayout rspDuoModeParams$layout() { - return rspDuoModeParams$LAYOUT; - } - - private static final long rspDuoModeParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static final long rspDuoModeParams$offset() { - return rspDuoModeParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static MemorySegment rspDuoModeParams(MemorySegment union) { - return union.asSlice(rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams - * } - */ - public static void rspDuoModeParams(MemorySegment union, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, union, rspDuoModeParams$OFFSET, rspDuoModeParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this union - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_FsFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_FsFreqT.java deleted file mode 100644 index b88b295c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_FsFreqT.java +++ /dev/null @@ -1,240 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double fsHz; - * unsigned char syncUpdate; - * unsigned char reCal; - * } - * } - */ -public class sdrplay_api_FsFreqT { - - sdrplay_api_FsFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("fsHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - sdrplay_api_h.C_CHAR.withName("reCal"), - MemoryLayout.paddingLayout(6) - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final OfDouble fsHz$layout() { - return fsHz$LAYOUT; - } - - private static final long fsHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static final long fsHz$offset() { - return fsHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static double fsHz(MemorySegment struct) { - return struct.get(fsHz$LAYOUT, fsHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double fsHz - * } - */ - public static void fsHz(MemorySegment struct, double fieldValue) { - struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfByte reCal$LAYOUT = (OfByte)$LAYOUT.select(groupElement("reCal")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final OfByte reCal$layout() { - return reCal$LAYOUT; - } - - private static final long reCal$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static final long reCal$offset() { - return reCal$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static byte reCal(MemorySegment struct) { - return struct.get(reCal$LAYOUT, reCal$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char reCal - * } - */ - public static void reCal(MemorySegment struct, byte fieldValue) { - struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainCbParamT.java deleted file mode 100644 index 542a422d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainCbParamT.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned int gRdB; - * unsigned int lnaGRdB; - * double currGain; - * } - * } - */ -public class sdrplay_api_GainCbParamT { - - sdrplay_api_GainCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_INT.withName("lnaGRdB"), - sdrplay_api_h.C_DOUBLE.withName("currGain") - ).withName("$anon$32:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfInt lnaGRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("lnaGRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final OfInt lnaGRdB$layout() { - return lnaGRdB$LAYOUT; - } - - private static final long lnaGRdB$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static final long lnaGRdB$offset() { - return lnaGRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static int lnaGRdB(MemorySegment struct) { - return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int lnaGRdB - * } - */ - public static void lnaGRdB(MemorySegment struct, int fieldValue) { - struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue); - } - - private static final OfDouble currGain$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("currGain")); - - /** - * Layout for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final OfDouble currGain$layout() { - return currGain$LAYOUT; - } - - private static final long currGain$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static final long currGain$offset() { - return currGain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static double currGain(MemorySegment struct) { - return struct.get(currGain$LAYOUT, currGain$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double currGain - * } - */ - public static void currGain(MemorySegment struct, double fieldValue) { - struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainT.java deleted file mode 100644 index ab3cdf2b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainT.java +++ /dev/null @@ -1,332 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * int gRdB; - * unsigned char LNAstate; - * unsigned char syncUpdate; - * sdrplay_api_MinGainReductionT minGr; - * sdrplay_api_GainValuesT gainVals; - * } - * } - */ -public class sdrplay_api_GainT { - - sdrplay_api_GainT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("gRdB"), - sdrplay_api_h.C_CHAR.withName("LNAstate"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("minGr"), - sdrplay_api_GainValuesT.layout().withName("gainVals") - ).withName("$anon$60:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); - - /** - * Layout for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final OfInt gRdB$layout() { - return gRdB$LAYOUT; - } - - private static final long gRdB$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static final long gRdB$offset() { - return gRdB$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static int gRdB(MemorySegment struct) { - return struct.get(gRdB$LAYOUT, gRdB$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int gRdB - * } - */ - public static void gRdB(MemorySegment struct, int fieldValue) { - struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); - } - - private static final OfByte LNAstate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("LNAstate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final OfByte LNAstate$layout() { - return LNAstate$LAYOUT; - } - - private static final long LNAstate$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static final long LNAstate$offset() { - return LNAstate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static byte LNAstate(MemorySegment struct) { - return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char LNAstate - * } - */ - public static void LNAstate(MemorySegment struct, byte fieldValue) { - struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 5; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - private static final OfInt minGr$LAYOUT = (OfInt)$LAYOUT.select(groupElement("minGr")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final OfInt minGr$layout() { - return minGr$LAYOUT; - } - - private static final long minGr$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static final long minGr$offset() { - return minGr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static int minGr(MemorySegment struct) { - return struct.get(minGr$LAYOUT, minGr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_MinGainReductionT minGr - * } - */ - public static void minGr(MemorySegment struct, int fieldValue) { - struct.set(minGr$LAYOUT, minGr$OFFSET, fieldValue); - } - - private static final GroupLayout gainVals$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gainVals")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final GroupLayout gainVals$layout() { - return gainVals$LAYOUT; - } - - private static final long gainVals$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static final long gainVals$offset() { - return gainVals$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static MemorySegment gainVals(MemorySegment struct) { - return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainValuesT gainVals - * } - */ - public static void gainVals(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainValuesT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainValuesT.java deleted file mode 100644 index 06bcd867..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainValuesT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfFloat; - -/** - * {@snippet lang=c : - * struct { - * float curr; - * float max; - * float min; - * } - * } - */ -public class sdrplay_api_GainValuesT { - - sdrplay_api_GainValuesT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_FLOAT.withName("curr"), - sdrplay_api_h.C_FLOAT.withName("max"), - sdrplay_api_h.C_FLOAT.withName("min") - ).withName("$anon$53:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr")); - - /** - * Layout for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final OfFloat curr$layout() { - return curr$LAYOUT; - } - - private static final long curr$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * float curr - * } - */ - public static final long curr$offset() { - return curr$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static float curr(MemorySegment struct) { - return struct.get(curr$LAYOUT, curr$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float curr - * } - */ - public static void curr(MemorySegment struct, float fieldValue) { - struct.set(curr$LAYOUT, curr$OFFSET, fieldValue); - } - - private static final OfFloat max$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("max")); - - /** - * Layout for field: - * {@snippet lang=c : - * float max - * } - */ - public static final OfFloat max$layout() { - return max$LAYOUT; - } - - private static final long max$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * float max - * } - */ - public static final long max$offset() { - return max$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float max - * } - */ - public static float max(MemorySegment struct) { - return struct.get(max$LAYOUT, max$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float max - * } - */ - public static void max(MemorySegment struct, float fieldValue) { - struct.set(max$LAYOUT, max$OFFSET, fieldValue); - } - - private static final OfFloat min$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("min")); - - /** - * Layout for field: - * {@snippet lang=c : - * float min - * } - */ - public static final OfFloat min$layout() { - return min$LAYOUT; - } - - private static final long min$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * float min - * } - */ - public static final long min$offset() { - return min$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * float min - * } - */ - public static float min(MemorySegment struct) { - return struct.get(min$LAYOUT, min$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * float min - * } - */ - public static void min(MemorySegment struct, float fieldValue) { - struct.set(min$LAYOUT, min$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDeviceParams_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDeviceParams_t.java deleted file mode 100644 index 552b17d0..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDeviceParams_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **) - * } - */ -public class sdrplay_api_GetDeviceParams_t { - - sdrplay_api_GetDeviceParams_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment deviceParams); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDevices_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDevices_t.java deleted file mode 100644 index f9a5580d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDevices_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int) - * } - */ -public class sdrplay_api_GetDevices_t { - - sdrplay_api_GetDevices_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetErrorString_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetErrorString_t.java deleted file mode 100644 index 96aa9d9f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetErrorString_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT) - * } - */ -public class sdrplay_api_GetErrorString_t { - - sdrplay_api_GetErrorString_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(int err); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,int err) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastErrorByType_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastErrorByType_t.java deleted file mode 100644 index f1c3de6e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastErrorByType_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastErrorByType_t)(sdrplay_api_DeviceT *, int, unsigned long long *) - * } - */ -public class sdrplay_api_GetLastErrorByType_t { - - sdrplay_api_GetLastErrorByType_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device, int type, MemorySegment time); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - 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_GetLastErrorByType_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_GetLastErrorByType_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device, int type, MemorySegment time) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device, type, time); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastError_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastError_t.java deleted file mode 100644 index cef3897b..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastError_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_GetLastError_t { - - sdrplay_api_GetLastError_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - MemorySegment apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Init_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Init_t.java deleted file mode 100644 index 6cbd3d3e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Init_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *) - * } - */ -public class sdrplay_api_Init_t { - - sdrplay_api_Init_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_LockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_LockDeviceApi_t.java deleted file mode 100644 index 98ffc75c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_LockDeviceApi_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_LockDeviceApi_t { - - sdrplay_api_LockDeviceApi_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Open_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Open_t.java deleted file mode 100644 index db1d05a9..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Open_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void) - * } - */ -public class sdrplay_api_Open_t { - - sdrplay_api_Open_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr) { - try { - return (int) DOWN$MH.invokeExact(funcPtr); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_PowerOverloadCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_PowerOverloadCbParamT.java deleted file mode 100644 index 0f455751..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_PowerOverloadCbParamT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * } - * } - */ -public class sdrplay_api_PowerOverloadCbParamT { - - sdrplay_api_PowerOverloadCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("powerOverloadChangeType") - ).withName("$anon$39:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final OfInt powerOverloadChangeType$layout() { - return powerOverloadChangeType$LAYOUT; - } - - private static final long powerOverloadChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static final long powerOverloadChangeType$offset() { - return powerOverloadChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static int powerOverloadChangeType(MemorySegment struct) { - return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType - * } - */ - public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) { - struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ReleaseDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ReleaseDevice_t.java deleted file mode 100644 index 4250615d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ReleaseDevice_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_ReleaseDevice_t { - - sdrplay_api_ReleaseDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC); - - /** - * Allocates a new upcall stub, whose implementation is defined by {@code fi}. - * The lifetime of the returned segment is managed by {@code arena} - */ - public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ResetFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ResetFlagsT.java deleted file mode 100644 index 022e6fe7..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ResetFlagsT.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * unsigned char resetFsUpdate; - * } - * } - */ -public class sdrplay_api_ResetFlagsT { - - sdrplay_api_ResetFlagsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), - sdrplay_api_h.C_CHAR.withName("resetRfUpdate"), - sdrplay_api_h.C_CHAR.withName("resetFsUpdate") - ).withName("$anon$30:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final OfByte resetGainUpdate$layout() { - return resetGainUpdate$LAYOUT; - } - - private static final long resetGainUpdate$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final long resetGainUpdate$offset() { - return resetGainUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static byte resetGainUpdate(MemorySegment struct) { - return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetRfUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetRfUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final OfByte resetRfUpdate$layout() { - return resetRfUpdate$LAYOUT; - } - - private static final long resetRfUpdate$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final long resetRfUpdate$offset() { - return resetRfUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static byte resetRfUpdate(MemorySegment struct) { - return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetFsUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetFsUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final OfByte resetFsUpdate$layout() { - return resetFsUpdate$LAYOUT; - } - - private static final long resetFsUpdate$OFFSET = 2; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static final long resetFsUpdate$offset() { - return resetFsUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static byte resetFsUpdate(MemorySegment struct) { - return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetFsUpdate - * } - */ - public static void resetFsUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RfFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RfFreqT.java deleted file mode 100644 index c1360d6c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RfFreqT.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; - -/** - * {@snippet lang=c : - * struct { - * double rfHz; - * unsigned char syncUpdate; - * } - * } - */ -public class sdrplay_api_RfFreqT { - - sdrplay_api_RfFreqT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_DOUBLE.withName("rfHz"), - sdrplay_api_h.C_CHAR.withName("syncUpdate"), - MemoryLayout.paddingLayout(7) - ).withName("$anon$69:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz")); - - /** - * Layout for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final OfDouble rfHz$layout() { - return rfHz$LAYOUT; - } - - private static final long rfHz$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static final long rfHz$offset() { - return rfHz$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static double rfHz(MemorySegment struct) { - return struct.get(rfHz$LAYOUT, rfHz$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * double rfHz - * } - */ - public static void rfHz(MemorySegment struct, double fieldValue) { - struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue); - } - - private static final OfByte syncUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("syncUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final OfByte syncUpdate$layout() { - return syncUpdate$LAYOUT; - } - - private static final long syncUpdate$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static final long syncUpdate$offset() { - return syncUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static byte syncUpdate(MemorySegment struct) { - return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char syncUpdate - * } - */ - public static void syncUpdate(MemorySegment struct, byte fieldValue) { - struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aParamsT.java deleted file mode 100644 index bde37539..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aParamsT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aParamsT { - - sdrplay_api_Rsp1aParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable") - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aTunerParamsT.java deleted file mode 100644 index c91bdb1f..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aTunerParamsT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * } - * } - */ -public class sdrplay_api_Rsp1aTunerParamsT { - - sdrplay_api_Rsp1aTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable") - ).withName("$anon$17:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2ParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2ParamsT.java deleted file mode 100644 index 7c383a28..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2ParamsT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char extRefOutputEn; - * } - * } - */ -public class sdrplay_api_Rsp2ParamsT { - - sdrplay_api_Rsp2ParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("extRefOutputEn") - ).withName("$anon$22:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final OfByte extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static byte extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, byte fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2TunerParamsT.java deleted file mode 100644 index e98d5128..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2TunerParamsT.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * } - * } - */ -public class sdrplay_api_Rsp2TunerParamsT { - - sdrplay_api_Rsp2TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("amPortSel"), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(3) - ).withName("$anon$27:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt amPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("amPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final OfInt amPortSel$layout() { - return amPortSel$LAYOUT; - } - - private static final long amPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static final long amPortSel$offset() { - return amPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static int amPortSel(MemorySegment struct) { - return struct.get(amPortSel$LAYOUT, amPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel - * } - */ - public static void amPortSel(MemorySegment struct, int fieldValue) { - struct.set(amPortSel$LAYOUT, amPortSel$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoModeCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoModeCbParamT.java deleted file mode 100644 index 9179fae5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoModeCbParamT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * } - * } - */ -public class sdrplay_api_RspDuoModeCbParamT { - - sdrplay_api_RspDuoModeCbParamT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("modeChangeType") - ).withName("$anon$44:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt modeChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("modeChangeType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final OfInt modeChangeType$layout() { - return modeChangeType$LAYOUT; - } - - private static final long modeChangeType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static final long modeChangeType$offset() { - return modeChangeType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static int modeChangeType(MemorySegment struct) { - return struct.get(modeChangeType$LAYOUT, modeChangeType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType - * } - */ - public static void modeChangeType(MemorySegment struct, int fieldValue) { - struct.set(modeChangeType$LAYOUT, modeChangeType$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoParamsT.java deleted file mode 100644 index b8a87b98..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoParamsT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * int extRefOutputEn; - * } - * } - */ -public class sdrplay_api_RspDuoParamsT { - - sdrplay_api_RspDuoParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("extRefOutputEn") - ).withName("$anon$26:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt extRefOutputEn$LAYOUT = (OfInt)$LAYOUT.select(groupElement("extRefOutputEn")); - - /** - * Layout for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final OfInt extRefOutputEn$layout() { - return extRefOutputEn$LAYOUT; - } - - private static final long extRefOutputEn$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static final long extRefOutputEn$offset() { - return extRefOutputEn$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static int extRefOutputEn(MemorySegment struct) { - return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int extRefOutputEn - * } - */ - public static void extRefOutputEn(MemorySegment struct, int fieldValue) { - struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoTunerParamsT.java deleted file mode 100644 index 3163acb9..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoTunerParamsT.java +++ /dev/null @@ -1,379 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; - * unsigned char tuner1AmNotchEnable; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * sdrplay_api_RspDuo_ResetSlaveFlagsT resetSlaveFlags; - * } - * } - */ -public class sdrplay_api_RspDuoTunerParamsT { - - sdrplay_api_RspDuoTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(3), - sdrplay_api_h.C_INT.withName("tuner1AmPortSel"), - sdrplay_api_h.C_CHAR.withName("tuner1AmNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - sdrplay_api_RspDuo_ResetSlaveFlagsT.layout().withName("resetSlaveFlags"), - MemoryLayout.paddingLayout(3) - ).withName("$anon$37:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt tuner1AmPortSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("tuner1AmPortSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final OfInt tuner1AmPortSel$layout() { - return tuner1AmPortSel$LAYOUT; - } - - private static final long tuner1AmPortSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static final long tuner1AmPortSel$offset() { - return tuner1AmPortSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static int tuner1AmPortSel(MemorySegment struct) { - return struct.get(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel - * } - */ - public static void tuner1AmPortSel(MemorySegment struct, int fieldValue) { - struct.set(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET, fieldValue); - } - - private static final OfByte tuner1AmNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("tuner1AmNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final OfByte tuner1AmNotchEnable$layout() { - return tuner1AmNotchEnable$LAYOUT; - } - - private static final long tuner1AmNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static final long tuner1AmNotchEnable$offset() { - return tuner1AmNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static byte tuner1AmNotchEnable(MemorySegment struct) { - return struct.get(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char tuner1AmNotchEnable - * } - */ - public static void tuner1AmNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 10; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - private static final GroupLayout resetSlaveFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetSlaveFlags")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_ResetSlaveFlagsT resetSlaveFlags - * } - */ - public static final GroupLayout resetSlaveFlags$layout() { - return resetSlaveFlags$LAYOUT; - } - - private static final long resetSlaveFlags$OFFSET = 11; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_ResetSlaveFlagsT resetSlaveFlags - * } - */ - public static final long resetSlaveFlags$offset() { - return resetSlaveFlags$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_ResetSlaveFlagsT resetSlaveFlags - * } - */ - public static MemorySegment resetSlaveFlags(MemorySegment struct) { - return struct.asSlice(resetSlaveFlags$OFFSET, resetSlaveFlags$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuo_ResetSlaveFlagsT resetSlaveFlags - * } - */ - public static void resetSlaveFlags(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, resetSlaveFlags$OFFSET, resetSlaveFlags$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuo_ResetSlaveFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuo_ResetSlaveFlagsT.java deleted file mode 100644 index 7268ba6e..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuo_ResetSlaveFlagsT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; - -/** - * {@snippet lang=c : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * } - * } - */ -public class sdrplay_api_RspDuo_ResetSlaveFlagsT { - - sdrplay_api_RspDuo_ResetSlaveFlagsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), - sdrplay_api_h.C_CHAR.withName("resetRfUpdate") - ).withName("$anon$31:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final OfByte resetGainUpdate$layout() { - return resetGainUpdate$LAYOUT; - } - - private static final long resetGainUpdate$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static final long resetGainUpdate$offset() { - return resetGainUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static byte resetGainUpdate(MemorySegment struct) { - return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetGainUpdate - * } - */ - public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); - } - - private static final OfByte resetRfUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetRfUpdate")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final OfByte resetRfUpdate$layout() { - return resetRfUpdate$LAYOUT; - } - - private static final long resetRfUpdate$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static final long resetRfUpdate$offset() { - return resetRfUpdate$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static byte resetRfUpdate(MemorySegment struct) { - return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char resetRfUpdate - * } - */ - public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { - struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxParamsT.java deleted file mode 100644 index 36d2e645..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxParamsT.java +++ /dev/null @@ -1,333 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned char hdrEnable; - * unsigned char biasTEnable; - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * } - * } - */ -public class sdrplay_api_RspDxParamsT { - - sdrplay_api_RspDxParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_CHAR.withName("hdrEnable"), - sdrplay_api_h.C_CHAR.withName("biasTEnable"), - MemoryLayout.paddingLayout(2), - sdrplay_api_h.C_INT.withName("antennaSel"), - sdrplay_api_h.C_CHAR.withName("rfNotchEnable"), - sdrplay_api_h.C_CHAR.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(2) - ).withName("$anon$32:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfByte hdrEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hdrEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final OfByte hdrEnable$layout() { - return hdrEnable$LAYOUT; - } - - private static final long hdrEnable$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static final long hdrEnable$offset() { - return hdrEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static byte hdrEnable(MemorySegment struct) { - return struct.get(hdrEnable$LAYOUT, hdrEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char hdrEnable - * } - */ - public static void hdrEnable(MemorySegment struct, byte fieldValue) { - struct.set(hdrEnable$LAYOUT, hdrEnable$OFFSET, fieldValue); - } - - private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final OfByte biasTEnable$layout() { - return biasTEnable$LAYOUT; - } - - private static final long biasTEnable$OFFSET = 1; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static final long biasTEnable$offset() { - return biasTEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static byte biasTEnable(MemorySegment struct) { - return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char biasTEnable - * } - */ - public static void biasTEnable(MemorySegment struct, byte fieldValue) { - struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); - } - - private static final OfInt antennaSel$LAYOUT = (OfInt)$LAYOUT.select(groupElement("antennaSel")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final OfInt antennaSel$layout() { - return antennaSel$LAYOUT; - } - - private static final long antennaSel$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static final long antennaSel$offset() { - return antennaSel$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static int antennaSel(MemorySegment struct) { - return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_AntennaSelectT antennaSel - * } - */ - public static void antennaSel(MemorySegment struct, int fieldValue) { - struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); - } - - private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final OfByte rfNotchEnable$layout() { - return rfNotchEnable$LAYOUT; - } - - private static final long rfNotchEnable$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static final long rfNotchEnable$offset() { - return rfNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static byte rfNotchEnable(MemorySegment struct) { - return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfNotchEnable - * } - */ - public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); - } - - private static final OfByte rfDabNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfDabNotchEnable")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final OfByte rfDabNotchEnable$layout() { - return rfDabNotchEnable$LAYOUT; - } - - private static final long rfDabNotchEnable$OFFSET = 9; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static final long rfDabNotchEnable$offset() { - return rfDabNotchEnable$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static byte rfDabNotchEnable(MemorySegment struct) { - return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned char rfDabNotchEnable - * } - */ - public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { - struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxTunerParamsT.java deleted file mode 100644 index e8768d52..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxTunerParamsT.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * } - * } - */ -public class sdrplay_api_RspDxTunerParamsT { - - sdrplay_api_RspDxTunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("hdrBw") - ).withName("$anon$41:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt hdrBw$LAYOUT = (OfInt)$LAYOUT.select(groupElement("hdrBw")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final OfInt hdrBw$layout() { - return hdrBw$LAYOUT; - } - - private static final long hdrBw$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static final long hdrBw$offset() { - return hdrBw$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static int hdrBw(MemorySegment struct) { - return struct.get(hdrBw$LAYOUT, hdrBw$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDx_HdrModeBwT hdrBw - * } - */ - public static void hdrBw(MemorySegment struct, int fieldValue) { - struct.set(hdrBw$LAYOUT, hdrBw$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RxChannelParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RxChannelParamsT.java deleted file mode 100644 index 8bd2fc27..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RxChannelParamsT.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; - -/** - * {@snippet lang=c : - * 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; - * } - * } - */ -public class sdrplay_api_RxChannelParamsT { - - sdrplay_api_RxChannelParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_TunerParamsT.layout().withName("tunerParams"), - sdrplay_api_ControlParamsT.layout().withName("ctrlParams"), - sdrplay_api_Rsp1aTunerParamsT.layout().withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(3), - sdrplay_api_Rsp2TunerParamsT.layout().withName("rsp2TunerParams"), - sdrplay_api_RspDuoTunerParamsT.layout().withName("rspDuoTunerParams"), - sdrplay_api_RspDxTunerParamsT.layout().withName("rspDxTunerParams") - ).withName("$anon$11:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final GroupLayout tunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("tunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final GroupLayout tunerParams$layout() { - return tunerParams$LAYOUT; - } - - private static final long tunerParams$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static final long tunerParams$offset() { - return tunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static MemorySegment tunerParams(MemorySegment struct) { - return struct.asSlice(tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_TunerParamsT tunerParams - * } - */ - public static void tunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, tunerParams$OFFSET, tunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout ctrlParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("ctrlParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final GroupLayout ctrlParams$layout() { - return ctrlParams$LAYOUT; - } - - private static final long ctrlParams$OFFSET = 72; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static final long ctrlParams$offset() { - return ctrlParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static MemorySegment ctrlParams(MemorySegment struct) { - return struct.asSlice(ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_ControlParamsT ctrlParams - * } - */ - public static void ctrlParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, ctrlParams$OFFSET, ctrlParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp1aTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp1aTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final GroupLayout rsp1aTunerParams$layout() { - return rsp1aTunerParams$LAYOUT; - } - - private static final long rsp1aTunerParams$OFFSET = 104; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static final long rsp1aTunerParams$offset() { - return rsp1aTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static MemorySegment rsp1aTunerParams(MemorySegment struct) { - return struct.asSlice(rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp1aTunerParamsT rsp1aTunerParams - * } - */ - public static void rsp1aTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp1aTunerParams$OFFSET, rsp1aTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rsp2TunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rsp2TunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final GroupLayout rsp2TunerParams$layout() { - return rsp2TunerParams$LAYOUT; - } - - private static final long rsp2TunerParams$OFFSET = 108; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static final long rsp2TunerParams$offset() { - return rsp2TunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static MemorySegment rsp2TunerParams(MemorySegment struct) { - return struct.asSlice(rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams - * } - */ - public static void rsp2TunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rsp2TunerParams$OFFSET, rsp2TunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDuoTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDuoTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final GroupLayout rspDuoTunerParams$layout() { - return rspDuoTunerParams$LAYOUT; - } - - private static final long rspDuoTunerParams$OFFSET = 124; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static final long rspDuoTunerParams$offset() { - return rspDuoTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static MemorySegment rspDuoTunerParams(MemorySegment struct) { - return struct.asSlice(rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams - * } - */ - public static void rspDuoTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDuoTunerParams$OFFSET, rspDuoTunerParams$LAYOUT.byteSize()); - } - - private static final GroupLayout rspDxTunerParams$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rspDxTunerParams")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final GroupLayout rspDxTunerParams$layout() { - return rspDxTunerParams$LAYOUT; - } - - private static final long rspDxTunerParams$OFFSET = 140; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static final long rspDxTunerParams$offset() { - return rspDxTunerParams$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static MemorySegment rspDxTunerParams(MemorySegment struct) { - return struct.asSlice(rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RspDxTunerParamsT rspDxTunerParams - * } - */ - public static void rspDxTunerParams(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rspDxTunerParams$OFFSET, rspDxTunerParams$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SelectDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SelectDevice_t.java deleted file mode 100644 index 921861ca..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SelectDevice_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *) - * } - */ -public class sdrplay_api_SelectDevice_t { - - sdrplay_api_SelectDevice_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment device); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SelectDevice_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_SelectDevice_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment device) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCallback_t.java deleted file mode 100644 index fde0210a..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCallback_t.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef void (*sdrplay_api_StreamCallback_t)(short *, short *, sdrplay_api_StreamCbParamsT *, unsigned int, unsigned int, void *) - * } - */ -public class sdrplay_api_StreamCallback_t { - - sdrplay_api_StreamCallback_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - void apply(MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - 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_StreamCallback_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_StreamCallback_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static void invoke(MemorySegment funcPtr,MemorySegment xi, MemorySegment xq, MemorySegment params, int numSamples, int reset, MemorySegment cbContext) { - try { - DOWN$MH.invokeExact(funcPtr, xi, xq, params, numSamples, reset, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCbParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCbParamsT.java deleted file mode 100644 index 13bfeae2..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCbParamsT.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned int firstSampleNum; - * int grChanged; - * int rfChanged; - * int fsChanged; - * unsigned int numSamples; - * } - * } - */ -public class sdrplay_api_StreamCbParamsT { - - sdrplay_api_StreamCbParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("firstSampleNum"), - sdrplay_api_h.C_INT.withName("grChanged"), - sdrplay_api_h.C_INT.withName("rfChanged"), - sdrplay_api_h.C_INT.withName("fsChanged"), - sdrplay_api_h.C_INT.withName("numSamples") - ).withName("$anon$58:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt firstSampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("firstSampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final OfInt firstSampleNum$layout() { - return firstSampleNum$LAYOUT; - } - - private static final long firstSampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static final long firstSampleNum$offset() { - return firstSampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static int firstSampleNum(MemorySegment struct) { - return struct.get(firstSampleNum$LAYOUT, firstSampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int firstSampleNum - * } - */ - public static void firstSampleNum(MemorySegment struct, int fieldValue) { - struct.set(firstSampleNum$LAYOUT, firstSampleNum$OFFSET, fieldValue); - } - - private static final OfInt grChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("grChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final OfInt grChanged$layout() { - return grChanged$LAYOUT; - } - - private static final long grChanged$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static final long grChanged$offset() { - return grChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static int grChanged(MemorySegment struct) { - return struct.get(grChanged$LAYOUT, grChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int grChanged - * } - */ - public static void grChanged(MemorySegment struct, int fieldValue) { - struct.set(grChanged$LAYOUT, grChanged$OFFSET, fieldValue); - } - - private static final OfInt rfChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("rfChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final OfInt rfChanged$layout() { - return rfChanged$LAYOUT; - } - - private static final long rfChanged$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static final long rfChanged$offset() { - return rfChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static int rfChanged(MemorySegment struct) { - return struct.get(rfChanged$LAYOUT, rfChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int rfChanged - * } - */ - public static void rfChanged(MemorySegment struct, int fieldValue) { - struct.set(rfChanged$LAYOUT, rfChanged$OFFSET, fieldValue); - } - - private static final OfInt fsChanged$LAYOUT = (OfInt)$LAYOUT.select(groupElement("fsChanged")); - - /** - * Layout for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final OfInt fsChanged$layout() { - return fsChanged$LAYOUT; - } - - private static final long fsChanged$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static final long fsChanged$offset() { - return fsChanged$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static int fsChanged(MemorySegment struct) { - return struct.get(fsChanged$LAYOUT, fsChanged$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * int fsChanged - * } - */ - public static void fsChanged(MemorySegment struct, int fieldValue) { - struct.set(fsChanged$LAYOUT, fsChanged$OFFSET, fieldValue); - } - - private static final OfInt numSamples$LAYOUT = (OfInt)$LAYOUT.select(groupElement("numSamples")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final OfInt numSamples$layout() { - return numSamples$LAYOUT; - } - - private static final long numSamples$OFFSET = 16; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static final long numSamples$offset() { - return numSamples$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static int numSamples(MemorySegment struct) { - return struct.get(numSamples$LAYOUT, numSamples$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int numSamples - * } - */ - public static void numSamples(MemorySegment struct, int fieldValue) { - struct.set(numSamples$LAYOUT, numSamples$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoActiveTuner_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoActiveTuner_t.java deleted file mode 100644 index 97a007f5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoActiveTuner_t.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE, sdrplay_api_TunerSelectT *, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoActiveTuner_t { - - sdrplay_api_SwapRspDuoActiveTuner_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_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_SwapRspDuoActiveTuner_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment tuner, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java deleted file mode 100644 index 112792d3..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *, double) - * } - */ -public class sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - - sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currentSampleRate, double newSampleRate); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_DOUBLE - ); - - /** - * The descriptor of this function pointer - */ - public static FunctionDescriptor descriptor() { - return $DESC; - } - - private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_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_SwapRspDuoDualTunerModeSampleRate_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 currentSampleRate, double newSampleRate) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currentSampleRate, newSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoMode_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoMode_t.java deleted file mode 100644 index dae1df1c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoMode_t.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *, sdrplay_api_DeviceParamsT **, sdrplay_api_RspDuoModeT, double, sdrplay_api_TunerSelectT, sdrplay_api_Bw_MHzT, sdrplay_api_If_kHzT, sdrplay_api_RspDuo_AmPortSelectT) - * } - */ -public class sdrplay_api_SwapRspDuoMode_t { - - sdrplay_api_SwapRspDuoMode_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_DOUBLE, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_SwapRspDuoMode_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_SwapRspDuoMode_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 currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SyncUpdateT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SyncUpdateT.java deleted file mode 100644 index 731f3e7d..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SyncUpdateT.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * unsigned int sampleNum; - * unsigned int period; - * } - * } - */ -public class sdrplay_api_SyncUpdateT { - - sdrplay_api_SyncUpdateT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("sampleNum"), - sdrplay_api_h.C_INT.withName("period") - ).withName("$anon$24:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt sampleNum$LAYOUT = (OfInt)$LAYOUT.select(groupElement("sampleNum")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final OfInt sampleNum$layout() { - return sampleNum$LAYOUT; - } - - private static final long sampleNum$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static final long sampleNum$offset() { - return sampleNum$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static int sampleNum(MemorySegment struct) { - return struct.get(sampleNum$LAYOUT, sampleNum$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int sampleNum - * } - */ - public static void sampleNum(MemorySegment struct, int fieldValue) { - struct.set(sampleNum$LAYOUT, sampleNum$OFFSET, fieldValue); - } - - private static final OfInt period$LAYOUT = (OfInt)$LAYOUT.select(groupElement("period")); - - /** - * Layout for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final OfInt period$layout() { - return period$LAYOUT; - } - - private static final long period$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static final long period$offset() { - return period$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static int period(MemorySegment struct) { - return struct.get(period$LAYOUT, period$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * unsigned int period - * } - */ - public static void period(MemorySegment struct, int fieldValue) { - struct.set(period$LAYOUT, period$OFFSET, fieldValue); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_TunerParamsT.java deleted file mode 100644 index b8a79e00..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_TunerParamsT.java +++ /dev/null @@ -1,378 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -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.util.function.Consumer; - -import static java.lang.foreign.MemoryLayout.PathElement.groupElement; -import static java.lang.foreign.ValueLayout.OfInt; - -/** - * {@snippet lang=c : - * struct { - * sdrplay_api_Bw_MHzT bwType; - * sdrplay_api_If_kHzT ifType; - * sdrplay_api_LoModeT loMode; - * sdrplay_api_GainT gain; - * sdrplay_api_RfFreqT rfFreq; - * sdrplay_api_DcOffsetTunerT dcOffsetTuner; - * } - * } - */ -public class sdrplay_api_TunerParamsT { - - sdrplay_api_TunerParamsT() { - // Should not be called directly - } - - private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( - sdrplay_api_h.C_INT.withName("bwType"), - sdrplay_api_h.C_INT.withName("ifType"), - sdrplay_api_h.C_INT.withName("loMode"), - sdrplay_api_GainT.layout().withName("gain"), - MemoryLayout.paddingLayout(4), - sdrplay_api_RfFreqT.layout().withName("rfFreq"), - sdrplay_api_DcOffsetTunerT.layout().withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(4) - ).withName("$anon$83:9"); - - /** - * The layout of this struct - */ - public static final GroupLayout layout() { - return $LAYOUT; - } - - private static final OfInt bwType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("bwType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final OfInt bwType$layout() { - return bwType$LAYOUT; - } - - private static final long bwType$OFFSET = 0; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static final long bwType$offset() { - return bwType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static int bwType(MemorySegment struct) { - return struct.get(bwType$LAYOUT, bwType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_Bw_MHzT bwType - * } - */ - public static void bwType(MemorySegment struct, int fieldValue) { - struct.set(bwType$LAYOUT, bwType$OFFSET, fieldValue); - } - - private static final OfInt ifType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("ifType")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final OfInt ifType$layout() { - return ifType$LAYOUT; - } - - private static final long ifType$OFFSET = 4; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static final long ifType$offset() { - return ifType$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static int ifType(MemorySegment struct) { - return struct.get(ifType$LAYOUT, ifType$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_If_kHzT ifType - * } - */ - public static void ifType(MemorySegment struct, int fieldValue) { - struct.set(ifType$LAYOUT, ifType$OFFSET, fieldValue); - } - - private static final OfInt loMode$LAYOUT = (OfInt)$LAYOUT.select(groupElement("loMode")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final OfInt loMode$layout() { - return loMode$LAYOUT; - } - - private static final long loMode$OFFSET = 8; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static final long loMode$offset() { - return loMode$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static int loMode(MemorySegment struct) { - return struct.get(loMode$LAYOUT, loMode$OFFSET); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_LoModeT loMode - * } - */ - public static void loMode(MemorySegment struct, int fieldValue) { - struct.set(loMode$LAYOUT, loMode$OFFSET, fieldValue); - } - - private static final GroupLayout gain$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("gain")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final GroupLayout gain$layout() { - return gain$LAYOUT; - } - - private static final long gain$OFFSET = 12; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static final long gain$offset() { - return gain$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static MemorySegment gain(MemorySegment struct) { - return struct.asSlice(gain$OFFSET, gain$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_GainT gain - * } - */ - public static void gain(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, gain$OFFSET, gain$LAYOUT.byteSize()); - } - - private static final GroupLayout rfFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("rfFreq")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final GroupLayout rfFreq$layout() { - return rfFreq$LAYOUT; - } - - private static final long rfFreq$OFFSET = 40; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static final long rfFreq$offset() { - return rfFreq$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static MemorySegment rfFreq(MemorySegment struct) { - return struct.asSlice(rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_RfFreqT rfFreq - * } - */ - public static void rfFreq(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); - } - - private static final GroupLayout dcOffsetTuner$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("dcOffsetTuner")); - - /** - * Layout for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final GroupLayout dcOffsetTuner$layout() { - return dcOffsetTuner$LAYOUT; - } - - private static final long dcOffsetTuner$OFFSET = 56; - - /** - * Offset for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static final long dcOffsetTuner$offset() { - return dcOffsetTuner$OFFSET; - } - - /** - * Getter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static MemorySegment dcOffsetTuner(MemorySegment struct) { - return struct.asSlice(dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Setter for field: - * {@snippet lang=c : - * sdrplay_api_DcOffsetTunerT dcOffsetTuner - * } - */ - public static void dcOffsetTuner(MemorySegment struct, MemorySegment fieldValue) { - MemorySegment.copy(fieldValue, 0L, struct, dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); - } - - /** - * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. - * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} - */ - public static MemorySegment asSlice(MemorySegment array, long index) { - return array.asSlice(layout().byteSize() * index); - } - - /** - * The size (in bytes) of this struct - */ - public static long sizeof() { return layout().byteSize(); } - - /** - * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} - */ - public static MemorySegment allocate(SegmentAllocator allocator) { - return allocator.allocate(layout()); - } - - /** - * Allocate an array of size {@code elementCount} using {@code allocator}. - * The returned segment has size {@code elementCount * layout().byteSize()}. - */ - public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); - } - - /** - * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). - * The returned segment has size {@code layout().byteSize()} - */ - public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer 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 cleanup) { - return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Uninit_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Uninit_t.java deleted file mode 100644 index f2660e92..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Uninit_t.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE) - * } - */ -public class sdrplay_api_Uninit_t { - - sdrplay_api_Uninit_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev); - } - - 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_Uninit_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_Uninit_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_UnlockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_UnlockDeviceApi_t.java deleted file mode 100644 index be033ec5..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_UnlockDeviceApi_t.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void) - * } - */ -public class sdrplay_api_UnlockDeviceApi_t { - - sdrplay_api_UnlockDeviceApi_t() { - // Should not be called directly - } - - /** - * 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_UnlockDeviceApi_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_UnlockDeviceApi_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$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Update_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Update_t.java deleted file mode 100644 index 5d302b1c..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Update_t.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import java.lang.foreign.Arena; -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.Linker; -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -/** - * {@snippet lang=c : - * typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE, sdrplay_api_TunerSelectT, sdrplay_api_ReasonForUpdateT, sdrplay_api_ReasonForUpdateExtension1T) - * } - */ -public class sdrplay_api_Update_t { - - sdrplay_api_Update_t() { - // Should not be called directly - } - - /** - * The function pointer signature, expressed as a functional interface - */ - public interface Function { - int apply(MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - } - - private static final FunctionDescriptor $DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - 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_Update_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_Update_t.Function fi, Arena arena) { - return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); - } - - private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); - - /** - * Invoke the upcall stub {@code funcPtr}, with given parameters - */ - public static int invoke(MemorySegment funcPtr,MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1) { - try { - return (int) DOWN$MH.invokeExact(funcPtr, dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_h.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_h.java deleted file mode 100644 index 2710b486..00000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_h.java +++ /dev/null @@ -1,2842 +0,0 @@ -/* - * ***************************************************************************** - * 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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_15; - -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayLibraryHelper; -import java.lang.foreign.AddressLayout; -import java.lang.foreign.Arena; -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.PaddingLayout; -import java.lang.foreign.SequenceLayout; -import java.lang.foreign.StructLayout; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.util.Arrays; -import java.util.stream.Collectors; - -import static java.lang.foreign.ValueLayout.JAVA_BYTE; - -public class sdrplay_api_h { - - sdrplay_api_h() { - // Should not be called directly - } - - static final Arena LIBRARY_ARENA = Arena.ofAuto(); - static final boolean TRACE_DOWNCALLS = Boolean.getBoolean("jextract.trace.downcalls"); - - static void traceDowncall(String name, Object... args) { - String traceArgs = Arrays.stream(args) - .map(Object::toString) - .collect(Collectors.joining(", ")); - System.out.printf("%s(%s)\n", name, traceArgs); - } - - static MemorySegment findOrThrow(String symbol) { - if(SYMBOL_LOOKUP == null) - { - throw new UnsatisfiedLinkError("unresolved symbol:" + symbol); - } - return SYMBOL_LOOKUP.find(symbol) - .orElseThrow(() -> new UnsatisfiedLinkError("unresolved symbol: " + symbol)); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MethodHandles.lookup().findVirtual(fi, name, fdesc.toMethodType()); - } catch (ReflectiveOperationException ex) { - throw new AssertionError(ex); - } - } - - static MemoryLayout align(MemoryLayout layout, long align) { - return switch (layout) { - case PaddingLayout p -> p; - case ValueLayout v -> v.withByteAlignment(align); - case GroupLayout g -> { - MemoryLayout[] alignedMembers = g.memberLayouts().stream() - .map(m -> align(m, align)).toArray(MemoryLayout[]::new); - yield g instanceof StructLayout ? - MemoryLayout.structLayout(alignedMembers) : MemoryLayout.unionLayout(alignedMembers); - } - case SequenceLayout s -> MemoryLayout.sequenceLayout(s.elementCount(), align(s.elementLayout(), align)); - }; - } - - //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library - static SymbolLookup SYMBOL_LOOKUP; - static - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e) - { - if(SDRPlayLibraryHelper.LOADED_FROM_PATH) - { - try - { - SYMBOL_LOOKUP = SymbolLookup.libraryLookup(SDRPlayLibraryHelper.LIBRARY_PATH, LIBRARY_ARENA) - .or(SymbolLookup.loaderLookup()) - .or(Linker.nativeLinker().defaultLookup()); - } - catch(Exception e2) - { - SYMBOL_LOOKUP = null; - } - } - else - { - SYMBOL_LOOKUP = null; - } - } - } - - public static final ValueLayout.OfBoolean C_BOOL = ValueLayout.JAVA_BOOLEAN; - public static final ValueLayout.OfByte C_CHAR = ValueLayout.JAVA_BYTE; - public static final ValueLayout.OfShort C_SHORT = ValueLayout.JAVA_SHORT; - public static final ValueLayout.OfInt C_INT = ValueLayout.JAVA_INT; - public static final ValueLayout.OfLong C_LONG_LONG = ValueLayout.JAVA_LONG; - public static final ValueLayout.OfFloat C_FLOAT = ValueLayout.JAVA_FLOAT; - public static final ValueLayout.OfDouble C_DOUBLE = ValueLayout.JAVA_DOUBLE; - public static final AddressLayout C_POINTER = ValueLayout.ADDRESS - .withTargetLayout(MemoryLayout.sequenceLayout(java.lang.Long.MAX_VALUE, JAVA_BYTE)); - public static final ValueLayout.OfLong C_LONG = ValueLayout.JAVA_LONG; - private static final int RSPIA_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES 10 - * } - */ - public static int RSPIA_NUM_LNA_STATES() { - return RSPIA_NUM_LNA_STATES; - } - private static final int RSPIA_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPIA_NUM_LNA_STATES_AM() { - return RSPIA_NUM_LNA_STATES_AM; - } - private static final int RSPIA_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPIA_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPIA_NUM_LNA_STATES_LBAND() { - return RSPIA_NUM_LNA_STATES_LBAND; - } - private static final int RSPII_NUM_LNA_STATES = (int)9L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES 9 - * } - */ - public static int RSPII_NUM_LNA_STATES() { - return RSPII_NUM_LNA_STATES; - } - private static final int RSPII_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPII_NUM_LNA_STATES_AMPORT() { - return RSPII_NUM_LNA_STATES_AMPORT; - } - private static final int RSPII_NUM_LNA_STATES_420MHZ = (int)6L; - /** - * {@snippet lang=c : - * #define RSPII_NUM_LNA_STATES_420MHZ 6 - * } - */ - public static int RSPII_NUM_LNA_STATES_420MHZ() { - return RSPII_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDUO_NUM_LNA_STATES = (int)10L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES 10 - * } - */ - public static int RSPDUO_NUM_LNA_STATES() { - return RSPDUO_NUM_LNA_STATES; - } - private static final int RSPDUO_NUM_LNA_STATES_AMPORT = (int)5L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return RSPDUO_NUM_LNA_STATES_AMPORT; - } - private static final int RSPDUO_NUM_LNA_STATES_AM = (int)7L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AM() { - return RSPDUO_NUM_LNA_STATES_AM; - } - private static final int RSPDUO_NUM_LNA_STATES_LBAND = (int)9L; - /** - * {@snippet lang=c : - * #define RSPDUO_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return RSPDUO_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES = (int)28L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES 28 - * } - */ - public static int RSPDX_NUM_LNA_STATES() { - return RSPDX_NUM_LNA_STATES; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_0_12 = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return RSPDX_NUM_LNA_STATES_AMPORT2_0_12; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_12_50 = (int)20L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_50 20 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_50() { - return RSPDX_NUM_LNA_STATES_AMPORT2_12_50; - } - private static final int RSPDX_NUM_LNA_STATES_AMPORT2_50_60 = (int)25L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_50_60 25 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_50_60() { - return RSPDX_NUM_LNA_STATES_AMPORT2_50_60; - } - private static final int RSPDX_NUM_LNA_STATES_VHF_BAND3 = (int)27L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 - * } - */ - public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return RSPDX_NUM_LNA_STATES_VHF_BAND3; - } - private static final int RSPDX_NUM_LNA_STATES_420MHZ = (int)21L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_420MHZ 21 - * } - */ - public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return RSPDX_NUM_LNA_STATES_420MHZ; - } - private static final int RSPDX_NUM_LNA_STATES_LBAND = (int)19L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_LBAND 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_LBAND() { - return RSPDX_NUM_LNA_STATES_LBAND; - } - private static final int RSPDX_NUM_LNA_STATES_DX = (int)22L; - /** - * {@snippet lang=c : - * #define RSPDX_NUM_LNA_STATES_DX 22 - * } - */ - public static int RSPDX_NUM_LNA_STATES_DX() { - return RSPDX_NUM_LNA_STATES_DX; - } - private static final int sdrplay_api_Rsp2_ANTENNA_A = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_A() { - return sdrplay_api_Rsp2_ANTENNA_A; - } - private static final int sdrplay_api_Rsp2_ANTENNA_B = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6 - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_B() { - return sdrplay_api_Rsp2_ANTENNA_B; - } - private static final int sdrplay_api_Rsp2_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_1() { - return sdrplay_api_Rsp2_AMPORT_1; - } - private static final int sdrplay_api_Rsp2_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_2() { - return sdrplay_api_Rsp2_AMPORT_2; - } - private static final int sdrplay_api_RspDuoMode_Unknown = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Unknown = 0 - * } - */ - public static int sdrplay_api_RspDuoMode_Unknown() { - return sdrplay_api_RspDuoMode_Unknown; - } - private static final int sdrplay_api_RspDuoMode_Single_Tuner = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1 - * } - */ - public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return sdrplay_api_RspDuoMode_Single_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Dual_Tuner = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2 - * } - */ - public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return sdrplay_api_RspDuoMode_Dual_Tuner; - } - private static final int sdrplay_api_RspDuoMode_Master = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Master = 4 - * } - */ - public static int sdrplay_api_RspDuoMode_Master() { - return sdrplay_api_RspDuoMode_Master; - } - private static final int sdrplay_api_RspDuoMode_Slave = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoMode_Slave = 8 - * } - */ - public static int sdrplay_api_RspDuoMode_Slave() { - return sdrplay_api_RspDuoMode_Slave; - } - private static final int sdrplay_api_RspDuo_AMPORT_1 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_1() { - return sdrplay_api_RspDuo_AMPORT_1; - } - private static final int sdrplay_api_RspDuo_AMPORT_2 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0 - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_2() { - return sdrplay_api_RspDuo_AMPORT_2; - } - private static final int sdrplay_api_BW_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_Undefined = 0 - * } - */ - public static int sdrplay_api_BW_Undefined() { - return sdrplay_api_BW_Undefined; - } - private static final int sdrplay_api_BW_0_200 = (int)200L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_200 = 200 - * } - */ - public static int sdrplay_api_BW_0_200() { - return sdrplay_api_BW_0_200; - } - private static final int sdrplay_api_BW_0_300 = (int)300L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_300 = 300 - * } - */ - public static int sdrplay_api_BW_0_300() { - return sdrplay_api_BW_0_300; - } - private static final int sdrplay_api_BW_0_600 = (int)600L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_0_600 = 600 - * } - */ - public static int sdrplay_api_BW_0_600() { - return sdrplay_api_BW_0_600; - } - private static final int sdrplay_api_BW_1_536 = (int)1536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_1_536 = 1536 - * } - */ - public static int sdrplay_api_BW_1_536() { - return sdrplay_api_BW_1_536; - } - private static final int sdrplay_api_BW_5_000 = (int)5000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_5_000 = 5000 - * } - */ - public static int sdrplay_api_BW_5_000() { - return sdrplay_api_BW_5_000; - } - private static final int sdrplay_api_BW_6_000 = (int)6000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_6_000 = 6000 - * } - */ - public static int sdrplay_api_BW_6_000() { - return sdrplay_api_BW_6_000; - } - private static final int sdrplay_api_BW_7_000 = (int)7000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_7_000 = 7000 - * } - */ - public static int sdrplay_api_BW_7_000() { - return sdrplay_api_BW_7_000; - } - private static final int sdrplay_api_BW_8_000 = (int)8000L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BW_8_000 = 8000 - * } - */ - public static int sdrplay_api_BW_8_000() { - return sdrplay_api_BW_8_000; - } - private static final int sdrplay_api_IF_Undefined = (int)-1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Undefined = -1 - * } - */ - public static int sdrplay_api_IF_Undefined() { - return sdrplay_api_IF_Undefined; - } - private static final int sdrplay_api_IF_Zero = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_Zero = 0 - * } - */ - public static int sdrplay_api_IF_Zero() { - return sdrplay_api_IF_Zero; - } - private static final int sdrplay_api_IF_0_450 = (int)450L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_0_450 = 450 - * } - */ - public static int sdrplay_api_IF_0_450() { - return sdrplay_api_IF_0_450; - } - private static final int sdrplay_api_IF_1_620 = (int)1620L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_1_620 = 1620 - * } - */ - public static int sdrplay_api_IF_1_620() { - return sdrplay_api_IF_1_620; - } - private static final int sdrplay_api_IF_2_048 = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_IF_2_048 = 2048 - * } - */ - public static int sdrplay_api_IF_2_048() { - return sdrplay_api_IF_2_048; - } - private static final int sdrplay_api_LO_Undefined = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Undefined = 0 - * } - */ - public static int sdrplay_api_LO_Undefined() { - return sdrplay_api_LO_Undefined; - } - private static final int sdrplay_api_LO_Auto = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_Auto = 1 - * } - */ - public static int sdrplay_api_LO_Auto() { - return sdrplay_api_LO_Auto; - } - private static final int sdrplay_api_LO_120MHz = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_120MHz = 2 - * } - */ - public static int sdrplay_api_LO_120MHz() { - return sdrplay_api_LO_120MHz; - } - private static final int sdrplay_api_LO_144MHz = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_144MHz = 3 - * } - */ - public static int sdrplay_api_LO_144MHz() { - return sdrplay_api_LO_144MHz; - } - private static final int sdrplay_api_LO_168MHz = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_LO_168MHz = 4 - * } - */ - public static int sdrplay_api_LO_168MHz() { - return sdrplay_api_LO_168MHz; - } - private static final int sdrplay_api_EXTENDED_MIN_GR = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0 - * } - */ - public static int sdrplay_api_EXTENDED_MIN_GR() { - return sdrplay_api_EXTENDED_MIN_GR; - } - private static final int sdrplay_api_NORMAL_MIN_GR = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NORMAL_MIN_GR = 20 - * } - */ - public static int sdrplay_api_NORMAL_MIN_GR() { - return sdrplay_api_NORMAL_MIN_GR; - } - private static final int sdrplay_api_Tuner_Neither = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Neither = 0 - * } - */ - public static int sdrplay_api_Tuner_Neither() { - return sdrplay_api_Tuner_Neither; - } - private static final int sdrplay_api_Tuner_A = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_A = 1 - * } - */ - public static int sdrplay_api_Tuner_A() { - return sdrplay_api_Tuner_A; - } - private static final int sdrplay_api_Tuner_B = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_B = 2 - * } - */ - public static int sdrplay_api_Tuner_B() { - return sdrplay_api_Tuner_B; - } - private static final int sdrplay_api_Tuner_Both = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Tuner_Both = 3 - * } - */ - public static int sdrplay_api_Tuner_Both() { - return sdrplay_api_Tuner_Both; - } - private static final int sdrplay_api_RspDx_ANTENNA_A = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_A() { - return sdrplay_api_RspDx_ANTENNA_A; - } - private static final int sdrplay_api_RspDx_ANTENNA_B = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_B() { - return sdrplay_api_RspDx_ANTENNA_B; - } - private static final int sdrplay_api_RspDx_ANTENNA_C = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2 - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_C() { - return sdrplay_api_RspDx_ANTENNA_C; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_200 = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return sdrplay_api_RspDx_HDRMODE_BW_0_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_0_500 = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return sdrplay_api_RspDx_HDRMODE_BW_0_500; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_200 = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return sdrplay_api_RspDx_HDRMODE_BW_1_200; - } - private static final int sdrplay_api_RspDx_HDRMODE_BW_1_700 = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3 - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return sdrplay_api_RspDx_HDRMODE_BW_1_700; - } - private static final int sdrplay_api_ISOCH = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ISOCH = 0 - * } - */ - public static int sdrplay_api_ISOCH() { - return sdrplay_api_ISOCH; - } - private static final int sdrplay_api_BULK = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_BULK = 1 - * } - */ - public static int sdrplay_api_BULK() { - return sdrplay_api_BULK; - } - private static final int sdrplay_api_AGC_DISABLE = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_DISABLE = 0 - * } - */ - public static int sdrplay_api_AGC_DISABLE() { - return sdrplay_api_AGC_DISABLE; - } - private static final int sdrplay_api_AGC_100HZ = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_100HZ = 1 - * } - */ - public static int sdrplay_api_AGC_100HZ() { - return sdrplay_api_AGC_100HZ; - } - private static final int sdrplay_api_AGC_50HZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_50HZ = 2 - * } - */ - public static int sdrplay_api_AGC_50HZ() { - return sdrplay_api_AGC_50HZ; - } - private static final int sdrplay_api_AGC_5HZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_5HZ = 3 - * } - */ - public static int sdrplay_api_AGC_5HZ() { - return sdrplay_api_AGC_5HZ; - } - private static final int sdrplay_api_AGC_CTRL_EN = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AGC_CTRL_EN = 4 - * } - */ - public static int sdrplay_api_AGC_CTRL_EN() { - return sdrplay_api_AGC_CTRL_EN; - } - private static final int sdrplay_api_ADSB_DECIMATION = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_DECIMATION = 0 - * } - */ - public static int sdrplay_api_ADSB_DECIMATION() { - return sdrplay_api_ADSB_DECIMATION; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return sdrplay_api_ADSB_NO_DECIMATION_LOWPASS; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ; - } - private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3 - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ; - } - private static final int sdrplay_api_Overload_Detected = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Detected = 0 - * } - */ - public static int sdrplay_api_Overload_Detected() { - return sdrplay_api_Overload_Detected; - } - private static final int sdrplay_api_Overload_Corrected = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Overload_Corrected = 1 - * } - */ - public static int sdrplay_api_Overload_Corrected() { - return sdrplay_api_Overload_Corrected; - } - private static final int sdrplay_api_MasterInitialised = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterInitialised = 0 - * } - */ - public static int sdrplay_api_MasterInitialised() { - return sdrplay_api_MasterInitialised; - } - private static final int sdrplay_api_SlaveAttached = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveAttached = 1 - * } - */ - public static int sdrplay_api_SlaveAttached() { - return sdrplay_api_SlaveAttached; - } - private static final int sdrplay_api_SlaveDetached = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDetached = 2 - * } - */ - public static int sdrplay_api_SlaveDetached() { - return sdrplay_api_SlaveDetached; - } - private static final int sdrplay_api_SlaveInitialised = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveInitialised = 3 - * } - */ - public static int sdrplay_api_SlaveInitialised() { - return sdrplay_api_SlaveInitialised; - } - private static final int sdrplay_api_SlaveUninitialised = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveUninitialised = 4 - * } - */ - public static int sdrplay_api_SlaveUninitialised() { - return sdrplay_api_SlaveUninitialised; - } - private static final int sdrplay_api_MasterDllDisappeared = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_MasterDllDisappeared = 5 - * } - */ - public static int sdrplay_api_MasterDllDisappeared() { - return sdrplay_api_MasterDllDisappeared; - } - private static final int sdrplay_api_SlaveDllDisappeared = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_SlaveDllDisappeared = 6 - * } - */ - public static int sdrplay_api_SlaveDllDisappeared() { - return sdrplay_api_SlaveDllDisappeared; - } - private static final int sdrplay_api_GainChange = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainChange = 0 - * } - */ - public static int sdrplay_api_GainChange() { - return sdrplay_api_GainChange; - } - private static final int sdrplay_api_PowerOverloadChange = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_PowerOverloadChange = 1 - * } - */ - public static int sdrplay_api_PowerOverloadChange() { - return sdrplay_api_PowerOverloadChange; - } - private static final int sdrplay_api_DeviceRemoved = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DeviceRemoved = 2 - * } - */ - public static int sdrplay_api_DeviceRemoved() { - return sdrplay_api_DeviceRemoved; - } - private static final int sdrplay_api_RspDuoModeChange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RspDuoModeChange = 3 - * } - */ - public static int sdrplay_api_RspDuoModeChange() { - return sdrplay_api_RspDuoModeChange; - } - private static final int sdrplay_api_DeviceFailure = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DeviceFailure = 4 - * } - */ - public static int sdrplay_api_DeviceFailure() { - return sdrplay_api_DeviceFailure; - } - /** - * {@snippet lang=c : - * typedef void *HANDLE - * } - */ - public static final AddressLayout HANDLE = sdrplay_api_h.C_POINTER; - private static final int sdrplay_api_Success = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Success = 0 - * } - */ - public static int sdrplay_api_Success() { - return sdrplay_api_Success; - } - private static final int sdrplay_api_Fail = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Fail = 1 - * } - */ - public static int sdrplay_api_Fail() { - return sdrplay_api_Fail; - } - private static final int sdrplay_api_InvalidParam = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidParam = 2 - * } - */ - public static int sdrplay_api_InvalidParam() { - return sdrplay_api_InvalidParam; - } - private static final int sdrplay_api_OutOfRange = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfRange = 3 - * } - */ - public static int sdrplay_api_OutOfRange() { - return sdrplay_api_OutOfRange; - } - private static final int sdrplay_api_GainUpdateError = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_GainUpdateError = 4 - * } - */ - public static int sdrplay_api_GainUpdateError() { - return sdrplay_api_GainUpdateError; - } - private static final int sdrplay_api_RfUpdateError = (int)5L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_RfUpdateError = 5 - * } - */ - public static int sdrplay_api_RfUpdateError() { - return sdrplay_api_RfUpdateError; - } - private static final int sdrplay_api_FsUpdateError = (int)6L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FsUpdateError = 6 - * } - */ - public static int sdrplay_api_FsUpdateError() { - return sdrplay_api_FsUpdateError; - } - private static final int sdrplay_api_HwError = (int)7L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwError = 7 - * } - */ - public static int sdrplay_api_HwError() { - return sdrplay_api_HwError; - } - private static final int sdrplay_api_AliasingError = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AliasingError = 8 - * } - */ - public static int sdrplay_api_AliasingError() { - return sdrplay_api_AliasingError; - } - private static final int sdrplay_api_AlreadyInitialised = (int)9L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_AlreadyInitialised = 9 - * } - */ - public static int sdrplay_api_AlreadyInitialised() { - return sdrplay_api_AlreadyInitialised; - } - private static final int sdrplay_api_NotInitialised = (int)10L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotInitialised = 10 - * } - */ - public static int sdrplay_api_NotInitialised() { - return sdrplay_api_NotInitialised; - } - private static final int sdrplay_api_NotEnabled = (int)11L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_NotEnabled = 11 - * } - */ - public static int sdrplay_api_NotEnabled() { - return sdrplay_api_NotEnabled; - } - private static final int sdrplay_api_HwVerError = (int)12L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_HwVerError = 12 - * } - */ - public static int sdrplay_api_HwVerError() { - return sdrplay_api_HwVerError; - } - private static final int sdrplay_api_OutOfMemError = (int)13L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_OutOfMemError = 13 - * } - */ - public static int sdrplay_api_OutOfMemError() { - return sdrplay_api_OutOfMemError; - } - private static final int sdrplay_api_ServiceNotResponding = (int)14L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_ServiceNotResponding = 14 - * } - */ - public static int sdrplay_api_ServiceNotResponding() { - return sdrplay_api_ServiceNotResponding; - } - private static final int sdrplay_api_StartPending = (int)15L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StartPending = 15 - * } - */ - public static int sdrplay_api_StartPending() { - return sdrplay_api_StartPending; - } - private static final int sdrplay_api_StopPending = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_StopPending = 16 - * } - */ - public static int sdrplay_api_StopPending() { - return sdrplay_api_StopPending; - } - private static final int sdrplay_api_InvalidMode = (int)17L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidMode = 17 - * } - */ - public static int sdrplay_api_InvalidMode() { - return sdrplay_api_InvalidMode; - } - private static final int sdrplay_api_FailedVerification1 = (int)18L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification1 = 18 - * } - */ - public static int sdrplay_api_FailedVerification1() { - return sdrplay_api_FailedVerification1; - } - private static final int sdrplay_api_FailedVerification2 = (int)19L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification2 = 19 - * } - */ - public static int sdrplay_api_FailedVerification2() { - return sdrplay_api_FailedVerification2; - } - private static final int sdrplay_api_FailedVerification3 = (int)20L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification3 = 20 - * } - */ - public static int sdrplay_api_FailedVerification3() { - return sdrplay_api_FailedVerification3; - } - private static final int sdrplay_api_FailedVerification4 = (int)21L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification4 = 21 - * } - */ - public static int sdrplay_api_FailedVerification4() { - return sdrplay_api_FailedVerification4; - } - private static final int sdrplay_api_FailedVerification5 = (int)22L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification5 = 22 - * } - */ - public static int sdrplay_api_FailedVerification5() { - return sdrplay_api_FailedVerification5; - } - private static final int sdrplay_api_FailedVerification6 = (int)23L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_FailedVerification6 = 23 - * } - */ - public static int sdrplay_api_FailedVerification6() { - return sdrplay_api_FailedVerification6; - } - private static final int sdrplay_api_InvalidServiceVersion = (int)24L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_InvalidServiceVersion = 24 - * } - */ - public static int sdrplay_api_InvalidServiceVersion() { - return sdrplay_api_InvalidServiceVersion; - } - private static final int sdrplay_api_Update_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_None = 0 - * } - */ - public static int sdrplay_api_Update_None() { - return sdrplay_api_Update_None; - } - private static final int sdrplay_api_Update_Dev_Fs = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Fs = 1 - * } - */ - public static int sdrplay_api_Update_Dev_Fs() { - return sdrplay_api_Update_Dev_Fs; - } - private static final int sdrplay_api_Update_Dev_Ppm = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_Ppm = 2 - * } - */ - public static int sdrplay_api_Update_Dev_Ppm() { - return sdrplay_api_Update_Dev_Ppm; - } - private static final int sdrplay_api_Update_Dev_SyncUpdate = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4 - * } - */ - public static int sdrplay_api_Update_Dev_SyncUpdate() { - return sdrplay_api_Update_Dev_SyncUpdate; - } - private static final int sdrplay_api_Update_Dev_ResetFlags = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8 - * } - */ - public static int sdrplay_api_Update_Dev_ResetFlags() { - return sdrplay_api_Update_Dev_ResetFlags; - } - private static final int sdrplay_api_Update_Rsp1a_BiasTControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16 - * } - */ - public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return sdrplay_api_Update_Rsp1a_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfNotchControl = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return sdrplay_api_Update_Rsp1a_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp1a_RfDabNotchControl = (int)64L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64 - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return sdrplay_api_Update_Rsp1a_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_BiasTControl = (int)128L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128 - * } - */ - public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return sdrplay_api_Update_Rsp2_BiasTControl; - } - private static final int sdrplay_api_Update_Rsp2_AmPortSelect = (int)256L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256 - * } - */ - public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return sdrplay_api_Update_Rsp2_AmPortSelect; - } - private static final int sdrplay_api_Update_Rsp2_AntennaControl = (int)512L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512 - * } - */ - public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return sdrplay_api_Update_Rsp2_AntennaControl; - } - private static final int sdrplay_api_Update_Rsp2_RfNotchControl = (int)1024L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024 - * } - */ - public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return sdrplay_api_Update_Rsp2_RfNotchControl; - } - private static final int sdrplay_api_Update_Rsp2_ExtRefControl = (int)2048L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048 - * } - */ - public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return sdrplay_api_Update_Rsp2_ExtRefControl; - } - private static final int sdrplay_api_Update_RspDuo_ExtRefControl = (int)4096L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096 - * } - */ - public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return sdrplay_api_Update_RspDuo_ExtRefControl; - } - private static final int sdrplay_api_Update_Master_Spare_1 = (int)8192L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192 - * } - */ - public static int sdrplay_api_Update_Master_Spare_1() { - return sdrplay_api_Update_Master_Spare_1; - } - private static final int sdrplay_api_Update_Master_Spare_2 = (int)16384L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384 - * } - */ - public static int sdrplay_api_Update_Master_Spare_2() { - return sdrplay_api_Update_Master_Spare_2; - } - private static final int sdrplay_api_Update_Tuner_Gr = (int)32768L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Gr = 32768 - * } - */ - public static int sdrplay_api_Update_Tuner_Gr() { - return sdrplay_api_Update_Tuner_Gr; - } - private static final int sdrplay_api_Update_Tuner_GrLimits = (int)65536L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536 - * } - */ - public static int sdrplay_api_Update_Tuner_GrLimits() { - return sdrplay_api_Update_Tuner_GrLimits; - } - private static final int sdrplay_api_Update_Tuner_Frf = (int)131072L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_Frf = 131072 - * } - */ - public static int sdrplay_api_Update_Tuner_Frf() { - return sdrplay_api_Update_Tuner_Frf; - } - private static final int sdrplay_api_Update_Tuner_BwType = (int)262144L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_BwType = 262144 - * } - */ - public static int sdrplay_api_Update_Tuner_BwType() { - return sdrplay_api_Update_Tuner_BwType; - } - private static final int sdrplay_api_Update_Tuner_IfType = (int)524288L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_IfType = 524288 - * } - */ - public static int sdrplay_api_Update_Tuner_IfType() { - return sdrplay_api_Update_Tuner_IfType; - } - private static final int sdrplay_api_Update_Tuner_DcOffset = (int)1048576L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576 - * } - */ - public static int sdrplay_api_Update_Tuner_DcOffset() { - return sdrplay_api_Update_Tuner_DcOffset; - } - private static final int sdrplay_api_Update_Tuner_LoMode = (int)2097152L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152 - * } - */ - public static int sdrplay_api_Update_Tuner_LoMode() { - return sdrplay_api_Update_Tuner_LoMode; - } - private static final int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = (int)4194304L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304 - * } - */ - public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return sdrplay_api_Update_Ctrl_DCoffsetIQimbalance; - } - private static final int sdrplay_api_Update_Ctrl_Decimation = (int)8388608L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608 - * } - */ - public static int sdrplay_api_Update_Ctrl_Decimation() { - return sdrplay_api_Update_Ctrl_Decimation; - } - private static final int sdrplay_api_Update_Ctrl_Agc = (int)16777216L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216 - * } - */ - public static int sdrplay_api_Update_Ctrl_Agc() { - return sdrplay_api_Update_Ctrl_Agc; - } - private static final int sdrplay_api_Update_Ctrl_AdsbMode = (int)33554432L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432 - * } - */ - public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return sdrplay_api_Update_Ctrl_AdsbMode; - } - private static final int sdrplay_api_Update_Ctrl_OverloadMsgAck = (int)67108864L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864 - * } - */ - public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return sdrplay_api_Update_Ctrl_OverloadMsgAck; - } - private static final int sdrplay_api_Update_RspDuo_BiasTControl = (int)134217728L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728 - * } - */ - public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return sdrplay_api_Update_RspDuo_BiasTControl; - } - private static final int sdrplay_api_Update_RspDuo_AmPortSelect = (int)268435456L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456 - * } - */ - public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return sdrplay_api_Update_RspDuo_AmPortSelect; - } - private static final int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = (int)536870912L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912 - * } - */ - public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return sdrplay_api_Update_RspDuo_Tuner1AmNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfNotchControl = (int)1073741824L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return sdrplay_api_Update_RspDuo_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDuo_RfDabNotchControl = (int)-2147483648L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648 - * } - */ - public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return sdrplay_api_Update_RspDuo_RfDabNotchControl; - } - private static final int sdrplay_api_Update_Ext1_None = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_Ext1_None = 0 - * } - */ - public static int sdrplay_api_Update_Ext1_None() { - return sdrplay_api_Update_Ext1_None; - } - private static final int sdrplay_api_Update_RspDx_HdrEnable = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrEnable() { - return sdrplay_api_Update_RspDx_HdrEnable; - } - private static final int sdrplay_api_Update_RspDx_BiasTControl = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2 - * } - */ - public static int sdrplay_api_Update_RspDx_BiasTControl() { - return sdrplay_api_Update_RspDx_BiasTControl; - } - private static final int sdrplay_api_Update_RspDx_AntennaControl = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4 - * } - */ - public static int sdrplay_api_Update_RspDx_AntennaControl() { - return sdrplay_api_Update_RspDx_AntennaControl; - } - private static final int sdrplay_api_Update_RspDx_RfNotchControl = (int)8L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8 - * } - */ - public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return sdrplay_api_Update_RspDx_RfNotchControl; - } - private static final int sdrplay_api_Update_RspDx_RfDabNotchControl = (int)16L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16 - * } - */ - public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return sdrplay_api_Update_RspDx_RfDabNotchControl; - } - private static final int sdrplay_api_Update_RspDx_HdrBw = (int)32L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32 - * } - */ - public static int sdrplay_api_Update_RspDx_HdrBw() { - return sdrplay_api_Update_RspDx_HdrBw; - } - private static final int sdrplay_api_Update_RspDuo_ResetSlaveFlags = (int)64L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_Update_RspDuo_ResetSlaveFlags = 64 - * } - */ - public static int sdrplay_api_Update_RspDuo_ResetSlaveFlags() { - return sdrplay_api_Update_RspDuo_ResetSlaveFlags; - } - private static final int sdrplay_api_DbgLvl_Disable = (int)0L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Disable = 0 - * } - */ - public static int sdrplay_api_DbgLvl_Disable() { - return sdrplay_api_DbgLvl_Disable; - } - private static final int sdrplay_api_DbgLvl_Verbose = (int)1L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Verbose = 1 - * } - */ - public static int sdrplay_api_DbgLvl_Verbose() { - return sdrplay_api_DbgLvl_Verbose; - } - private static final int sdrplay_api_DbgLvl_Warning = (int)2L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Warning = 2 - * } - */ - public static int sdrplay_api_DbgLvl_Warning() { - return sdrplay_api_DbgLvl_Warning; - } - private static final int sdrplay_api_DbgLvl_Error = (int)3L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Error = 3 - * } - */ - public static int sdrplay_api_DbgLvl_Error() { - return sdrplay_api_DbgLvl_Error; - } - private static final int sdrplay_api_DbgLvl_Message = (int)4L; - /** - * {@snippet lang=c : - * enum .sdrplay_api_DbgLvl_Message = 4 - * } - */ - public static int sdrplay_api_DbgLvl_Message() { - return sdrplay_api_DbgLvl_Message; - } - - private static class sdrplay_api_Open { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Open"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static FunctionDescriptor sdrplay_api_Open$descriptor() { - return sdrplay_api_Open.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static MethodHandle sdrplay_api_Open$handle() { - return sdrplay_api_Open.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static MemorySegment sdrplay_api_Open$address() { - return sdrplay_api_Open.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Open() - * } - */ - public static int sdrplay_api_Open() { - var mh$ = sdrplay_api_Open.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Open"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Close { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Close"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static FunctionDescriptor sdrplay_api_Close$descriptor() { - return sdrplay_api_Close.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static MethodHandle sdrplay_api_Close$handle() { - return sdrplay_api_Close.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static MemorySegment sdrplay_api_Close$address() { - return sdrplay_api_Close.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Close() - * } - */ - public static int sdrplay_api_Close() { - var mh$ = sdrplay_api_Close.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Close"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_ApiVersion { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_ApiVersion"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static FunctionDescriptor sdrplay_api_ApiVersion$descriptor() { - return sdrplay_api_ApiVersion.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static MethodHandle sdrplay_api_ApiVersion$handle() { - return sdrplay_api_ApiVersion.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static MemorySegment sdrplay_api_ApiVersion$address() { - return sdrplay_api_ApiVersion.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) - * } - */ - public static int sdrplay_api_ApiVersion(MemorySegment apiVer) { - var mh$ = sdrplay_api_ApiVersion.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_ApiVersion", apiVer); - } - return (int)mh$.invokeExact(apiVer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_LockDeviceApi { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_LockDeviceApi"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static FunctionDescriptor sdrplay_api_LockDeviceApi$descriptor() { - return sdrplay_api_LockDeviceApi.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static MethodHandle sdrplay_api_LockDeviceApi$handle() { - return sdrplay_api_LockDeviceApi.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static MemorySegment sdrplay_api_LockDeviceApi$address() { - return sdrplay_api_LockDeviceApi.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() - * } - */ - public static int sdrplay_api_LockDeviceApi() { - var mh$ = sdrplay_api_LockDeviceApi.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_LockDeviceApi"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_UnlockDeviceApi { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_UnlockDeviceApi"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static FunctionDescriptor sdrplay_api_UnlockDeviceApi$descriptor() { - return sdrplay_api_UnlockDeviceApi.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static MethodHandle sdrplay_api_UnlockDeviceApi$handle() { - return sdrplay_api_UnlockDeviceApi.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static MemorySegment sdrplay_api_UnlockDeviceApi$address() { - return sdrplay_api_UnlockDeviceApi.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() - * } - */ - public static int sdrplay_api_UnlockDeviceApi() { - var mh$ = sdrplay_api_UnlockDeviceApi.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_UnlockDeviceApi"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetDevices { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetDevices"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static FunctionDescriptor sdrplay_api_GetDevices$descriptor() { - return sdrplay_api_GetDevices.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static MethodHandle sdrplay_api_GetDevices$handle() { - return sdrplay_api_GetDevices.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static MemorySegment sdrplay_api_GetDevices$address() { - return sdrplay_api_GetDevices.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs) - * } - */ - public static int sdrplay_api_GetDevices(MemorySegment devices, MemorySegment numDevs, int maxDevs) { - var mh$ = sdrplay_api_GetDevices.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetDevices", devices, numDevs, maxDevs); - } - return (int)mh$.invokeExact(devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SelectDevice { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SelectDevice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_SelectDevice$descriptor() { - return sdrplay_api_SelectDevice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_SelectDevice$handle() { - return sdrplay_api_SelectDevice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_SelectDevice$address() { - return sdrplay_api_SelectDevice.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device) - * } - */ - public static int sdrplay_api_SelectDevice(MemorySegment device) { - var mh$ = sdrplay_api_SelectDevice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SelectDevice", device); - } - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_ReleaseDevice { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_ReleaseDevice"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_ReleaseDevice$descriptor() { - return sdrplay_api_ReleaseDevice.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_ReleaseDevice$handle() { - return sdrplay_api_ReleaseDevice.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_ReleaseDevice$address() { - return sdrplay_api_ReleaseDevice.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device) - * } - */ - public static int sdrplay_api_ReleaseDevice(MemorySegment device) { - var mh$ = sdrplay_api_ReleaseDevice.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_ReleaseDevice", device); - } - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetErrorString { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetErrorString"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static FunctionDescriptor sdrplay_api_GetErrorString$descriptor() { - return sdrplay_api_GetErrorString.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MethodHandle sdrplay_api_GetErrorString$handle() { - return sdrplay_api_GetErrorString.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MemorySegment sdrplay_api_GetErrorString$address() { - return sdrplay_api_GetErrorString.ADDR; - } - - /** - * {@snippet lang=c : - * const char *sdrplay_api_GetErrorString(sdrplay_api_ErrT err) - * } - */ - public static MemorySegment sdrplay_api_GetErrorString(int err) { - var mh$ = sdrplay_api_GetErrorString.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetErrorString", err); - } - return (MemorySegment)mh$.invokeExact(err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetLastError { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetLastError"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static FunctionDescriptor sdrplay_api_GetLastError$descriptor() { - return sdrplay_api_GetLastError.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MethodHandle sdrplay_api_GetLastError$handle() { - return sdrplay_api_GetLastError.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_GetLastError$address() { - return sdrplay_api_GetLastError.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastError(sdrplay_api_DeviceT *device) - * } - */ - public static MemorySegment sdrplay_api_GetLastError(MemorySegment device) { - var mh$ = sdrplay_api_GetLastError.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetLastError", device); - } - return (MemorySegment)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetLastErrorByType { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetLastErrorByType"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastErrorByType(sdrplay_api_DeviceT *device, int type, unsigned long long *time) - * } - */ - public static FunctionDescriptor sdrplay_api_GetLastErrorByType$descriptor() { - return sdrplay_api_GetLastErrorByType.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastErrorByType(sdrplay_api_DeviceT *device, int type, unsigned long long *time) - * } - */ - public static MethodHandle sdrplay_api_GetLastErrorByType$handle() { - return sdrplay_api_GetLastErrorByType.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastErrorByType(sdrplay_api_DeviceT *device, int type, unsigned long long *time) - * } - */ - public static MemorySegment sdrplay_api_GetLastErrorByType$address() { - return sdrplay_api_GetLastErrorByType.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrorInfoT *sdrplay_api_GetLastErrorByType(sdrplay_api_DeviceT *device, int type, unsigned long long *time) - * } - */ - public static MemorySegment sdrplay_api_GetLastErrorByType(MemorySegment device, int type, MemorySegment time) { - var mh$ = sdrplay_api_GetLastErrorByType.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetLastErrorByType", device, type, time); - } - return (MemorySegment)mh$.invokeExact(device, type, time); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_DisableHeartbeat { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_DisableHeartbeat"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static FunctionDescriptor sdrplay_api_DisableHeartbeat$descriptor() { - return sdrplay_api_DisableHeartbeat.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static MethodHandle sdrplay_api_DisableHeartbeat$handle() { - return sdrplay_api_DisableHeartbeat.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static MemorySegment sdrplay_api_DisableHeartbeat$address() { - return sdrplay_api_DisableHeartbeat.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() - * } - */ - public static int sdrplay_api_DisableHeartbeat() { - var mh$ = sdrplay_api_DisableHeartbeat.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_DisableHeartbeat"); - } - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_DebugEnable { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_DebugEnable"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static FunctionDescriptor sdrplay_api_DebugEnable$descriptor() { - return sdrplay_api_DebugEnable.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static MethodHandle sdrplay_api_DebugEnable$handle() { - return sdrplay_api_DebugEnable.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static MemorySegment sdrplay_api_DebugEnable$address() { - return sdrplay_api_DebugEnable.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable) - * } - */ - public static int sdrplay_api_DebugEnable(MemorySegment dev, int enable) { - var mh$ = sdrplay_api_DebugEnable.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_DebugEnable", dev, enable); - } - return (int)mh$.invokeExact(dev, enable); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_GetDeviceParams { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_GetDeviceParams"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static FunctionDescriptor sdrplay_api_GetDeviceParams$descriptor() { - return sdrplay_api_GetDeviceParams.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static MethodHandle sdrplay_api_GetDeviceParams$handle() { - return sdrplay_api_GetDeviceParams.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static MemorySegment sdrplay_api_GetDeviceParams$address() { - return sdrplay_api_GetDeviceParams.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams) - * } - */ - public static int sdrplay_api_GetDeviceParams(MemorySegment dev, MemorySegment deviceParams) { - var mh$ = sdrplay_api_GetDeviceParams.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_GetDeviceParams", dev, deviceParams); - } - return (int)mh$.invokeExact(dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Init { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Init"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static FunctionDescriptor sdrplay_api_Init$descriptor() { - return sdrplay_api_Init.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static MethodHandle sdrplay_api_Init$handle() { - return sdrplay_api_Init.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static MemorySegment sdrplay_api_Init$address() { - return sdrplay_api_Init.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext) - * } - */ - public static int sdrplay_api_Init(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { - var mh$ = sdrplay_api_Init.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Init", dev, callbackFns, cbContext); - } - return (int)mh$.invokeExact(dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Uninit { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Uninit"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static FunctionDescriptor sdrplay_api_Uninit$descriptor() { - return sdrplay_api_Uninit.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static MethodHandle sdrplay_api_Uninit$handle() { - return sdrplay_api_Uninit.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static MemorySegment sdrplay_api_Uninit$address() { - return sdrplay_api_Uninit.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) - * } - */ - public static int sdrplay_api_Uninit(MemorySegment dev) { - var mh$ = sdrplay_api_Uninit.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Uninit", dev); - } - return (int)mh$.invokeExact(dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_Update { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_Update"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static FunctionDescriptor sdrplay_api_Update$descriptor() { - return sdrplay_api_Update.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static MethodHandle sdrplay_api_Update$handle() { - return sdrplay_api_Update.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static MemorySegment sdrplay_api_Update$address() { - return sdrplay_api_Update.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1) - * } - */ - public static int sdrplay_api_Update(MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1) { - var mh$ = sdrplay_api_Update.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_Update", dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } - return (int)mh$.invokeExact(dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoActiveTuner { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoActiveTuner"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner$descriptor() { - return sdrplay_api_SwapRspDuoActiveTuner.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoActiveTuner$handle() { - return sdrplay_api_SwapRspDuoActiveTuner.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoActiveTuner$address() { - return sdrplay_api_SwapRspDuoActiveTuner.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel) - * } - */ - public static int sdrplay_api_SwapRspDuoActiveTuner(MemorySegment dev, MemorySegment currentTuner, int tuner1AmPortSel) { - var mh$ = sdrplay_api_SwapRspDuoActiveTuner.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoActiveTuner", dev, currentTuner, tuner1AmPortSel); - } - return (int)mh$.invokeExact(dev, currentTuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoDualTunerModeSampleRate { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_DOUBLE - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoDualTunerModeSampleRate"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate$descriptor() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$handle() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoDualTunerModeSampleRate$address() { - return sdrplay_api_SwapRspDuoDualTunerModeSampleRate.ADDR; - } - - /** - * {@snippet lang=c : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate) - * } - */ - public static int sdrplay_api_SwapRspDuoDualTunerModeSampleRate(MemorySegment dev, MemorySegment currentSampleRate, double newSampleRate) { - var mh$ = sdrplay_api_SwapRspDuoDualTunerModeSampleRate.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoDualTunerModeSampleRate", dev, currentSampleRate, newSampleRate); - } - return (int)mh$.invokeExact(dev, currentSampleRate, newSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - - private static class sdrplay_api_SwapRspDuoMode { - public static final FunctionDescriptor DESC = FunctionDescriptor.of( - sdrplay_api_h.C_INT, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_POINTER, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_DOUBLE, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT, - sdrplay_api_h.C_INT - ); - - public static final MemorySegment ADDR = sdrplay_api_h.findOrThrow("sdrplay_api_SwapRspDuoMode"); - - public static final MethodHandle HANDLE = Linker.nativeLinker().downcallHandle(ADDR, DESC); - } - - /** - * Function descriptor for: - * {@snippet lang=c : - * 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) - * } - */ - public static FunctionDescriptor sdrplay_api_SwapRspDuoMode$descriptor() { - return sdrplay_api_SwapRspDuoMode.DESC; - } - - /** - * Downcall method handle for: - * {@snippet lang=c : - * 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) - * } - */ - public static MethodHandle sdrplay_api_SwapRspDuoMode$handle() { - return sdrplay_api_SwapRspDuoMode.HANDLE; - } - - /** - * Address for: - * {@snippet lang=c : - * 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) - * } - */ - public static MemorySegment sdrplay_api_SwapRspDuoMode$address() { - return sdrplay_api_SwapRspDuoMode.ADDR; - } - - /** - * {@snippet lang=c : - * 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) - * } - */ - public static int sdrplay_api_SwapRspDuoMode(MemorySegment currDevice, MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel) { - var mh$ = sdrplay_api_SwapRspDuoMode.HANDLE; - try { - if (TRACE_DOWNCALLS) { - traceDowncall("sdrplay_api_SwapRspDuoMode", currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } - return (int)mh$.invokeExact(currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - private static final int MAX_BB_GR = (int)59L; - /** - * {@snippet lang=c : - * #define MAX_BB_GR 59 - * } - */ - public static int MAX_BB_GR() { - return MAX_BB_GR; - } - private static final float SDRPLAY_API_VERSION = 3.1500000953674316f; - /** - * {@snippet lang=c : - * #define SDRPLAY_API_VERSION 3.1500000953674316 - * } - */ - public static float SDRPLAY_API_VERSION() { - return SDRPLAY_API_VERSION; - } - private static final int SDRPLAY_MAX_DEVICES = (int)16L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_DEVICES 16 - * } - */ - public static int SDRPLAY_MAX_DEVICES() { - return SDRPLAY_MAX_DEVICES; - } - private static final int SDRPLAY_MAX_TUNERS_PER_DEVICE = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 - * } - */ - public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return SDRPLAY_MAX_TUNERS_PER_DEVICE; - } - private static final int SDRPLAY_MAX_SER_NO_LEN = (int)64L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_SER_NO_LEN 64 - * } - */ - public static int SDRPLAY_MAX_SER_NO_LEN() { - return SDRPLAY_MAX_SER_NO_LEN; - } - private static final int SDRPLAY_MAX_ROOT_NM_LEN = (int)32L; - /** - * {@snippet lang=c : - * #define SDRPLAY_MAX_ROOT_NM_LEN 32 - * } - */ - public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return SDRPLAY_MAX_ROOT_NM_LEN; - } - private static final int SDRPLAY_RSP1_ID = (int)1L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1_ID 1 - * } - */ - public static int SDRPLAY_RSP1_ID() { - return SDRPLAY_RSP1_ID; - } - private static final int SDRPLAY_RSP1A_ID = (int)255L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1A_ID 255 - * } - */ - public static int SDRPLAY_RSP1A_ID() { - return SDRPLAY_RSP1A_ID; - } - private static final int SDRPLAY_RSP2_ID = (int)2L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP2_ID 2 - * } - */ - public static int SDRPLAY_RSP2_ID() { - return SDRPLAY_RSP2_ID; - } - private static final int SDRPLAY_RSPduo_ID = (int)3L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPduo_ID 3 - * } - */ - public static int SDRPLAY_RSPduo_ID() { - return SDRPLAY_RSPduo_ID; - } - private static final int SDRPLAY_RSPdx_ID = (int)4L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPdx_ID 4 - * } - */ - public static int SDRPLAY_RSPdx_ID() { - return SDRPLAY_RSPdx_ID; - } - private static final int SDRPLAY_RSP1B_ID = (int)6L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSP1B_ID 6 - * } - */ - public static int SDRPLAY_RSP1B_ID() { - return SDRPLAY_RSP1B_ID; - } - private static final int SDRPLAY_RSPdxR2_ID = (int)7L; - /** - * {@snippet lang=c : - * #define SDRPLAY_RSPdxR2_ID 7 - * } - */ - public static int SDRPLAY_RSPdxR2_ID() { - return SDRPLAY_RSPdxR2_ID; - } -} - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/ControlRsp1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/ControlRsp1.java index 0460d55e..cb4cc02d 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/ControlRsp1.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/ControlRsp1.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,9 +19,10 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.Rsp1Device; import io.github.dsheirer.source.tuner.sdrplay.ControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1Device; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,15 +31,15 @@ import org.slf4j.LoggerFactory; */ public class ControlRsp1 extends ControlRsp implements IControlRsp1 { - private Logger mLog = LoggerFactory.getLogger(ControlRsp1.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRsp1.class); /** * Constructs an instance - * @param device for the device + * @param deviceInfo for the device */ - public ControlRsp1(Rsp1Device device) + public ControlRsp1(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo, Rsp1Device.class); } /** @@ -64,9 +65,8 @@ public class ControlRsp1 extends ControlRsp implements IControlRsp1 { return 8; } - } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/DiscoveredRsp1Tuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/DiscoveredRsp1Tuner.java index 9fd8b72f..05fecb22 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/DiscoveredRsp1Tuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/DiscoveredRsp1Tuner.java @@ -21,7 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; /** * RSP1 discovered tuner. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerController.java index 88500141..cd0f9376 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerController.java @@ -24,7 +24,7 @@ import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.RspTunerController; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class Rsp1TunerController extends RspTunerController { getControlRsp().setAgcMode(rtc.getAgcMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP IF AGC Mode to " + rtc.getAgcMode()); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java index b8278f9b..539d925f 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1/Rsp1TunerEditor.java @@ -24,8 +24,8 @@ import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; import io.github.dsheirer.source.tuner.sdrplay.RspTunerEditor; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.source.tuner.sdrplay.RspAgcMode; import net.miginfocom.swing.MigLayout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -132,9 +132,9 @@ public class Rsp1TunerEditor extends RspTunerEditor getAgcButton().setEnabled(hasTuner()); if(hasTuner()) { - AgcMode current = getTunerController().getControlRsp().getAgcMode(); - getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); - getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); + RspAgcMode current = getTunerController().getControlRsp().getAgcMode(); + getAgcButton().setSelected(current == null || current.equals(RspAgcMode.ENABLE)); + getAgcButton().setText((current == null || current.equals(RspAgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); @@ -144,7 +144,7 @@ public class Rsp1TunerEditor extends RspTunerEditor } getLNASlider().setEnabled(hasTuner()); - getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != RspAgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); setLoading(false); @@ -164,7 +164,7 @@ public class Rsp1TunerEditor extends RspTunerEditor getConfiguration().setSampleRate((RspSampleRate)getSampleRateCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); - getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getConfiguration().setAgcMode(getAgcButton().isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); saveConfiguration(); } @@ -192,7 +192,7 @@ public class Rsp1TunerEditor extends RspTunerEditor adjustForSampleRate((int)selected.getSampleRate()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting sample rate for RSP1A tuner", se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/ControlRsp1a.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/ControlRsp1a.java index d42b0b2a..662c37d0 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/ControlRsp1a.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/ControlRsp1a.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,9 +19,10 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1a; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.Rsp1aDevice; import io.github.dsheirer.source.tuner.sdrplay.ControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1aDevice; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -30,93 +31,59 @@ import org.slf4j.LoggerFactory; */ public class ControlRsp1a extends ControlRsp implements IControlRsp1a { - private Logger mLog = LoggerFactory.getLogger(ControlRsp1a.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRsp1a.class); /** * Constructs an instance - * @param device for the device + * @param deviceInfo for the device */ - public ControlRsp1a(Rsp1aDevice device) + public ControlRsp1a(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo, Rsp1aDevice.class); } @Override - public boolean isBiasT() throws SDRPlayException + public boolean isBiasT() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isBiasT(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get Bias-T", Rsp1aDevice::isBiasT); } @Override - public void setBiasT(boolean enabled) throws SDRPlayException + public void setBiasT(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setBiasT(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set Bias-T", device -> device.setBiasT(enabled)); } @Override - public boolean isRfDabNotch() throws SDRPlayException + public boolean isRfDabNotch() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isRfDabNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF DAB notch", Rsp1aDevice::isRfDabNotch); } @Override - public void setRfDabNotch(boolean enabled) throws SDRPlayException + public void setRfDabNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setRfDabNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF DAB notch", device -> device.setRfDabNotch(enabled)); } @Override - public boolean isRfNotch() throws SDRPlayException + public boolean isRfNotch() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isRfNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF notch", Rsp1aDevice::isRfNotch); } @Override - public void setRfNotch(boolean enabled) throws SDRPlayException + public void setRfNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setRfNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF notch", device -> device.setRfNotch(enabled)); + } + + /** + * Frequency below which the LNA has the low (HF) band gain table. + */ + protected long getLowBandLimit() + { + return 60_000_000; } /** @@ -130,7 +97,7 @@ public class ControlRsp1a extends ControlRsp implements IControlRsp { long frequency = getTunedFrequency(); - if(frequency < 60_000_000) + if(frequency < getLowBandLimit()) { return 6; } @@ -142,9 +109,8 @@ public class ControlRsp1a extends ControlRsp implements IControlRsp { return 8; } - } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/DiscoveredRsp1aTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/DiscoveredRsp1aTuner.java index 5c2a1593..98de48e7 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/DiscoveredRsp1aTuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/DiscoveredRsp1aTuner.java @@ -21,7 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1a; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; /** * RSP1A discovered tuner. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/IControlRsp1a.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/IControlRsp1a.java index f8a01a91..acc4fe8e 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/IControlRsp1a.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/IControlRsp1a.java @@ -20,7 +20,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1a; import io.github.dsheirer.source.tuner.sdrplay.IControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; /** * Control interface for RSP1A device @@ -32,40 +32,40 @@ public interface IControlRsp1a extends IControlRsp * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isBiasT() throws SDRPlayException; + boolean isBiasT() throws RspException; /** * Sets the enabled state of the Bias-T power. * @param enabled true to power on the Bias-T * @throws exception if the device is no started/selected */ - void setBiasT(boolean enabled) throws SDRPlayException; + void setBiasT(boolean enabled) throws RspException; /** * Indicates if the RF DAB notch is enabled (DAB broadcast band filter). * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isRfDabNotch() throws SDRPlayException; + boolean isRfDabNotch() throws RspException; /** * Sets the enabled state of the RF DAB notch. * @param enabled true to filter the DAB broadcast band frequency range. * @throws exception if the device is no started/selected */ - void setRfDabNotch(boolean enabled) throws SDRPlayException; + void setRfDabNotch(boolean enabled) throws RspException; /** * Indicates if the RF notch is enabled (FM broadcast band filter). * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isRfNotch() throws SDRPlayException; + boolean isRfNotch() throws RspException; /** * Sets the enabled state of the RF notch * @param enabled true to filter the FM broadcast band frequency range. * @throws exception if the device is no started/selected */ - void setRfNotch(boolean enabled) throws SDRPlayException; + void setRfNotch(boolean enabled) throws RspException; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerController.java index eb1e490a..6d3c43b3 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerController.java @@ -24,7 +24,7 @@ import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.RspTunerController; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class Rsp1aTunerController extends RspTunerController { getControlRsp().setAgcMode(rtc.getAgcMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP IF AGC Mode to " + rtc.getAgcMode()); } @@ -72,7 +72,7 @@ public class Rsp1aTunerController extends RspTunerController { getControlRsp().setBiasT(rtc.isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1A bias-T enabled to " + rtc.isBiasT()); } @@ -81,7 +81,7 @@ public class Rsp1aTunerController extends RspTunerController { getControlRsp().setRfNotch(rtc.isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1A RF Notch enabled to " + rtc.isRfNotch()); } @@ -90,7 +90,7 @@ public class Rsp1aTunerController extends RspTunerController { getControlRsp().setRfDabNotch(rtc.isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1A RF DAB Notch enabled to " + rtc.isRfDabNotch()); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java index 6cdeb1d5..cca728ed 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1a/Rsp1aTunerEditor.java @@ -24,8 +24,8 @@ import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; import io.github.dsheirer.source.tuner.sdrplay.RspTunerEditor; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.source.tuner.sdrplay.RspAgcMode; import net.miginfocom.swing.MigLayout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,9 +143,9 @@ public class Rsp1aTunerEditor extends RspTunerEditor getAgcButton().setEnabled(hasTuner()); if(hasTuner()) { - AgcMode current = getTunerController().getControlRsp().getAgcMode(); - getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); - getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); + RspAgcMode current = getTunerController().getControlRsp().getAgcMode(); + getAgcButton().setSelected(current == null || current.equals(RspAgcMode.ENABLE)); + getAgcButton().setText((current == null || current.equals(RspAgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); @@ -155,7 +155,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor } getLNASlider().setEnabled(hasTuner()); - getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != RspAgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -163,7 +163,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor { getBiasTCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Bias-T enabled state in editor"); } @@ -173,7 +173,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor { getRfDabNotchCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF DAB Notch enabled state in editor"); } @@ -183,7 +183,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor { getRfNotchCheckBox().setSelected(hasTuner() ? getTunerController().getControlRsp().isRfNotch() : false); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF Notch enabled state in editor"); } @@ -208,7 +208,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); - getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getConfiguration().setAgcMode(getAgcButton().isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); saveConfiguration(); } @@ -236,7 +236,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor adjustForSampleRate((int)selected.getSampleRate()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting sample rate for RSP1A tuner", se); } @@ -264,7 +264,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setBiasT(mBiasTCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1A Bias-T enabled to " + mBiasTCheckBox.isSelected(), se); } @@ -292,7 +292,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfDabNotch(mRfDabNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1A RF DAB notch enabled to " + mRfDabNotchCheckBox.isSelected(), se); } @@ -320,7 +320,7 @@ public class Rsp1aTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfNotch(mRfNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1A RF notch enabled to " + mRfNotchCheckBox.isSelected(), se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/ControlRsp1b.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/ControlRsp1b.java index c8a1e7dd..b078c32f 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/ControlRsp1b.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/ControlRsp1b.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,136 +19,26 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1b; -import io.github.dsheirer.source.tuner.sdrplay.ControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp1bDevice; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.source.tuner.sdrplay.rsp1a.ControlRsp1a; /** - * Control wrapper for an RSP1B Device + * Control wrapper for an RSP1B Device. The SDRplay API controls the RSP1B the same as the RSP1A. */ -public class ControlRsp1b extends ControlRsp implements IControlRsp1b +public class ControlRsp1b extends ControlRsp1a implements IControlRsp1b { - private Logger mLog = LoggerFactory.getLogger(ControlRsp1b.class); - /** * Constructs an instance - * @param device for the device + * @param deviceInfo for the device */ - public ControlRsp1b(Rsp1bDevice device) + public ControlRsp1b(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo); } @Override - public boolean isBiasT() throws SDRPlayException + protected long getLowBandLimit() { - if(hasDevice()) - { - return getDevice().getTuner().isBiasT(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setBiasT(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getDevice().getTuner().setBiasT(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public boolean isRfDabNotch() throws SDRPlayException - { - if(hasDevice()) - { - return getDevice().getTuner().isRfDabNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setRfDabNotch(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getDevice().getTuner().setRfDabNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public boolean isRfNotch() throws SDRPlayException - { - if(hasDevice()) - { - return getDevice().getTuner().isRfNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setRfNotch(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getDevice().getTuner().setRfNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - /** - * Maximum LNA index value as determined by frequency range using the API section 5. Gain Reduction Table values. - * @return maximum (valid) LNA index value. - */ - @Override - public int getMaximumLNASetting() - { - try - { - long frequency = getTunedFrequency(); - - if(frequency < 50_000_000) - { - return 6; - } - else if(frequency < 1_000_000_000) - { - return 9; - } - else - { - return 8; - } - - } - catch(SDRPlayException se) - { - mLog.error("Error getting tuned frequency while determining maximum LNA setting."); - } - - return 6; //Use the most restrictive setting as a default. + return 50_000_000; } } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/DiscoveredRsp1bTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/DiscoveredRsp1bTuner.java index ba048ef8..4c817ce3 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/DiscoveredRsp1bTuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/DiscoveredRsp1bTuner.java @@ -21,7 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1b; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; /** * RSP1B discovered tuner. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/IControlRsp1b.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/IControlRsp1b.java index 23490edf..7858d6f7 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/IControlRsp1b.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/IControlRsp1b.java @@ -20,7 +20,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp1b; import io.github.dsheirer.source.tuner.sdrplay.IControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; /** * Control interface for RSP1B device @@ -32,40 +32,40 @@ public interface IControlRsp1b extends IControlRsp * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isBiasT() throws SDRPlayException; + boolean isBiasT() throws RspException; /** * Sets the enabled state of the Bias-T power. * @param enabled true to power on the Bias-T * @throws exception if the device is no started/selected */ - void setBiasT(boolean enabled) throws SDRPlayException; + void setBiasT(boolean enabled) throws RspException; /** * Indicates if the RF DAB notch is enabled (DAB broadcast band filter). * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isRfDabNotch() throws SDRPlayException; + boolean isRfDabNotch() throws RspException; /** * Sets the enabled state of the RF DAB notch. * @param enabled true to filter the DAB broadcast band frequency range. * @throws exception if the device is no started/selected */ - void setRfDabNotch(boolean enabled) throws SDRPlayException; + void setRfDabNotch(boolean enabled) throws RspException; /** * Indicates if the RF notch is enabled (FM broadcast band filter). * @return true if enabled. * @throws exception if the device is no started/selected */ - boolean isRfNotch() throws SDRPlayException; + boolean isRfNotch() throws RspException; /** * Sets the enabled state of the RF notch * @param enabled true to filter the FM broadcast band frequency range. * @throws exception if the device is no started/selected */ - void setRfNotch(boolean enabled) throws SDRPlayException; + void setRfNotch(boolean enabled) throws RspException; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerController.java index 86346486..dd0033a1 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerController.java @@ -24,7 +24,7 @@ import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.RspTunerController; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class Rsp1bTunerController extends RspTunerController { getControlRsp().setAgcMode(rtc.getAgcMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP IF AGC Mode to " + rtc.getAgcMode()); } @@ -72,7 +72,7 @@ public class Rsp1bTunerController extends RspTunerController { getControlRsp().setBiasT(rtc.isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1B bias-T enabled to " + rtc.isBiasT()); } @@ -81,7 +81,7 @@ public class Rsp1bTunerController extends RspTunerController { getControlRsp().setRfNotch(rtc.isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1B RF Notch enabled to " + rtc.isRfNotch()); } @@ -90,7 +90,7 @@ public class Rsp1bTunerController extends RspTunerController { getControlRsp().setRfDabNotch(rtc.isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP1B RF DAB Notch enabled to " + rtc.isRfDabNotch()); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java index 86d8f449..57b1643b 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp1b/Rsp1bTunerEditor.java @@ -24,8 +24,8 @@ import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; import io.github.dsheirer.source.tuner.sdrplay.RspTunerEditor; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.source.tuner.sdrplay.RspAgcMode; import net.miginfocom.swing.MigLayout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -143,9 +143,9 @@ public class Rsp1bTunerEditor extends RspTunerEditor getAgcButton().setEnabled(hasTuner()); if(hasTuner()) { - AgcMode current = getTunerController().getControlRsp().getAgcMode(); - getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); - getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); + RspAgcMode current = getTunerController().getControlRsp().getAgcMode(); + getAgcButton().setSelected(current == null || current.equals(RspAgcMode.ENABLE)); + getAgcButton().setText((current == null || current.equals(RspAgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); @@ -155,14 +155,14 @@ public class Rsp1bTunerEditor extends RspTunerEditor } getLNASlider().setEnabled(hasTuner()); - getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != RspAgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); try { getBiasTCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Bias-T enabled state in editor"); } @@ -172,7 +172,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor { getRfDabNotchCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF DAB Notch enabled state in editor"); } @@ -182,7 +182,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor { getRfNotchCheckBox().setSelected(hasTuner() ? getTunerController().getControlRsp().isRfNotch() : false); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF Notch enabled state in editor"); } @@ -207,7 +207,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor getConfiguration().setRfDabNotch(getRfDabNotchCheckBox().isSelected()); getConfiguration().setLNA(getLNASlider().getLNA()); getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); - getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getConfiguration().setAgcMode(getAgcButton().isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); saveConfiguration(); } @@ -235,7 +235,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor adjustForSampleRate((int)selected.getSampleRate()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting sample rate for RSP1A tuner", se); } @@ -263,7 +263,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setBiasT(mBiasTCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1B Bias-T enabled to " + mBiasTCheckBox.isSelected(), se); } @@ -291,7 +291,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfDabNotch(mRfDabNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1B RF DAB notch enabled to " + mRfDabNotchCheckBox.isSelected(), se); } @@ -319,7 +319,7 @@ public class Rsp1bTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfNotch(mRfNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP1B RF notch enabled to " + mRfNotchCheckBox.isSelected(), se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/ControlRsp2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/ControlRsp2.java index 75df3846..aac3c247 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/ControlRsp2.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/ControlRsp2.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,11 +19,10 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp2; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.Rsp2Device; import io.github.dsheirer.source.tuner.sdrplay.ControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.Rsp2Device; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AmPort; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AntennaSelection; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -32,115 +31,69 @@ import org.slf4j.LoggerFactory; */ public class ControlRsp2 extends ControlRsp implements IControlRsp2 { - private Logger mLog = LoggerFactory.getLogger(ControlRsp2.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRsp2.class); private Rsp2AntennaSelection mAntennaSelection = Rsp2AntennaSelection.ANT_A; /** * Constructs an instance - * @param sdrplayApi to control the device - * @param device to control + * @param deviceInfo for the device */ - public ControlRsp2(Rsp2Device device) + public ControlRsp2(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo, Rsp2Device.class); } @Override - public boolean isBiasT() throws SDRPlayException + public boolean isBiasT() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isBiasT(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get Bias-T", Rsp2Device::isBiasT); } @Override - public void setBiasT(boolean enabled) throws SDRPlayException + public void setBiasT(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setBiasT(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set Bias-T", device -> device.setBiasT(enabled)); } @Override - public boolean isExternalReferenceOutput() throws SDRPlayException + public boolean isExternalReferenceOutput() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isExternalReferenceOutput(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get external reference output", Rsp2Device::isExternalReferenceOutput); } @Override - public void setExternalReferenceOutput(boolean enabled) throws SDRPlayException + public void setExternalReferenceOutput(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setExternalReferenceOutput(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set external reference output", device -> device.setExternalReferenceOutput(enabled)); } @Override - public boolean isRfNotch() throws SDRPlayException + public boolean isRfNotch() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isRfNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF notch", Rsp2Device::isRfNotch); } @Override - public void setRfNotch(boolean enabled) throws SDRPlayException + public void setRfNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setRfNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF notch", device -> device.setRfNotch(enabled)); } @Override - public Rsp2AntennaSelection getAntennaSelection() throws SDRPlayException + public Rsp2AntennaSelection getAntennaSelection() throws RspException { return mAntennaSelection; } @Override - public void setAntennaSelection(Rsp2AntennaSelection selection) throws SDRPlayException + public void setAntennaSelection(Rsp2AntennaSelection selection) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setAmPort(selection.getAmPort()); - getDevice().getTuner().setAntenna(selection.getAntenna()); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set antenna " + selection, device -> { + device.setAmPort(selection.getAmPort()); + device.setAntenna(selection.getAntenna()); + }); + + mAntennaSelection = selection; } /** @@ -150,15 +103,14 @@ public class ControlRsp2 extends ControlRsp implements IControlRsp2 @Override public int getMaximumLNASetting() { + if(mAntennaSelection.isHighZ()) + { + return 4; + } + try { long frequency = getTunedFrequency(); - Rsp2AmPort port = getAntennaSelection().getAmPort(); - - if(port == Rsp2AmPort.PORT_1_HIGH_Z) - { - return 4; - } if(frequency < 420_000_000) { @@ -169,7 +121,7 @@ public class ControlRsp2 extends ControlRsp implements IControlRsp2 return 5; } } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/DiscoveredRsp2Tuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/DiscoveredRsp2Tuner.java index 257eb1a1..457c9523 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/DiscoveredRsp2Tuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/DiscoveredRsp2Tuner.java @@ -21,7 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp2; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; /** * RSP2 discovered tuner. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/IControlRsp2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/IControlRsp2.java index 75a51eb8..a44f7ef7 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/IControlRsp2.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/IControlRsp2.java @@ -20,8 +20,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp2; import io.github.dsheirer.source.tuner.sdrplay.IControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AntennaSelection; +import io.github.dsheirer.source.tuner.sdrplay.RspException; /** * Control interface for RSP2 device @@ -31,56 +30,56 @@ public interface IControlRsp2 extends IControlRsp /** * Indicates if the Bias-T power is enabled. * @return true if enabled. - * @throws SDRPlayException if the device is no started/selected + * @throws RspException if the device is no started/selected */ - boolean isBiasT() throws SDRPlayException; + boolean isBiasT() throws RspException; /** * Sets the enabled state of the Bias-T power. * @param enabled true to power on the Bias-T - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setBiasT(boolean enabled) throws SDRPlayException; + void setBiasT(boolean enabled) throws RspException; /** * Indicates the enabled state of the external reference output. * @return true if enabled. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - boolean isExternalReferenceOutput() throws SDRPlayException; + boolean isExternalReferenceOutput() throws RspException; /** * Sets the enabled state of the external reference output. * @param enabled true to enable. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setExternalReferenceOutput(boolean enabled) throws SDRPlayException; + void setExternalReferenceOutput(boolean enabled) throws RspException; /** * Indicates if the RF notch is enabled (FM broadcast band filter). * @return true if enabled. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - boolean isRfNotch() throws SDRPlayException; + boolean isRfNotch() throws RspException; /** * Sets the enabled state of the RF notch * @param enabled true to filter the FM broadcast band frequency range. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setRfNotch(boolean enabled) throws SDRPlayException; + void setRfNotch(boolean enabled) throws RspException; /** * Antenna currently being used. * @return antenna being used. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - Rsp2AntennaSelection getAntennaSelection() throws SDRPlayException; + Rsp2AntennaSelection getAntennaSelection() throws RspException; /** * Sets the antenna selection * @param antenna to use - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setAntennaSelection(Rsp2AntennaSelection antenna) throws SDRPlayException; + void setAntennaSelection(Rsp2AntennaSelection antenna) throws RspException; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AntennaSelection.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2AntennaSelection.java similarity index 63% rename from src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AntennaSelection.java rename to src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2AntennaSelection.java index 9e22aff3..50a5cdae 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2AntennaSelection.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2AntennaSelection.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2026 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 @@ -17,20 +17,24 @@ * **************************************************************************** */ -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; +package io.github.dsheirer.source.tuner.sdrplay.rsp2; + +import io.github.dsheirer.sdrplay.Rsp2AmPort; +import io.github.dsheirer.sdrplay.Rsp2Antenna; /** - * RSP-2 Antenna + * RSP2 antenna selection: the antenna and AM port combination for each of the three RSP2 antenna connectors. Entry + * names are persisted in tuner configurations. */ public enum Rsp2AntennaSelection { - ANT_A(Rsp2Antenna.ANTENNA_A, Rsp2AmPort.PORT_2_SMA,"ANT A"), - ANT_B(Rsp2Antenna.ANTENNA_B, Rsp2AmPort.PORT_2_SMA, "ANT B"), - HIGH_Z(Rsp2Antenna.ANTENNA_B, Rsp2AmPort.PORT_1_HIGH_Z, "HIGH Z"); + ANT_A(Rsp2Antenna.A, Rsp2AmPort.PORT_2, "ANT A"), + ANT_B(Rsp2Antenna.B, Rsp2AmPort.PORT_2, "ANT B"), + HIGH_Z(Rsp2Antenna.B, Rsp2AmPort.PORT_1, "HIGH Z"); - private Rsp2Antenna mAntenna; - private Rsp2AmPort mAmPort; - private String mDescription; + private final Rsp2Antenna mAntenna; + private final Rsp2AmPort mAmPort; + private final String mDescription; Rsp2AntennaSelection(Rsp2Antenna antenna, Rsp2AmPort amPort, String description) { @@ -41,7 +45,6 @@ public enum Rsp2AntennaSelection /** * Antenna setting for the selection. - * @return antenna */ public Rsp2Antenna getAntenna() { @@ -50,13 +53,20 @@ public enum Rsp2AntennaSelection /** * AM Port for the selection - * @return am port */ public Rsp2AmPort getAmPort() { return mAmPort; } + /** + * Indicates if this selection uses the high impedance (Hi-Z) port. + */ + public boolean isHighZ() + { + return mAmPort == Rsp2AmPort.PORT_1; + } + @Override public String toString() { diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerConfiguration.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerConfiguration.java index 8e83900b..bf5ad579 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerConfiguration.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerConfiguration.java @@ -22,7 +22,6 @@ package io.github.dsheirer.source.tuner.sdrplay.rsp2; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.sdrplay.RspTunerConfiguration; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AntennaSelection; /** * RSP2 tuner configuration diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerController.java index 954ba38f..24a4cccf 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerController.java @@ -24,7 +24,7 @@ import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.RspTunerController; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class Rsp2TunerController extends RspTunerController { getControlRsp().setAgcMode(rtc.getAgcMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP IF AGC Mode to " + rtc.getAgcMode()); } @@ -72,7 +72,7 @@ public class Rsp2TunerController extends RspTunerController { getControlRsp().setBiasT(rtc.isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP2 bias-T enabled to " + rtc.isBiasT()); } @@ -81,7 +81,7 @@ public class Rsp2TunerController extends RspTunerController { getControlRsp().setExternalReferenceOutput(rtc.isExternalReferenceOutput()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP2 external reference output enabled to " + rtc.isExternalReferenceOutput()); } @@ -90,7 +90,7 @@ public class Rsp2TunerController extends RspTunerController { getControlRsp().setRfNotch(rtc.isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP2 RF Notch enabled to " + rtc.isRfNotch()); } @@ -99,7 +99,7 @@ public class Rsp2TunerController extends RspTunerController { getControlRsp().setAntennaSelection(rtc.getAntennaSelection()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP2 antenna selection to " + rtc.getAntennaSelection()); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java index b5f383a0..5b1789ab 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rsp2/Rsp2TunerEditor.java @@ -24,9 +24,8 @@ import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; import io.github.dsheirer.source.tuner.sdrplay.RspTunerEditor; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.Rsp2AntennaSelection; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.source.tuner.sdrplay.RspAgcMode; import net.miginfocom.swing.MigLayout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -147,9 +146,9 @@ public class Rsp2TunerEditor extends RspTunerEditor getAgcButton().setEnabled(hasTuner()); if(hasTuner()) { - AgcMode current = getTunerController().getControlRsp().getAgcMode(); - getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); - getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); + RspAgcMode current = getTunerController().getControlRsp().getAgcMode(); + getAgcButton().setSelected(current == null || current.equals(RspAgcMode.ENABLE)); + getAgcButton().setText((current == null || current.equals(RspAgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); @@ -159,7 +158,7 @@ public class Rsp2TunerEditor extends RspTunerEditor } getLNASlider().setEnabled(hasTuner()); - getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != RspAgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -167,7 +166,7 @@ public class Rsp2TunerEditor extends RspTunerEditor { getBiasTCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Bias-T enabled state in editor"); } @@ -177,7 +176,7 @@ public class Rsp2TunerEditor extends RspTunerEditor { getExternalReferenceOutputCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isExternalReferenceOutput()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF DAB Notch enabled state in editor"); } @@ -187,7 +186,7 @@ public class Rsp2TunerEditor extends RspTunerEditor { getRfNotchCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF Notch enabled state in editor"); } @@ -197,7 +196,7 @@ public class Rsp2TunerEditor extends RspTunerEditor { getAntennaSelectionCombo().setSelectedItem(hasTuner() ? getTunerController().getControlRsp().getAntennaSelection() : null); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting antenna selection in editor"); } @@ -222,7 +221,7 @@ public class Rsp2TunerEditor extends RspTunerEditor getConfiguration().setAntennaSelection((Rsp2AntennaSelection)getAntennaSelectionCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); - getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getConfiguration().setAgcMode(getAgcButton().isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); saveConfiguration(); } @@ -250,7 +249,7 @@ public class Rsp2TunerEditor extends RspTunerEditor adjustForSampleRate((int)selected.getSampleRate()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting sample rate for RSP2 tuner", se); } @@ -278,7 +277,7 @@ public class Rsp2TunerEditor extends RspTunerEditor getTunerController().getControlRsp().setBiasT(mBiasTCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP2 Bias-T enabled to " + mBiasTCheckBox.isSelected(), se); } @@ -306,7 +305,7 @@ public class Rsp2TunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfNotch(mRfNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP2 RF notch enabled to " + mRfNotchCheckBox.isSelected(), se); } @@ -334,7 +333,7 @@ public class Rsp2TunerEditor extends RspTunerEditor getTunerController().getControlRsp().setExternalReferenceOutput(mExternalReferenceOutputCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP2 external reference output notch enabled to " + mExternalReferenceOutputCheckBox.isSelected(), se); @@ -365,7 +364,7 @@ public class Rsp2TunerEditor extends RspTunerEditor getTunerController().getControlRsp().setAntennaSelection(selected); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Antenna selection for RSP2", se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuo.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuo.java index 14c8c9a3..41986a0c 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuo.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuo.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,334 +19,128 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.IfMode; +import io.github.dsheirer.sdrplay.RspDevice; +import io.github.dsheirer.sdrplay.RspDuoDevice; +import io.github.dsheirer.sdrplay.RxChannel; +import io.github.dsheirer.sdrplay.SDRplay; +import io.github.dsheirer.sdrplay.SDRplayException; +import io.github.dsheirer.sdrplay.Tuner; import io.github.dsheirer.source.tuner.sdrplay.ControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.ITunerStatusListener; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.Status; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -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.parameter.tuner.TunerParameters; -import io.github.dsheirer.util.ThreadPool; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Base control wrapper for an RSPduo operating in either single-tuner or master or slave mode. */ -public abstract class ControlRspDuo extends ControlRsp implements IControlRspDuo +public abstract class ControlRspDuo extends ControlRsp implements IControlRspDuo { - private final Logger mLog = LoggerFactory.getLogger(ControlRspDuo.class); + /** + * Sample rate for both tuners when tuner 1 is selected as master. + */ + protected static final double MASTER_SAMPLE_RATE = 8_000_000; /** * Constructs an instance - * - * @param device for the device, obtained from the API + * @param deviceInfo for the device, obtained from the API */ - public ControlRspDuo(RspDuoDevice device) + public ControlRspDuo(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo, RspDuoDevice.class); } /** - * Access the tuner - * @return tuner - * @throws SDRPlayException if the device is not started/selected - */ - protected abstract T getTuner() throws SDRPlayException; - - /** - * Device selection mode - tuner 1 or tuner 2 + * Device selection mode - tuner 1 or tuner 2, single or master/slave * @return mode */ public abstract DeviceSelectionMode getDeviceSelectionMode(); - /** - * Control parameters for either tuner 1 or tuner 2 - * @return control parameters - */ - protected abstract ControlParameters getControlParameters(); - - /** - * Tuner parameters for either tuner 1 or tuner 2 - */ - protected abstract TunerParameters getTunerParameters(); - @Override - public void start() throws SDRPlayException + public Tuner getSdrplayTuner() { - if(hasDevice()) - { - getDevice().setRspDuoMode(getDeviceSelectionMode().getRspDuoMode()); - getDevice().setTunerSelect(getDeviceSelectionMode().getTunerSelect()); + return getDeviceSelectionMode().getTuner(); + } - //In master mode, we have to set the sample rate here, before we select the device - if(getDeviceSelectionMode().isMasterMode()) - { - getDevice().setRspDuoSampleFrequency(8_000_000); - } + /** + * Selects the RSPduo in the mode and tuner specified by the device selection mode. + */ + @Override + protected RspDevice select(SDRplay session, DeviceInfo deviceInfo) throws SDRplayException + { + DeviceSelectionMode mode = getDeviceSelectionMode(); + return session.selectRspDuo(deviceInfo, mode.getRspDuoMode(), mode.getTuner(), + mode.isMasterMode() ? MASTER_SAMPLE_RATE : 0); + } - getDevice().select(); + /** + * In master/slave dual-tuner mode use IF 2.048 MHz, otherwise use zero IF + */ + @Override + protected IfMode getIfMode() + { + return getDeviceSelectionMode().isSingleTunerMode() ? IfMode.ZERO : IfMode.KHZ_2048; + } - //Enable automatic DC and I/Q correction - getControlParameters().getDcOffset().setDC(true); - getControlParameters().getDcOffset().setIQ(true); + /** + * Sets the sample rate. In single tuner mode, sets the ADC sample rate. In master/slave mode, the ADC sample + * rate (8 MHz) is shared by both tuners and is fixed when the master is selected, so this only sets the bandwidth + * and the decimation. + * @param sampleRate enumeration value. + * @throws RspException if the device is not started/initialized + */ + @Override + public void setSampleRate(RspSampleRate sampleRate) throws RspException + { + command("set sample rate " + sampleRate, device -> { + RxChannel channel = device.channel(); + channel.setBandwidth(sampleRate.getBandwidth()); - //Setup LO Mode - getTunerParameters().setLoMode(LoMode.AUTO); - - //Setup IF mode. In master/slave dual-tuner mode use IF_2048, otherwise use IF_ZERO if(getDeviceSelectionMode().isSingleTunerMode()) { - getTunerParameters().setIfMode(IfMode.IF_ZERO); - } - else - { - getTunerParameters().setIfMode(IfMode.IF_2048); - } - } - else - { - throw new SDRPlayException("Unable to start - no device"); - } - } - - @Override - public void startStream() - { - mStreamingLock.lock(); - - try - { - if(hasDevice() && !mStreaming) - { - if(getDeviceSelectionMode().isSlaveMode()) - { - getDevice().initStreamB(getDeviceEventListener(), getStreamListener()); - } - else - { - getDevice().initStreamA(getDeviceEventListener(), getStreamListener()); - } - - mStreaming = true; - } - } - catch(SDRPlayException se) - { - if(se.getStatus() == Status.FAIL) - { - if(getDeviceEventListener() != null) - { - getDeviceEventListener().processDeviceRemoval(getTunerSelect()); - } - } - else - { - mLog.error("Unable to initialize/start streaming for RSPduo", se); - } - } - finally - { - mStreamingLock.unlock(); - } - } - - @Override - public void stopStream() - { - mStreamingLock.lock(); - - try - { - if(hasDevice() && mStreaming) - { - getDevice().uninitialize(); - mStreaming = false; - } - } - catch(Exception e) - { - mLog.error("Error while stopping RSPduo stream", e); - } - finally - { - mStreamingLock.unlock(); - } - } - - /** - * Sets the sample rate - * @param sampleRate enumeration value. - * @throws SDRPlayException if the device is not started/initialized - */ - @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException - { - if(hasDevice()) - { - mSampleRate = sampleRate; - - getDevice().getTuner().setBandwidth(sampleRate.getBandwidth()); - getDevice().getCompositeParameters().getDeviceParameters().getSamplingFrequency() - .setSampleRate(sampleRate.getSampleRate()); - //Only send an update if we're in single-tuner mode ... not sure why we don't have to for dual-tuner mode. - if(getDeviceSelectionMode() != DeviceSelectionMode.MASTER_TUNER_1) - { - getDevice().update(getTunerSelect(), UpdateReason.DEVICE_SAMPLE_RATE); + device.setSampleRate(sampleRate.getSampleRate()); } - getControlParameters().getDecimation().setWideBandSignal(true); - getDevice().setDecimation(sampleRate.getDecimation()); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + channel.setDecimation(sampleRate.getDecimation(), true); + }); + + mSampleRate = sampleRate; } @Override - public void setGain(int lna, int gr) throws SDRPlayException + public boolean isRfDabNotch() throws RspException { - if(mLNA != lna && mBasebandGainReduction != gr) - { - mLNA = lna; - mBasebandGainReduction = gr; - getTuner().setGain(lna, gr); - } + return query("get RF DAB notch", device -> device.isRfDabNotch(getSdrplayTuner())); } @Override - public void acknowledgePowerOverload(TunerSelect tunerSelect) throws SDRPlayException + public void setRfDabNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().acknowledgePowerOverload(tunerSelect); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - - //Notify an optional weakly referenced, registered listener that gain overload has been acknowledged. - if(mGainOverloadReference != null) - { - ITunerStatusListener listener = mGainOverloadReference.get(); - - if(listener != null) - { - ThreadPool.CACHED.submit(() -> listener.notifyGainOverload(tunerSelect)); - } - } + command("set RF DAB notch", device -> device.setRfDabNotch(getSdrplayTuner(), enabled)); } @Override - public long getTunedFrequency() throws SDRPlayException + public boolean isRfNotch() throws RspException { - if(hasDevice()) - { - return getTuner().getFrequency(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF notch", device -> device.isRfNotch(getSdrplayTuner())); } @Override - public void setTunedFrequency(long frequency) throws SDRPlayException + public void setRfNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getTuner().setFrequency(frequency); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF notch", device -> device.setRfNotch(getSdrplayTuner(), enabled)); } @Override - public boolean isRfDabNotch() throws SDRPlayException + public boolean isExternalReferenceOutput() throws RspException { - if(hasDevice()) - { - return getTuner().isRfDabNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get external reference output", RspDuoDevice::isExternalReferenceOutput); } @Override - public void setRfDabNotch(boolean enabled) throws SDRPlayException + public void setExternalReferenceOutput(boolean enabled) throws RspException { - if(hasDevice()) - { - getTuner().setRfDabNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public boolean isRfNotch() throws SDRPlayException - { - if(hasDevice()) - { - return getTuner().isRFNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setRfNotch(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getTuner().setRfNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public boolean isExternalReferenceOutput() throws SDRPlayException - { - if(hasDevice()) - { - return getTuner().isExternalReferenceOutput(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setExternalReferenceOutput(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getTuner().setExternalReferenceOutput(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set external reference output", device -> device.setExternalReferenceOutput(enabled)); } } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1.java index ac175a7e..abdceaf5 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,116 +19,50 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoTuner1; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDuoAmPort; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParameters; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base control wrapper for an RSPduo Tuner 1 */ -public abstract class ControlRspDuoTuner1 extends ControlRspDuo implements IControlRspDuoTuner1 +public abstract class ControlRspDuoTuner1 extends ControlRspDuo implements IControlRspDuoTuner1 { - private Logger mLog = LoggerFactory.getLogger(ControlRspDuoTuner1.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRspDuoTuner1.class); /** * Constructs an instance - * - * @param device to control + * @param deviceInfo for the device */ - public ControlRspDuoTuner1(RspDuoDevice device) + public ControlRspDuoTuner1(DeviceInfo deviceInfo) { - super(device); - } - - /** - * Access tuner 1. - * @return tuner - * @throws SDRPlayException if the device is not started. - */ - protected RspDuoTuner1 getTuner() throws SDRPlayException - { - if(hasDevice()) - { - return (RspDuoTuner1) getDevice().getTuner(); - } - - throw new SDRPlayException("RSPduo device is not started"); + super(deviceInfo); } @Override - public TunerSelect getTunerSelect() + public boolean isAmNotch() throws RspException { - return TunerSelect.TUNER_1; + return query("get AM notch", RspDuoDevice::isTuner1AmNotch); } @Override - protected ControlParameters getControlParameters() + public void setAmNotch(boolean enabled) throws RspException { - return getDevice().getCompositeParameters().getControlAParameters(); + command("set AM notch", device -> device.setTuner1AmNotch(enabled)); } @Override - protected TunerParameters getTunerParameters() + public RspDuoAmPortSelection getAmPort() throws RspException { - return getDevice().getCompositeParameters().getTunerAParameters(); + return query("get AM port", device -> RspDuoAmPortSelection.fromAmPort(device.tuner1AmPort())); } @Override - public boolean isAmNotch() throws SDRPlayException + public void setAmPort(RspDuoAmPortSelection port) throws RspException { - if(hasDevice()) - { - return getTuner().isAmNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setAmNotch(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getTuner().setAmNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public RspDuoAmPort getAmPort() throws SDRPlayException - { - if(hasDevice()) - { - return getTuner().getAmPort(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setAmPort(RspDuoAmPort port) throws SDRPlayException - { - if(hasDevice()) - { - getTuner().setAmPort(port); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set AM port " + port, device -> device.setTuner1AmPort(port.getAmPort())); } /** @@ -141,9 +75,8 @@ public abstract class ControlRspDuoTuner1 extends ControlRspDuo im try { long frequency = getTunedFrequency(); - RspDuoAmPort port = getAmPort(); - if(port == RspDuoAmPort.PORT_1) //Hi-Z Port + if(getAmPort() == RspDuoAmPortSelection.PORT_1) //Hi-Z Port { return 4; } @@ -160,9 +93,8 @@ public abstract class ControlRspDuoTuner1 extends ControlRspDuo im { return 6; } - } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Master.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Master.java index b5e484c1..d9dc0de1 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Master.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Master.java @@ -20,9 +20,9 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.sdrplay.DeviceInfo; import java.util.EnumSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -47,11 +47,11 @@ public class ControlRspDuoTuner1Master extends ControlRspDuoTuner1 /** * Constructs an instance * - * @param device to control + * @param deviceInfo for the device */ - public ControlRspDuoTuner1Master(RspDuoDevice device, MasterSlaveBridge bridge) + public ControlRspDuoTuner1Master(DeviceInfo deviceInfo, MasterSlaveBridge bridge) { - super(device); + super(deviceInfo); mMasterSlaveBridge = bridge; } @@ -68,11 +68,11 @@ public class ControlRspDuoTuner1Master extends ControlRspDuoTuner1 } @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException + public void setSampleRate(RspSampleRate sampleRate) throws RspException { - if(!sampleRate.isDualTunerSampleRate()) + if(!RspSampleRate.DUAL_TUNER_SAMPLE_RATES.contains(sampleRate)) { - throw new SDRPlayException("Use dual-tuner sample rates only"); + throw new RspException("Use supported dual-tuner sample rates only"); } super.setSampleRate(sampleRate); @@ -87,10 +87,10 @@ public class ControlRspDuoTuner1Master extends ControlRspDuoTuner1 /** * Overrides parent stop method to disable continous streaming flag before stopping this device so that the * stream can be stopped. - * @throws SDRPlayException if there is an error + * @throws RspException if there is an error */ @Override - public void stop() throws SDRPlayException + public void stop() throws RspException { mStreamingLock.lock(); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Single.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Single.java index 968a6d3c..6a04f4b3 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Single.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner1Single.java @@ -20,9 +20,9 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.sdrplay.DeviceInfo; import java.util.EnumSet; /** @@ -33,11 +33,11 @@ public class ControlRspDuoTuner1Single extends ControlRspDuoTuner1 /** * Constructs an instance * - * @param device to control + * @param deviceInfo for the device */ - public ControlRspDuoTuner1Single(RspDuoDevice device) + public ControlRspDuoTuner1Single(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo); } @Override @@ -53,11 +53,11 @@ public class ControlRspDuoTuner1Single extends ControlRspDuoTuner1 } @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException + public void setSampleRate(RspSampleRate sampleRate) throws RspException { if(sampleRate.isDualTunerSampleRate()) { - throw new SDRPlayException("Use single-tuner sample rates only"); + throw new RspException("Use single-tuner sample rates only"); } super.setSampleRate(sampleRate); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2.java index d34091fb..13b73d95 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2024 Dennis Sheirer + * Copyright (C) 2014-2026 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,112 +19,38 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.UpdateReason; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoTuner2; -import io.github.dsheirer.source.tuner.sdrplay.api.device.TunerSelect; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.ControlParameters; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParameters; +import io.github.dsheirer.sdrplay.DeviceInfo; +import io.github.dsheirer.sdrplay.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * Base control wrapper for an RSPduo Tuner 2 */ -public abstract class ControlRspDuoTuner2 extends ControlRspDuo implements IControlRspDuoTuner2 +public abstract class ControlRspDuoTuner2 extends ControlRspDuo implements IControlRspDuoTuner2 { - private Logger mLog = LoggerFactory.getLogger(ControlRspDuoTuner2.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRspDuoTuner2.class); /** * Constructs an instance - * - * @param device for the device, obtained from the API + * @param deviceInfo for the device, obtained from the API */ - public ControlRspDuoTuner2(RspDuoDevice device) + public ControlRspDuoTuner2(DeviceInfo deviceInfo) { - super(device); - } - - /** - * Access tuner 2. - * @return tuner - * @throws SDRPlayException if the device is not started. - */ - protected RspDuoTuner2 getTuner() throws SDRPlayException - { - if(hasDevice()) - { - return (RspDuoTuner2) getDevice().getTuner(); - } - - throw new SDRPlayException("RSPduo device is not started"); + super(deviceInfo); } @Override - public TunerSelect getTunerSelect() + public boolean isBiasT() throws RspException { - return TunerSelect.TUNER_2; + return query("get Bias-T", RspDuoDevice::isBiasT); } @Override - protected ControlParameters getControlParameters() + public void setBiasT(boolean enabled) throws RspException { - return getDevice().getCompositeParameters().getControlBParameters(); - } - - @Override - protected TunerParameters getTunerParameters() - { - return getDevice().getCompositeParameters().getTunerBParameters(); - } - - @Override - public boolean isBiasT() throws SDRPlayException - { - if(hasDevice()) - { - return getTuner().isBiasT(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setBiasT(boolean enabled) throws SDRPlayException - { - if(hasDevice()) - { - getTuner().setBiasT(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - /** - * Current IF AGC mode setting. - * @return AGC mode. - */ - @Override - public AgcMode getAgcMode() - { - return getDevice().getCompositeParameters().getControlBParameters().getAgc().getAgcMode(); - } - - /** - * Sets the IF AGC mode - * @param mode to set. - */ - @Override - public void setAgcMode(AgcMode mode) throws SDRPlayException - { - getDevice().getCompositeParameters().getControlBParameters().getAgc().setAgcMode(mode); - getDevice().update(getTunerSelect(), UpdateReason.CONTROL_AGC); + command("set Bias-T", device -> device.setBiasT(enabled)); } /** @@ -150,9 +76,8 @@ public abstract class ControlRspDuoTuner2 extends ControlRspDuo im { return 6; } - } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Single.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Single.java index 4b6f0f94..90c5be6b 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Single.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Single.java @@ -20,9 +20,9 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.sdrplay.DeviceInfo; import java.util.EnumSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,11 +37,11 @@ public class ControlRspDuoTuner2Single extends ControlRspDuoTuner2 /** * Constructs an instance * - * @param device to control + * @param deviceInfo for the device */ - public ControlRspDuoTuner2Single(RspDuoDevice device) + public ControlRspDuoTuner2Single(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo); } @Override @@ -63,11 +63,11 @@ public class ControlRspDuoTuner2Single extends ControlRspDuoTuner2 } @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException + public void setSampleRate(RspSampleRate sampleRate) throws RspException { if(sampleRate.isDualTunerSampleRate()) { - throw new SDRPlayException("Use single-tuner sample rates only"); + throw new RspException("Use single-tuner sample rates only"); } super.setSampleRate(sampleRate); diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Slave.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Slave.java index f05f8493..6796847b 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Slave.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/ControlRspDuoTuner2Slave.java @@ -20,9 +20,9 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; -import io.github.dsheirer.source.tuner.sdrplay.api.DeviceSelectionMode; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.device.RspDuoDevice; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.sdrplay.DeviceInfo; import java.util.EnumSet; /** @@ -35,11 +35,11 @@ public class ControlRspDuoTuner2Slave extends ControlRspDuoTuner2 /** * Constructs an instance * - * @param device to control + * @param deviceInfo for the device */ - public ControlRspDuoTuner2Slave(RspDuoDevice device, MasterSlaveBridge bridge) + public ControlRspDuoTuner2Slave(DeviceInfo deviceInfo, MasterSlaveBridge bridge) { - super(device); + super(deviceInfo); mMasterSlaveBridge = bridge; } @@ -79,23 +79,7 @@ public class ControlRspDuoTuner2Slave extends ControlRspDuoTuner2 } @Override - public void setSampleRate(RspSampleRate sampleRate) throws SDRPlayException - { - if(hasDevice()) - { - mSampleRate = sampleRate; - getDevice().getTuner().setBandwidth(sampleRate.getBandwidth()); - getControlParameters().getDecimation().setWideBandSignal(true); - getDevice().setDecimation(sampleRate.getDecimation()); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } - } - - @Override - public void setExternalReferenceOutput(boolean enabled) throws SDRPlayException + public void setExternalReferenceOutput(boolean enabled) throws RspException { //Ignore ... tuner 2 configured for slave mode does not control the external reference output } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/DiscoveredRspDuoTuner1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/DiscoveredRspDuoTuner1.java index 2b67fd48..82ac09c6 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/DiscoveredRspDuoTuner1.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDuo/DiscoveredRspDuoTuner1.java @@ -21,9 +21,10 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDuo; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.TunerFactory; +import io.github.dsheirer.source.tuner.sdrplay.DeviceSelectionMode; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -46,7 +47,7 @@ public class DiscoveredRspDuoTuner1 extends DiscoveredRspTuner mAmPortCombo; + private JComboBox mAmPortCombo; private JButton mTunerPreferencesButton; /** @@ -164,9 +163,9 @@ public class RspDuoTuner1Editor extends RspTunerEditor getAmPortCombo() + private JComboBox getAmPortCombo() { if(mAmPortCombo == null) { - mAmPortCombo = new JComboBox<>(RspDuoAmPort.values()); + mAmPortCombo = new JComboBox<>(RspDuoAmPortSelection.values()); mAmPortCombo.setEnabled(false); mAmPortCombo.addActionListener(e -> { if(hasTuner() && !isLoading()) { - RspDuoAmPort selected = (RspDuoAmPort)mAmPortCombo.getSelectedItem(); + RspDuoAmPortSelection selected = (RspDuoAmPortSelection)mAmPortCombo.getSelectedItem(); try { getTunerController().getControlRsp().setAmPort(selected); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting AM port for RSPduo tuner 1", se); } @@ -360,7 +359,7 @@ public class RspDuoTuner1Editor extends RspTunerEditor implements IControlRspDx { - private Logger mLog = LoggerFactory.getLogger(ControlRspDx.class); + private static final Logger mLog = LoggerFactory.getLogger(ControlRspDx.class); /** * Constructs an instance - * @param device for the device + * @param deviceInfo for the device */ - public ControlRspDx(RspDxDevice device) + public ControlRspDx(DeviceInfo deviceInfo) { - super(device); + super(deviceInfo, RspDxDevice.class); } @Override - public boolean isBiasT() throws SDRPlayException + public boolean isBiasT() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isBiasT(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get Bias-T", RspDxDevice::isBiasT); } @Override - public void setBiasT(boolean enabled) throws SDRPlayException + public void setBiasT(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setBiasT(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set Bias-T", device -> device.setBiasT(enabled)); } @Override - public boolean isRfNotch() throws SDRPlayException + public boolean isRfNotch() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isRfNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF notch", RspDxDevice::isRfNotch); } @Override - public void setRfNotch(boolean enabled) throws SDRPlayException + public void setRfNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setRfNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF notch", device -> device.setRfNotch(enabled)); } @Override - public boolean isRfDabNotch() throws SDRPlayException + public boolean isRfDabNotch() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isRfDabNotch(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get RF DAB notch", RspDxDevice::isRfDabNotch); } @Override - public void setRfDabNotch(boolean enabled) throws SDRPlayException + public void setRfDabNotch(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setRfDabNotch(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set RF DAB notch", device -> device.setRfDabNotch(enabled)); } @Override - public boolean isHighDynamicRange() throws SDRPlayException + public boolean isHighDynamicRange() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().isHdrMode(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get HDR mode", RspDxDevice::isHdr); } @Override - public void setHighDynamicRange(boolean enabled) throws SDRPlayException + public void setHighDynamicRange(boolean enabled) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setHdrMode(enabled); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set HDR mode", device -> device.setHdr(enabled)); } @Override - public RspDxAntenna getAntenna() throws SDRPlayException + public RspDxAntennaSelection getAntenna() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().getAntenna(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get antenna", device -> RspDxAntennaSelection.fromAntenna(device.antenna())); } @Override - public void setAntenna(RspDxAntenna antenna) throws SDRPlayException + public void setAntenna(RspDxAntennaSelection antenna) throws RspException { - if(hasDevice()) - { - getDevice().getTuner().setAntenna(antenna); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + command("set antenna " + antenna, device -> device.setAntenna(antenna.getAntenna())); } @Override - public void setHdrModeBandwidth(HdrModeBandwidth bandwidth) throws SDRPlayException + public void setHdrModeBandwidth(HdrModeBandwidth bandwidth) throws RspException { - if(hasDevice()) + if(bandwidth == null || bandwidth.getBandwidth() == null) { - getDevice().getTuner().setHdrModeBandwidth(bandwidth); - } - else - { - throw new SDRPlayException("Device is not initialized"); + throw new RspException("Invalid HDR mode bandwidth: " + bandwidth); } + + command("set HDR mode bandwidth " + bandwidth, device -> device.setHdrBandwidth(bandwidth.getBandwidth())); } @Override - public HdrModeBandwidth getHdrModeBandwidth() throws SDRPlayException + public HdrModeBandwidth getHdrModeBandwidth() throws RspException { - if(hasDevice()) - { - return getDevice().getTuner().getHdrModeBandwidth(); - } - else - { - throw new SDRPlayException("Device is not initialized"); - } + return query("get HDR mode bandwidth", device -> HdrModeBandwidth.fromBandwidth(device.hdrBandwidth())); } /** @@ -239,7 +159,7 @@ public class ControlRspDx extends ControlRsp implements IControlRsp return 18; } } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error getting tuned frequency while determining maximum LNA setting."); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/DiscoveredRspDxTuner.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/DiscoveredRspDxTuner.java index 6baa29bd..fe463f5d 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/DiscoveredRspDxTuner.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/DiscoveredRspDxTuner.java @@ -21,7 +21,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDx; import io.github.dsheirer.preference.source.ChannelizerType; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; -import io.github.dsheirer.source.tuner.sdrplay.api.device.DeviceInfo; +import io.github.dsheirer.sdrplay.DeviceInfo; /** * RSPdx discovered tuner. diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/HdrModeBandwidth.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/HdrModeBandwidth.java new file mode 100644 index 00000000..f1c03fac --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/HdrModeBandwidth.java @@ -0,0 +1,79 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2026 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 + * **************************************************************************** + */ + +package io.github.dsheirer.source.tuner.sdrplay.rspDx; + +import io.github.dsheirer.sdrplay.RspDxHdrBandwidth; +import java.util.EnumSet; + +/** + * RSPdx High Dynamic Range (HDR) mode bandwidth. Entry names are persisted in tuner configurations. + */ +public enum HdrModeBandwidth +{ + BANDWIDTH_0_200(RspDxHdrBandwidth.KHZ_200, ".2 MHz"), + BANDWIDTH_0_500(RspDxHdrBandwidth.KHZ_500, ".5 MHz"), + BANDWIDTH_1_200(RspDxHdrBandwidth.KHZ_1200, "1.2 MHz"), + BANDWIDTH_1_700(RspDxHdrBandwidth.KHZ_1700, "1.7 MHz"), + UNKNOWN(null, "UNKNOWN"); + + /** + * Valid (selectable) bandwidth entries + */ + public static final EnumSet VALID = EnumSet.range(BANDWIDTH_0_200, BANDWIDTH_1_700); + + private final RspDxHdrBandwidth mBandwidth; + private final String mDescription; + + HdrModeBandwidth(RspDxHdrBandwidth bandwidth, String description) + { + mBandwidth = bandwidth; + mDescription = description; + } + + /** + * SDRplay API HDR bandwidth for this entry, or null for UNKNOWN. + */ + public RspDxHdrBandwidth getBandwidth() + { + return mBandwidth; + } + + /** + * Lookup the entry that matches the SDRplay API HDR bandwidth + */ + public static HdrModeBandwidth fromBandwidth(RspDxHdrBandwidth bandwidth) + { + for(HdrModeBandwidth entry: VALID) + { + if(entry.getBandwidth() == bandwidth) + { + return entry; + } + } + + return UNKNOWN; + } + + @Override + public String toString() + { + return mDescription; + } +} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/IControlRspDx.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/IControlRspDx.java index 053f2247..e08e0f40 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/IControlRspDx.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/IControlRspDx.java @@ -20,9 +20,7 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDx; import io.github.dsheirer.source.tuner.sdrplay.IControlRsp; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.HdrModeBandwidth; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxAntenna; +import io.github.dsheirer.source.tuner.sdrplay.RspException; /** * Control interface for RSPdx device @@ -32,84 +30,84 @@ public interface IControlRspDx extends IControlRsp /** * Indicates if the Bias-T power is enabled. * @return true if enabled. - * @throws SDRPlayException if the device is no started/selected + * @throws RspException if the device is no started/selected */ - boolean isBiasT() throws SDRPlayException; + boolean isBiasT() throws RspException; /** * Sets the enabled state of the Bias-T power. * @param enabled true to power on the Bias-T - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setBiasT(boolean enabled) throws SDRPlayException; + void setBiasT(boolean enabled) throws RspException; /** * Indicates the enabled state of high dynamic range mode * @return true if enabled. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - boolean isHighDynamicRange() throws SDRPlayException; + boolean isHighDynamicRange() throws RspException; /** * Sets the enabled state of the high dynamic range mode * @param enabled true to enable. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setHighDynamicRange(boolean enabled) throws SDRPlayException; + void setHighDynamicRange(boolean enabled) throws RspException; /** * Indicates if the RF notch is enabled (FM broadcast band filter). * @return true if enabled. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - boolean isRfNotch() throws SDRPlayException; + boolean isRfNotch() throws RspException; /** * Sets the enabled state of the RF notch * @param enabled true to filter the FM broadcast band frequency range. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setRfNotch(boolean enabled) throws SDRPlayException; + void setRfNotch(boolean enabled) throws RspException; /** * Indicates if the RF DAB notch is enabled (DAB broadcast band filter). * @return true if enabled. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - boolean isRfDabNotch() throws SDRPlayException; + boolean isRfDabNotch() throws RspException; /** * Sets the enabled state of the RF DAB notch. * @param enabled true to filter the DAB broadcast band frequency range. - * @throws SDRPlayException if the device is not started (selected). + * @throws RspException if the device is not started (selected). */ - void setRfDabNotch(boolean enabled) throws SDRPlayException; + void setRfDabNotch(boolean enabled) throws RspException; /** * Antenna selection * @return currently selected antenna - * @throws SDRPlayException if the device is not started (selected) + * @throws RspException if the device is not started (selected) */ - RspDxAntenna getAntenna() throws SDRPlayException; + RspDxAntennaSelection getAntenna() throws RspException; /** * Sets the antenna selection * @param antenna to select - * @throws SDRPlayException if the device is not started (selected) + * @throws RspException if the device is not started (selected) */ - void setAntenna(RspDxAntenna antenna) throws SDRPlayException; + void setAntenna(RspDxAntennaSelection antenna) throws RspException; /** * Sets High Dynamic Range mode bandwidth * @param bandwidth to apply - * @throws SDRPlayException if the device is not started (selected) + * @throws RspException if the device is not started (selected) */ - void setHdrModeBandwidth(HdrModeBandwidth bandwidth) throws SDRPlayException; + void setHdrModeBandwidth(HdrModeBandwidth bandwidth) throws RspException; /** * High Dynamic Range mode bandwidth * @return bandwidth - * @throws SDRPlayException if the device is not started (selected) + * @throws RspException if the device is not started (selected) */ - HdrModeBandwidth getHdrModeBandwidth() throws SDRPlayException; + HdrModeBandwidth getHdrModeBandwidth() throws RspException; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2Antenna.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxAntennaSelection.java similarity index 52% rename from src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2Antenna.java rename to src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxAntennaSelection.java index f9f6c943..f300c667 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/parameter/tuner/Rsp2Antenna.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxAntennaSelection.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2026 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 @@ -17,50 +17,49 @@ * **************************************************************************** */ -package io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner; +package io.github.dsheirer.source.tuner.sdrplay.rspDx; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; +import io.github.dsheirer.sdrplay.RspDxAntenna; /** - * RSP-2 Antenna + * RSPdx antenna selection. Entry names are persisted in tuner configurations. */ -public enum Rsp2Antenna +public enum RspDxAntennaSelection { - ANTENNA_A(sdrplay_api_h.sdrplay_api_Rsp2_ANTENNA_A(), "ANT A"), - ANTENNA_B(sdrplay_api_h.sdrplay_api_Rsp2_ANTENNA_B(), "ANT B"); + ANTENNA_A(RspDxAntenna.A, "ANT A (1 kHz to 2 GHz)"), + ANTENNA_B(RspDxAntenna.B, "ANT B (1 kHz to 2 GHz)"), + ANTENNA_C(RspDxAntenna.C, "ANT C (1 kHz to 200 MHz)"); - private int mValue; - private String mDescription; + private final RspDxAntenna mAntenna; + private final String mDescription; - Rsp2Antenna(int value, String description) + RspDxAntennaSelection(RspDxAntenna antenna, String description) { - mValue = value; + mAntenna = antenna; mDescription = description; } /** - * Numeric value + * SDRplay API antenna for this entry */ - public int getValue() + public RspDxAntenna getAntenna() { - return mValue; + return mAntenna; } /** - * Lookup the entry from a return code - * @param value to lookup - * @return entry or ANTENNA A if the code is not recognized + * Lookup the entry that matches the SDRplay API antenna */ - public static Rsp2Antenna fromValue(int value) + public static RspDxAntennaSelection fromAntenna(RspDxAntenna antenna) { - for(Rsp2Antenna status: Rsp2Antenna.values()) + for(RspDxAntennaSelection selection: values()) { - if(status.getValue() == value) + if(selection.getAntenna() == antenna) { - return status; + return selection; } } - + return ANTENNA_A; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerConfiguration.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerConfiguration.java index bcea45ae..99025d08 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerConfiguration.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerConfiguration.java @@ -22,8 +22,6 @@ package io.github.dsheirer.source.tuner.sdrplay.rspDx; import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.sdrplay.RspTunerConfiguration; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.HdrModeBandwidth; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxAntenna; /** * RSPdx tuner configuration @@ -34,7 +32,7 @@ public class RspDxTunerConfiguration extends RspTunerConfiguration private boolean mHdrMode = false; private boolean mRfNotch; private boolean mRfDabNotch; - private RspDxAntenna mAntenna = RspDxAntenna.ANTENNA_A; + private RspDxAntennaSelection mAntenna = RspDxAntennaSelection.ANTENNA_A; private HdrModeBandwidth mHdrModeBandwidth = HdrModeBandwidth.BANDWIDTH_1_700; /** @@ -132,7 +130,7 @@ public class RspDxTunerConfiguration extends RspTunerConfiguration * Antenna setting */ @JacksonXmlProperty(isAttribute = true, localName = "antenna") - public RspDxAntenna getAntenna() + public RspDxAntennaSelection getAntenna() { return mAntenna; } @@ -140,7 +138,7 @@ public class RspDxTunerConfiguration extends RspTunerConfiguration /** * Sets the antenna. */ - public void setAntenna(RspDxAntenna antenna) + public void setAntenna(RspDxAntennaSelection antenna) { mAntenna = antenna; } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerController.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerController.java index a5fa77cf..1d111939 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerController.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerController.java @@ -24,7 +24,7 @@ import io.github.dsheirer.source.tuner.ITunerErrorListener; import io.github.dsheirer.source.tuner.TunerType; import io.github.dsheirer.source.tuner.configuration.TunerConfiguration; import io.github.dsheirer.source.tuner.sdrplay.RspTunerController; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; +import io.github.dsheirer.source.tuner.sdrplay.RspException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -63,7 +63,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setAgcMode(rtc.getAgcMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSP IF AGC Mode to " + rtc.getAgcMode()); } @@ -72,7 +72,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setAntenna(rtc.getAntenna()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx antenna to " + rtc.getAntenna()); } @@ -81,7 +81,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setBiasT(rtc.isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx bias-T enabled to " + rtc.isBiasT()); } @@ -90,7 +90,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setHighDynamicRange(rtc.isHdrMode()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx high dynamic range mode enabled to " + rtc.isHdrMode()); } @@ -99,7 +99,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setRfNotch(rtc.isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx RF Notch enabled to " + rtc.isRfNotch()); } @@ -108,7 +108,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setRfDabNotch(rtc.isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx RF DAB Notch enabled to " + rtc.isRfDabNotch()); } @@ -117,7 +117,7 @@ public class RspDxTunerController extends RspTunerController { getControlRsp().setHdrModeBandwidth(rtc.getHdrModeBandwidth()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RSPdx HDR mode bandwdidth to " + rtc.getHdrModeBandwidth()); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java index c61e3a85..7e714faa 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/rspDx/RspDxTunerEditor.java @@ -24,10 +24,8 @@ import io.github.dsheirer.source.tuner.manager.TunerManager; import io.github.dsheirer.source.tuner.sdrplay.DiscoveredRspTuner; import io.github.dsheirer.source.tuner.sdrplay.RspSampleRate; import io.github.dsheirer.source.tuner.sdrplay.RspTunerEditor; -import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayException; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.control.AgcMode; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.HdrModeBandwidth; -import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.RspDxAntenna; +import io.github.dsheirer.source.tuner.sdrplay.RspException; +import io.github.dsheirer.source.tuner.sdrplay.RspAgcMode; import net.miginfocom.swing.MigLayout; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -49,7 +47,7 @@ public class RspDxTunerEditor extends RspTunerEditor private JCheckBox mBiasTCheckBox; private JCheckBox mRfDabNotchCheckBox; private JCheckBox mRfNotchCheckBox; - private JComboBox mAntennaCombo; + private JComboBox mAntennaCombo; private JCheckBox mHdrModeCheckBox; private JComboBox mHdrModeBandwidthCombo; @@ -156,9 +154,9 @@ public class RspDxTunerEditor extends RspTunerEditor getAgcButton().setEnabled(hasTuner()); if(hasTuner()) { - AgcMode current = getTunerController().getControlRsp().getAgcMode(); - getAgcButton().setSelected(current == null || current.equals(AgcMode.ENABLE)); - getAgcButton().setText((current == null || current.equals(AgcMode.ENABLE)) ? AUTOMATIC : MANUAL); + RspAgcMode current = getTunerController().getControlRsp().getAgcMode(); + getAgcButton().setSelected(current == null || current.equals(RspAgcMode.ENABLE)); + getAgcButton().setText((current == null || current.equals(RspAgcMode.ENABLE)) ? AUTOMATIC : MANUAL); getLNASlider().setLNA(getTunerController().getControlRsp().getLNA()); getIfGainSlider().setGR(getTunerController().getControlRsp().getBasebandGainReduction()); @@ -168,7 +166,7 @@ public class RspDxTunerEditor extends RspTunerEditor } getLNASlider().setEnabled(hasTuner()); - getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != AgcMode.ENABLE); + getIfGainSlider().setEnabled(hasTuner() && getTunerController().getControlRsp().getAgcMode() != RspAgcMode.ENABLE); getGainValueLabel().setEnabled(hasTuner()); getBiasTCheckBox().setEnabled(hasTuner()); @@ -176,7 +174,7 @@ public class RspDxTunerEditor extends RspTunerEditor { getBiasTCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isBiasT()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Bias-T enabled state in editor"); } @@ -186,7 +184,7 @@ public class RspDxTunerEditor extends RspTunerEditor { getHdrModeCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isHighDynamicRange()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting HDR mode enabled state in editor"); } @@ -196,7 +194,7 @@ public class RspDxTunerEditor extends RspTunerEditor { getRfNotchCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isRfNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF Notch enabled state in editor"); } @@ -206,7 +204,7 @@ public class RspDxTunerEditor extends RspTunerEditor { getRfDabNotchCheckBox().setSelected(hasTuner() && getTunerController().getControlRsp().isRfDabNotch()); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting RF DAB Notch enabled state in editor"); } @@ -216,7 +214,7 @@ public class RspDxTunerEditor extends RspTunerEditor { getAntennaCombo().setSelectedItem(hasTuner() ? getTunerController().getControlRsp().getAntenna() : null); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting antenna selection in editor"); } @@ -240,10 +238,10 @@ public class RspDxTunerEditor extends RspTunerEditor getConfiguration().setHdrMode(getHdrModeCheckBox().isSelected()); getConfiguration().setRfDabNotch(getRfNotchCheckBox().isSelected()); getConfiguration().setRfNotch(getRfNotchCheckBox().isSelected()); - getConfiguration().setAntenna((RspDxAntenna) getAntennaCombo().getSelectedItem()); + getConfiguration().setAntenna((RspDxAntennaSelection) getAntennaCombo().getSelectedItem()); getConfiguration().setLNA(getLNASlider().getLNA()); getConfiguration().setBasebandGainReduction(getIfGainSlider().getGR()); - getConfiguration().setAgcMode(getAgcButton().isSelected() ? AgcMode.ENABLE : AgcMode.DISABLE); + getConfiguration().setAgcMode(getAgcButton().isSelected() ? RspAgcMode.ENABLE : RspAgcMode.DISABLE); saveConfiguration(); } @@ -271,7 +269,7 @@ public class RspDxTunerEditor extends RspTunerEditor adjustForSampleRate((int)selected.getSampleRate()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting sample rate for RSP2 tuner", se); } @@ -299,7 +297,7 @@ public class RspDxTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setBiasT(mBiasTCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP2 Bias-T enabled to " + mBiasTCheckBox.isSelected(), se); } @@ -327,7 +325,7 @@ public class RspDxTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setHighDynamicRange(mHdrModeCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSPd HDR mode enabled to " + mHdrModeCheckBox.isSelected(), se); } @@ -355,7 +353,7 @@ public class RspDxTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfNotch(mRfNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSP2 RF notch enabled to " + mRfNotchCheckBox.isSelected(), se); } @@ -383,7 +381,7 @@ public class RspDxTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setRfDabNotch(mRfDabNotchCheckBox.isSelected()); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Unable to set RSPdx RF DAB notch enabled to " + mRfDabNotchCheckBox.isSelected(), se); } @@ -397,23 +395,23 @@ public class RspDxTunerEditor extends RspTunerEditor /** * Antenna selection combobox control */ - private JComboBox getAntennaCombo() + private JComboBox getAntennaCombo() { if(mAntennaCombo == null) { - mAntennaCombo = new JComboBox<>(RspDxAntenna.values()); + mAntennaCombo = new JComboBox<>(RspDxAntennaSelection.values()); mAntennaCombo.setEnabled(false); mAntennaCombo.addActionListener(e -> { if(hasTuner() && !isLoading()) { - RspDxAntenna selected = (RspDxAntenna) mAntennaCombo.getSelectedItem(); + RspDxAntennaSelection selected = (RspDxAntennaSelection) mAntennaCombo.getSelectedItem(); try { getTunerController().getControlRsp().setAntenna(selected); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting Antenna selection for RSPdx", se); } @@ -431,7 +429,7 @@ public class RspDxTunerEditor extends RspTunerEditor { if(mHdrModeBandwidthCombo == null) { - mHdrModeBandwidthCombo = new JComboBox<>(HdrModeBandwidth.values()); + mHdrModeBandwidthCombo = new JComboBox<>(HdrModeBandwidth.VALID.toArray(new HdrModeBandwidth[0])); mHdrModeBandwidthCombo.setEnabled(false); mHdrModeBandwidthCombo.addActionListener(e -> { if(hasTuner() && !isLoading()) @@ -443,7 +441,7 @@ public class RspDxTunerEditor extends RspTunerEditor getTunerController().getControlRsp().setHdrModeBandwidth(selected); save(); } - catch(SDRPlayException se) + catch(RspException se) { mLog.error("Error setting HDR mode bandwidth for RSPdx", se); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/ui/DiscoveredTunerModel.java b/src/main/java/io/github/dsheirer/source/tuner/ui/DiscoveredTunerModel.java index 4984a7cd..e53f8ae7 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/ui/DiscoveredTunerModel.java +++ b/src/main/java/io/github/dsheirer/source/tuner/ui/DiscoveredTunerModel.java @@ -386,7 +386,7 @@ public class DiscoveredTunerModel extends AbstractTableModel implements Listener //Special handling for RSPduo Tuner 1 configured as master - remove the slave tuner also if(discoveredTuner instanceof DiscoveredRspDuoTuner1 master1 && - master1.getDeviceInfo().getDeviceSelectionMode().isMasterMode()) + master1.getDeviceSelectionMode().isMasterMode()) { DiscoveredTuner slave2 = getDiscoveredTuner(master1.getSlaveId()); @@ -399,7 +399,7 @@ public class DiscoveredTunerModel extends AbstractTableModel implements Listener } //Special handling for RSPduo Tuner 2 configured as slave - remove the master tuner also else if(discoveredTuner instanceof DiscoveredRspDuoTuner2 slave2 && - slave2.getDeviceInfo().getDeviceSelectionMode().isSlaveMode()) + slave2.getDeviceSelectionMode().isSlaveMode()) { String masterId = slave2.getMasterId();