From 2dde13bf4b39531dd74823bb7063f68db8299a3e Mon Sep 17 00:00:00 2001 From: Dennis Sheirer Date: Sat, 24 Aug 2024 07:40:28 -0400 Subject: [PATCH] #1955 Java JDK 22 and Gradle 8.10. Updates SDRPlay API to latest Project Panama FFM API changes. Increment app version to 0.6.1-beta2 --- .github/workflows/gradle.yml | 4 +- .github/workflows/nightly.yml | 4 +- .idea/misc.xml | 2 +- artifacts/sdrplay-api-headers/README.txt | 40 - .../sdrplay-api-headers/v3_11/sdrplay_api.h | 230 -- .../v3_11/sdrplay_api_rspDuo.h | 40 - .../v3_14/sdrplay_api_callback.h | 79 - .../v3_14/sdrplay_api_control.h | 55 - .../v3_14/sdrplay_api_dev.h | 51 - .../v3_14/sdrplay_api_rsp1a.h | 22 - .../v3_14/sdrplay_api_rsp2.h | 35 - .../v3_14/sdrplay_api_rspDx.h | 46 - .../v3_14/sdrplay_api_rx_channel.h | 21 - .../v3_14/sdrplay_api_tuner.h | 93 - .../{v3_14 => v3_15}/sdrplay_api.h | 3 +- .../{v3_11 => v3_15}/sdrplay_api_callback.h | 0 .../{v3_11 => v3_15}/sdrplay_api_control.h | 0 .../{v3_11 => v3_15}/sdrplay_api_dev.h | 0 .../{v3_11 => v3_15}/sdrplay_api_rsp1a.h | 0 .../{v3_11 => v3_15}/sdrplay_api_rsp2.h | 0 .../{v3_14 => v3_15}/sdrplay_api_rspDuo.h | 0 .../{v3_11 => v3_15}/sdrplay_api_rspDx.h | 0 .../{v3_11 => v3_15}/sdrplay_api_rx_channel.h | 0 .../{v3_11 => v3_15}/sdrplay_api_tuner.h | 0 build.gradle | 45 +- gradle.properties | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 61574 -> 63375 bytes gradle/wrapper/gradle-wrapper.properties | 5 +- gradlew | 18 +- .../java/io/github/dsheirer/gui/SDRTrunk.java | 9 + .../dsheirer/source/tuner/sdrplay/api/README | 51 +- .../sdrplay/api/SDRPlayLibraryHelper.java | 123 + .../source/tuner/sdrplay/api/SDRplay.java | 153 +- .../tuner/sdrplay/api/UpdateReason.java | 2 +- .../api/callback/CallbackFunctions.java | 44 +- .../api/callback/DeviceEventAdapter.java | 75 +- .../api/callback/StreamCallbackAdapter.java | 16 +- .../callback/StreamCallbackParameters.java | 22 +- .../sdrplay/api/device/DeviceFactory.java | 12 +- .../api/device/DeviceStruct_v3_07.java | 26 +- .../api/device/DeviceStruct_v3_08.java | 26 +- .../tuner/sdrplay/api/device/DeviceType.java | 8 +- .../sdrplay/api/device/RspDuoDevice.java | 10 +- .../sdrplay/api/error/ErrorInformation.java | 18 +- .../composite/CompositeParameters.java | 31 +- .../composite/CompositeParametersFactory.java | 16 +- .../composite/Rsp1CompositeParameters.java | 6 +- .../composite/Rsp1aCompositeParameters.java | 6 +- .../composite/Rsp1bCompositeParameters.java | 6 +- .../composite/Rsp2CompositeParameters.java | 6 +- .../composite/RspDuoCompositeParameters.java | 20 +- .../composite/RspDxCompositeParameters.java | 6 +- .../sdrplay/api/parameter/control/Agc.java | 30 +- .../parameter/control/ControlParameters.java | 28 +- .../api/parameter/control/DcOffset.java | 20 +- .../api/parameter/control/Decimation.java | 16 +- .../parameter/device/DeviceParameters.java | 38 +- .../device/DeviceParametersFactory.java | 2 +- .../api/parameter/device/ResetFlags.java | 10 +- .../device/Rsp1DeviceParameters.java | 8 +- .../device/Rsp1aDeviceParameters.java | 24 +- .../device/Rsp2DeviceParameters.java | 20 +- .../device/RspDuoDeviceParameters.java | 20 +- .../device/RspDxDeviceParameters.java | 35 +- .../parameter/device/SamplingFrequency.java | 15 +- .../parameter/device/SynchronousUpdate.java | 8 +- .../event/EventParametersFactory.java | 18 +- .../api/parameter/event/EventType.java | 2 +- .../event/GainCallbackParameters.java | 19 +- .../PowerOverloadCallbackParameters.java | 8 +- .../event/RspDuoModeCallbackParameters.java | 8 +- .../api/parameter/tuner/DcOffsetTuner.java | 20 +- .../sdrplay/api/parameter/tuner/Gain.java | 20 +- .../api/parameter/tuner/GainValues.java | 10 +- .../api/parameter/tuner/RfFrequency.java | 10 +- .../parameter/tuner/Rsp1aTunerParameters.java | 18 +- .../parameter/tuner/Rsp2TunerParameters.java | 30 +- .../tuner/RspDuoTunerParameters.java | 16 +- .../tuner/RspDuoTunerParametersV3_07.java | 28 +- .../tuner/RspDuoTunerParametersV3_14.java | 30 +- .../parameter/tuner/RspDxTunerParameters.java | 18 +- .../api/parameter/tuner/TunerParameters.java | 36 +- .../tuner/TunerParametersFactory.java | 28 +- .../sdrplay/api/v3_07/Constants$root.java | 55 - .../sdrplay/api/v3_07/RuntimeHelper.java | 253 -- .../tuner/sdrplay/api/v3_07/constants$0.java | 90 - .../tuner/sdrplay/api/v3_07/constants$1.java | 60 - .../tuner/sdrplay/api/v3_07/constants$10.java | 47 - .../tuner/sdrplay/api/v3_07/constants$2.java | 72 - .../tuner/sdrplay/api/v3_07/constants$3.java | 72 - .../tuner/sdrplay/api/v3_07/constants$4.java | 72 - .../tuner/sdrplay/api/v3_07/constants$5.java | 87 - .../tuner/sdrplay/api/v3_07/constants$6.java | 99 - .../tuner/sdrplay/api/v3_07/constants$7.java | 69 - .../tuner/sdrplay/api/v3_07/constants$8.java | 74 - .../tuner/sdrplay/api/v3_07/constants$9.java | 84 - .../sdrplay/api/v3_07/sdrplay_api_AgcT.java | 429 ++- .../api/v3_07/sdrplay_api_ApiVersion_t.java | 69 +- .../api/v3_07/sdrplay_api_CallbackFnsT.java | 235 +- .../api/v3_07/sdrplay_api_Close_t.java | 67 +- .../api/v3_07/sdrplay_api_ControlParamsT.java | 294 +- .../api/v3_07/sdrplay_api_DcOffsetT.java | 178 +- .../api/v3_07/sdrplay_api_DcOffsetTunerT.java | 281 +- .../api/v3_07/sdrplay_api_DebugEnable_t.java | 70 +- .../api/v3_07/sdrplay_api_DecimationT.java | 228 +- .../api/v3_07/sdrplay_api_DevParamsT.java | 587 +++- .../api/v3_07/sdrplay_api_DeviceParamsT.java | 234 +- .../api/v3_07/sdrplay_api_DeviceT.java | 412 ++- .../v3_07/sdrplay_api_DisableHeartbeat_t.java | 67 +- .../api/v3_07/sdrplay_api_ErrorInfoT.java | 369 ++- .../v3_07/sdrplay_api_EventCallback_t.java | 71 +- .../api/v3_07/sdrplay_api_EventParamsT.java | 237 +- .../api/v3_07/sdrplay_api_FsFreqT.java | 231 +- .../api/v3_07/sdrplay_api_GainCbParamT.java | 229 +- .../sdrplay/api/v3_07/sdrplay_api_GainT.java | 332 +- .../api/v3_07/sdrplay_api_GainValuesT.java | 228 +- .../v3_07/sdrplay_api_GetDeviceParams_t.java | 70 +- .../api/v3_07/sdrplay_api_GetDevices_t.java | 71 +- .../v3_07/sdrplay_api_GetErrorString_t.java | 69 +- .../api/v3_07/sdrplay_api_GetLastError_t.java | 69 +- .../sdrplay/api/v3_07/sdrplay_api_Init_t.java | 71 +- .../v3_07/sdrplay_api_LockDeviceApi_t.java | 67 +- .../sdrplay/api/v3_07/sdrplay_api_Open_t.java | 67 +- .../sdrplay_api_PowerOverloadCbParamT.java | 128 +- .../v3_07/sdrplay_api_ReleaseDevice_t.java | 69 +- .../api/v3_07/sdrplay_api_ResetFlagsT.java | 228 +- .../api/v3_07/sdrplay_api_RfFreqT.java | 181 +- .../api/v3_07/sdrplay_api_Rsp1aParamsT.java | 178 +- .../v3_07/sdrplay_api_Rsp1aTunerParamsT.java | 128 +- .../api/v3_07/sdrplay_api_Rsp2ParamsT.java | 130 +- .../v3_07/sdrplay_api_Rsp2TunerParamsT.java | 284 +- .../v3_07/sdrplay_api_RspDuoModeCbParamT.java | 130 +- .../api/v3_07/sdrplay_api_RspDuoParamsT.java | 130 +- .../v3_07/sdrplay_api_RspDuoTunerParamsT.java | 334 +- .../api/v3_07/sdrplay_api_RspDxParamsT.java | 334 +- .../v3_07/sdrplay_api_RspDxTunerParamsT.java | 124 +- .../v3_07/sdrplay_api_RxChannelParamsT.java | 446 ++- .../api/v3_07/sdrplay_api_SelectDevice_t.java | 65 +- .../v3_07/sdrplay_api_StreamCallback_t.java | 69 +- .../v3_07/sdrplay_api_StreamCbParamsT.java | 324 +- .../sdrplay_api_SwapRspDuoActiveTuner_t.java | 67 +- ...i_SwapRspDuoDualTunerModeSampleRate_t.java | 65 +- .../v3_07/sdrplay_api_SwapRspDuoMode_t.java | 72 +- .../api/v3_07/sdrplay_api_SyncUpdateT.java | 174 +- .../api/v3_07/sdrplay_api_TunerParamsT.java | 388 ++- .../api/v3_07/sdrplay_api_Uninit_t.java | 65 +- .../v3_07/sdrplay_api_UnlockDeviceApi_t.java | 63 +- .../api/v3_07/sdrplay_api_Update_t.java | 68 +- .../sdrplay/api/v3_07/sdrplay_api_h.java | 2251 +++++++++---- .../sdrplay/api/v3_08/Constants$root.java | 55 - .../sdrplay/api/v3_08/RuntimeHelper.java | 253 -- .../tuner/sdrplay/api/v3_08/constants$0.java | 90 - .../tuner/sdrplay/api/v3_08/constants$1.java | 60 - .../tuner/sdrplay/api/v3_08/constants$2.java | 72 - .../tuner/sdrplay/api/v3_08/constants$3.java | 72 - .../tuner/sdrplay/api/v3_08/constants$4.java | 72 - .../tuner/sdrplay/api/v3_08/constants$5.java | 87 - .../tuner/sdrplay/api/v3_08/constants$6.java | 102 - .../sdrplay/api/v3_08/sdrplay_api_AgcT.java | 429 ++- .../api/v3_08/sdrplay_api_ApiVersion_t.java | 69 +- .../api/v3_08/sdrplay_api_CallbackFnsT.java | 235 +- .../api/v3_08/sdrplay_api_Close_t.java | 67 +- .../api/v3_08/sdrplay_api_ControlParamsT.java | 294 +- .../api/v3_08/sdrplay_api_DcOffsetT.java | 178 +- .../api/v3_08/sdrplay_api_DcOffsetTunerT.java | 281 +- .../api/v3_08/sdrplay_api_DebugEnable_t.java | 70 +- .../api/v3_08/sdrplay_api_DecimationT.java | 228 +- .../api/v3_08/sdrplay_api_DevParamsT.java | 587 +++- .../api/v3_08/sdrplay_api_DeviceParamsT.java | 234 +- .../api/v3_08/sdrplay_api_DeviceT.java | 462 ++- .../v3_08/sdrplay_api_DisableHeartbeat_t.java | 67 +- .../api/v3_08/sdrplay_api_ErrorInfoT.java | 369 ++- .../v3_08/sdrplay_api_EventCallback_t.java | 71 +- .../api/v3_08/sdrplay_api_EventParamsT.java | 237 +- .../api/v3_08/sdrplay_api_FsFreqT.java | 231 +- .../api/v3_08/sdrplay_api_GainCbParamT.java | 229 +- .../sdrplay/api/v3_08/sdrplay_api_GainT.java | 332 +- .../api/v3_08/sdrplay_api_GainValuesT.java | 228 +- .../v3_08/sdrplay_api_GetDeviceParams_t.java | 70 +- .../api/v3_08/sdrplay_api_GetDevices_t.java | 71 +- .../v3_08/sdrplay_api_GetErrorString_t.java | 69 +- .../api/v3_08/sdrplay_api_GetLastError_t.java | 69 +- .../sdrplay/api/v3_08/sdrplay_api_Init_t.java | 71 +- .../v3_08/sdrplay_api_LockDeviceApi_t.java | 67 +- .../sdrplay/api/v3_08/sdrplay_api_Open_t.java | 67 +- .../sdrplay_api_PowerOverloadCbParamT.java | 128 +- .../v3_08/sdrplay_api_ReleaseDevice_t.java | 69 +- .../api/v3_08/sdrplay_api_ResetFlagsT.java | 228 +- .../api/v3_08/sdrplay_api_RfFreqT.java | 181 +- .../api/v3_08/sdrplay_api_Rsp1aParamsT.java | 178 +- .../v3_08/sdrplay_api_Rsp1aTunerParamsT.java | 130 +- .../api/v3_08/sdrplay_api_Rsp2ParamsT.java | 130 +- .../v3_08/sdrplay_api_Rsp2TunerParamsT.java | 284 +- .../v3_08/sdrplay_api_RspDuoModeCbParamT.java | 130 +- .../api/v3_08/sdrplay_api_RspDuoParamsT.java | 130 +- .../v3_08/sdrplay_api_RspDuoTunerParamsT.java | 334 +- .../api/v3_08/sdrplay_api_RspDxParamsT.java | 328 +- .../v3_08/sdrplay_api_RspDxTunerParamsT.java | 124 +- .../v3_08/sdrplay_api_RxChannelParamsT.java | 446 ++- .../api/v3_08/sdrplay_api_SelectDevice_t.java | 65 +- .../v3_08/sdrplay_api_StreamCallback_t.java | 69 +- .../v3_08/sdrplay_api_StreamCbParamsT.java | 324 +- .../sdrplay_api_SwapRspDuoActiveTuner_t.java | 67 +- ...i_SwapRspDuoDualTunerModeSampleRate_t.java | 66 +- .../v3_08/sdrplay_api_SwapRspDuoMode_t.java | 72 +- .../api/v3_08/sdrplay_api_SyncUpdateT.java | 174 +- .../api/v3_08/sdrplay_api_TunerParamsT.java | 388 ++- .../api/v3_08/sdrplay_api_Uninit_t.java | 65 +- .../v3_08/sdrplay_api_UnlockDeviceApi_t.java | 63 +- .../api/v3_08/sdrplay_api_Update_t.java | 71 +- .../sdrplay/api/v3_08/sdrplay_api_h.java | 1213 ++++--- .../sdrplay/api/v3_14/Constants$root.java | 55 - .../sdrplay/api/v3_14/RuntimeHelper.java | 253 -- .../tuner/sdrplay/api/v3_14/constants$0.java | 89 - .../tuner/sdrplay/api/v3_14/constants$1.java | 59 - .../tuner/sdrplay/api/v3_14/constants$10.java | 74 - .../tuner/sdrplay/api/v3_14/constants$2.java | 71 - .../tuner/sdrplay/api/v3_14/constants$3.java | 71 - .../tuner/sdrplay/api/v3_14/constants$4.java | 74 - .../tuner/sdrplay/api/v3_14/constants$5.java | 80 - .../tuner/sdrplay/api/v3_14/constants$6.java | 89 - .../tuner/sdrplay/api/v3_14/constants$7.java | 88 - .../tuner/sdrplay/api/v3_14/constants$8.java | 74 - .../tuner/sdrplay/api/v3_14/constants$9.java | 78 - .../sdrplay/api/v3_14/sdrplay_api_AgcT.java | 261 -- .../api/v3_14/sdrplay_api_ApiVersion_t.java | 49 - .../api/v3_14/sdrplay_api_CallbackFnsT.java | 150 - .../api/v3_14/sdrplay_api_Close_t.java | 49 - .../api/v3_14/sdrplay_api_ControlParamsT.java | 112 - .../api/v3_14/sdrplay_api_DcOffsetT.java | 111 - .../api/v3_14/sdrplay_api_DcOffsetTunerT.java | 172 - .../api/v3_14/sdrplay_api_DebugEnable_t.java | 49 - .../api/v3_14/sdrplay_api_DecimationT.java | 141 - .../api/v3_14/sdrplay_api_DevParamsT.java | 205 -- .../api/v3_14/sdrplay_api_DeviceParamsT.java | 141 - .../api/v3_14/sdrplay_api_DeviceT.java | 238 -- .../v3_14/sdrplay_api_DisableHeartbeat_t.java | 49 - .../api/v3_14/sdrplay_api_ErrorInfoT.java | 96 - .../v3_14/sdrplay_api_EventCallback_t.java | 49 - .../api/v3_14/sdrplay_api_EventParamsT.java | 73 - .../api/v3_14/sdrplay_api_FsFreqT.java | 142 - .../api/v3_14/sdrplay_api_GainCbParamT.java | 141 - .../sdrplay/api/v3_14/sdrplay_api_GainT.java | 181 -- .../api/v3_14/sdrplay_api_GainValuesT.java | 141 - .../v3_14/sdrplay_api_GetDeviceParams_t.java | 49 - .../api/v3_14/sdrplay_api_GetDevices_t.java | 49 - .../v3_14/sdrplay_api_GetErrorString_t.java | 49 - .../sdrplay_api_GetLastErrorByType_t.java | 49 - .../api/v3_14/sdrplay_api_GetLastError_t.java | 49 - .../sdrplay/api/v3_14/sdrplay_api_Init_t.java | 49 - .../v3_14/sdrplay_api_LockDeviceApi_t.java | 49 - .../sdrplay/api/v3_14/sdrplay_api_Open_t.java | 49 - .../sdrplay_api_PowerOverloadCbParamT.java | 81 - .../v3_14/sdrplay_api_ReleaseDevice_t.java | 49 - .../api/v3_14/sdrplay_api_ResetFlagsT.java | 141 - .../api/v3_14/sdrplay_api_RfFreqT.java | 112 - .../api/v3_14/sdrplay_api_Rsp1aParamsT.java | 111 - .../v3_14/sdrplay_api_Rsp1aTunerParamsT.java | 81 - .../api/v3_14/sdrplay_api_Rsp2ParamsT.java | 81 - .../v3_14/sdrplay_api_Rsp2TunerParamsT.java | 173 - .../v3_14/sdrplay_api_RspDuoModeCbParamT.java | 81 - .../api/v3_14/sdrplay_api_RspDuoParamsT.java | 81 - .../v3_14/sdrplay_api_RspDuoTunerParamsT.java | 211 -- .../sdrplay_api_RspDuo_ResetSlaveFlagsT.java | 111 - .../api/v3_14/sdrplay_api_RspDxParamsT.java | 203 -- .../v3_14/sdrplay_api_RspDxTunerParamsT.java | 81 - .../v3_14/sdrplay_api_RxChannelParamsT.java | 155 - .../api/v3_14/sdrplay_api_SelectDevice_t.java | 49 - .../v3_14/sdrplay_api_StreamCallback_t.java | 49 - .../v3_14/sdrplay_api_StreamCbParamsT.java | 201 -- .../sdrplay_api_SwapRspDuoActiveTuner_t.java | 49 - ...i_SwapRspDuoDualTunerModeSampleRate_t.java | 49 - .../v3_14/sdrplay_api_SwapRspDuoMode_t.java | 49 - .../api/v3_14/sdrplay_api_SyncUpdateT.java | 111 - .../api/v3_14/sdrplay_api_TunerParamsT.java | 179 -- .../api/v3_14/sdrplay_api_Uninit_t.java | 49 - .../v3_14/sdrplay_api_UnlockDeviceApi_t.java | 49 - .../api/v3_14/sdrplay_api_Update_t.java | 49 - .../sdrplay/api/v3_14/sdrplay_api_h.java | 1735 ---------- .../sdrplay/api/v3_15/sdrplay_api_AgcT.java | 423 +++ .../api/v3_15/sdrplay_api_ApiVersion_t.java | 83 + .../api/v3_15/sdrplay_api_CallbackFnsT.java | 238 ++ .../api/v3_15/sdrplay_api_Close_t.java | 81 + .../api/v3_15/sdrplay_api_ControlParamsT.java | 285 ++ .../api/v3_15/sdrplay_api_DcOffsetT.java | 192 ++ .../api/v3_15/sdrplay_api_DcOffsetTunerT.java | 286 ++ .../api/v3_15/sdrplay_api_DebugEnable_t.java | 84 + .../api/v3_15/sdrplay_api_DecimationT.java | 238 ++ .../api/v3_15/sdrplay_api_DevParamsT.java | 563 ++++ .../api/v3_15/sdrplay_api_DeviceParamsT.java | 238 ++ .../api/v3_15/sdrplay_api_DeviceT.java | 463 +++ .../v3_15/sdrplay_api_DisableHeartbeat_t.java | 81 + .../api/v3_15/sdrplay_api_ErrorInfoT.java | 386 +++ .../v3_15/sdrplay_api_EventCallback_t.java | 85 + .../api/v3_15/sdrplay_api_EventParamsT.java | 237 ++ .../api/v3_15/sdrplay_api_FsFreqT.java | 240 ++ .../api/v3_15/sdrplay_api_GainCbParamT.java | 239 ++ .../sdrplay/api/v3_15/sdrplay_api_GainT.java | 332 ++ .../api/v3_15/sdrplay_api_GainValuesT.java | 238 ++ .../v3_15/sdrplay_api_GetDeviceParams_t.java | 84 + .../api/v3_15/sdrplay_api_GetDevices_t.java | 85 + .../v3_15/sdrplay_api_GetErrorString_t.java | 83 + .../sdrplay_api_GetLastErrorByType_t.java | 85 + .../api/v3_15/sdrplay_api_GetLastError_t.java | 83 + .../sdrplay/api/v3_15/sdrplay_api_Init_t.java | 85 + .../v3_15/sdrplay_api_LockDeviceApi_t.java | 81 + .../sdrplay/api/v3_15/sdrplay_api_Open_t.java | 81 + .../sdrplay_api_PowerOverloadCbParamT.java | 146 + .../v3_15/sdrplay_api_ReleaseDevice_t.java | 83 + .../api/v3_15/sdrplay_api_ResetFlagsT.java | 238 ++ .../api/v3_15/sdrplay_api_RfFreqT.java | 194 ++ .../api/v3_15/sdrplay_api_Rsp1aParamsT.java | 192 ++ .../v3_15/sdrplay_api_Rsp1aTunerParamsT.java | 146 + .../api/v3_15/sdrplay_api_Rsp2ParamsT.java | 146 + .../v3_15/sdrplay_api_Rsp2TunerParamsT.java | 287 ++ .../v3_15/sdrplay_api_RspDuoModeCbParamT.java | 146 + .../api/v3_15/sdrplay_api_RspDuoParamsT.java | 146 + .../v3_15/sdrplay_api_RspDuoTunerParamsT.java | 379 +++ .../sdrplay_api_RspDuo_ResetSlaveFlagsT.java | 192 ++ .../api/v3_15/sdrplay_api_RspDxParamsT.java | 333 ++ .../v3_15/sdrplay_api_RspDxTunerParamsT.java | 146 + .../v3_15/sdrplay_api_RxChannelParamsT.java | 376 +++ .../api/v3_15/sdrplay_api_SelectDevice_t.java | 83 + .../v3_15/sdrplay_api_StreamCallback_t.java | 87 + .../v3_15/sdrplay_api_StreamCbParamsT.java | 330 ++ .../sdrplay_api_SwapRspDuoActiveTuner_t.java | 85 + ...i_SwapRspDuoDualTunerModeSampleRate_t.java | 84 + .../v3_15/sdrplay_api_SwapRspDuoMode_t.java | 90 + .../api/v3_15/sdrplay_api_SyncUpdateT.java | 192 ++ .../api/v3_15/sdrplay_api_TunerParamsT.java | 378 +++ .../api/v3_15/sdrplay_api_Uninit_t.java | 83 + .../v3_15/sdrplay_api_UnlockDeviceApi_t.java | 81 + .../api/v3_15/sdrplay_api_Update_t.java | 86 + .../sdrplay/api/v3_15/sdrplay_api_h.java | 2821 +++++++++++++++++ .../vector/calibrate/CalibrationManager.java | 31 +- 335 files changed, 30527 insertions(+), 17943 deletions(-) delete mode 100644 artifacts/sdrplay-api-headers/README.txt delete mode 100644 artifacts/sdrplay-api-headers/v3_11/sdrplay_api.h delete mode 100644 artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rspDuo.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_callback.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_control.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_dev.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rsp1a.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rsp2.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rspDx.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rx_channel.h delete mode 100644 artifacts/sdrplay-api-headers/v3_14/sdrplay_api_tuner.h rename artifacts/sdrplay-api-headers/{v3_14 => v3_15}/sdrplay_api.h (99%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_callback.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_control.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_dev.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_rsp1a.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_rsp2.h (100%) rename artifacts/sdrplay-api-headers/{v3_14 => v3_15}/sdrplay_api_rspDuo.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_rspDx.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_rx_channel.h (100%) rename artifacts/sdrplay-api-headers/{v3_11 => v3_15}/sdrplay_api_tuner.h (100%) create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayLibraryHelper.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/Constants$root.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/RuntimeHelper.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$0.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$1.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$10.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$2.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$3.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$4.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$5.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$6.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$7.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$8.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$9.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/Constants$root.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/RuntimeHelper.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$0.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$1.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$2.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$3.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$4.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$5.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$6.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/Constants$root.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/RuntimeHelper.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$0.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$1.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$10.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$2.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$3.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$4.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$5.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$6.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$7.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$8.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$9.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_AgcT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ApiVersion_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_CallbackFnsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Close_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ControlParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetTunerT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DebugEnable_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DecimationT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DevParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DisableHeartbeat_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ErrorInfoT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventCallback_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_FsFreqT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainCbParamT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainValuesT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDeviceParams_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDevices_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetErrorString_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastErrorByType_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastError_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Init_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_LockDeviceApi_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Open_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_PowerOverloadCbParamT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ReleaseDevice_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ResetFlagsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RfFreqT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aTunerParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2ParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2TunerParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoModeCbParamT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoTunerParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuo_ResetSlaveFlagsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxTunerParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RxChannelParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SelectDevice_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCallback_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCbParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoActiveTuner_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoMode_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SyncUpdateT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_TunerParamsT.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Uninit_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_UnlockDeviceApi_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Update_t.java delete mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_h.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_AgcT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ApiVersion_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_CallbackFnsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Close_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ControlParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetTunerT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DebugEnable_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DecimationT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DevParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DisableHeartbeat_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ErrorInfoT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventCallback_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_FsFreqT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainCbParamT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainValuesT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDeviceParams_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDevices_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetErrorString_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastErrorByType_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastError_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Init_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_LockDeviceApi_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Open_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_PowerOverloadCbParamT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ReleaseDevice_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ResetFlagsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RfFreqT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aTunerParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2ParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2TunerParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoModeCbParamT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoTunerParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuo_ResetSlaveFlagsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxTunerParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RxChannelParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SelectDevice_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCallback_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCbParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoActiveTuner_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoMode_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SyncUpdateT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_TunerParamsT.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Uninit_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_UnlockDeviceApi_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Update_t.java create mode 100644 src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_h.java diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index dc116e13d..1e351def2 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -22,10 +22,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 20 + - name: Set up JDK 22 uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '22' distribution: 'liberica' java-package: 'jdk+fx' - name: Build with Gradle diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 0775d0da1..21044b7af 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -15,10 +15,10 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Set up JDK 20 + - name: Set up JDK 22 uses: actions/setup-java@v3 with: - java-version: '20' + java-version: '22' distribution: 'liberica' java-package: 'jdk+fx' diff --git a/.idea/misc.xml b/.idea/misc.xml index 769598250..f0f78df64 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -4,7 +4,7 @@ - + \ No newline at end of file diff --git a/artifacts/sdrplay-api-headers/README.txt b/artifacts/sdrplay-api-headers/README.txt deleted file mode 100644 index cdd9f44e7..000000000 --- a/artifacts/sdrplay-api-headers/README.txt +++ /dev/null @@ -1,40 +0,0 @@ -Auto-generating Java code from SDRPlay API using jextract. - -Note: the api headers in the 3.11 folder are equivalent to the 3.08 headers. The only -difference from the 3.07 headers is the addition of the boolean 'valid' flag to DeviceT structure. - -1. Download JDK19 compatible build of jextract JDK: https://jdk.java.net/jextract/ -2. If generating on windows platform, modify the sdrplay_api.h to remove the windows - pieces of the file. Specifically: -2a. Comment out these lines but leave the *HANDLE typedef: - -//#if defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64) -//#include "windows.h" -//#elif defined (__GNUC__) -typedef void *HANDLE; -//#endif - -//#ifndef _SDRPLAY_DLL_QUALIFIER -//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64)) -//#define _SDRPLAY_DLL_QUALIFIER __declspec(dllimport) -//#elif defined(STATIC_LIB) || defined(__GNUC__) -//#define _SDRPLAY_DLL_QUALIFIER -//#endif -//#endif // _SDRPLAY_DLL_QUALIFIER - -2b. Remove the '_SDRPLAY_DLL_QUALIFIER' from in front of the method declarations - -2c. Change the 3.11 version string to 3.08 either in the header file, or in the generated java class - -3. Open command prompt to the root source code where the generated files should be placed: -..\SDRtrunk\sdrplay-api\src\main\java - -4. Generate the code: -Windows: -c:\Users\Denny\Downloads\jdk-19-ea2-panama\bin\jextract "C:\Users\Denny\git\sdrtrunk\sdrplay-api\api\v3_11\sdrplay_api.h" -l libsdrplay_api --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_14 - -Linux: -~/Downloads/jextract-20/bin/jextract ~/IdeaProjects/sdrtrunk/artifacts/sdrplay-api-headers/v3_14/sdrplay_api.h -l libsdrplay_api --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_14 - -5. Compare the 3.07 header files to the newest version header files. Delete any auto-generated files that have not -changed and then update the factory class to construct variation classes where there are differences. diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api.h b/artifacts/sdrplay-api-headers/v3_11/sdrplay_api.h deleted file mode 100644 index f3400d88a..000000000 --- a/artifacts/sdrplay-api-headers/v3_11/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) || defined(_M_ARM64) -//#include "windows.h" -//#elif defined (__GNUC__) -typedef void *HANDLE; -//#endif - -//#ifndef _SDRPLAY_DLL_QUALIFIER -//#if !defined(STATIC_LIB) && (defined(_M_X64) || defined(_M_IX86) || defined(_M_ARM64)) -//#define _SDRPLAY_DLL_QUALIFIER __declspec(dllimport) -//#elif defined(STATIC_LIB) || defined(__GNUC__) -//#define _SDRPLAY_DLL_QUALIFIER -//#endif -//#endif // _SDRPLAY_DLL_QUALIFIER - -// Application code should check that it is compiled against the same API version -// sdrplay_api_ApiVersion() returns the API version -#define SDRPLAY_API_VERSION (float)(3.11) - -// API Constants -#define SDRPLAY_MAX_DEVICES (16) -#define SDRPLAY_MAX_TUNERS_PER_DEVICE (2) - -#define SDRPLAY_MAX_SER_NO_LEN (64) -#define SDRPLAY_MAX_ROOT_NM_LEN (32) - -#define SDRPLAY_RSP1_ID (1) -#define SDRPLAY_RSP1A_ID (255) -#define SDRPLAY_RSP2_ID (2) -#define SDRPLAY_RSPduo_ID (3) -#define SDRPLAY_RSPdx_ID (4) - -// Enum types -typedef enum -{ - sdrplay_api_Success = 0, - sdrplay_api_Fail = 1, - sdrplay_api_InvalidParam = 2, - sdrplay_api_OutOfRange = 3, - sdrplay_api_GainUpdateError = 4, - sdrplay_api_RfUpdateError = 5, - sdrplay_api_FsUpdateError = 6, - sdrplay_api_HwError = 7, - sdrplay_api_AliasingError = 8, - sdrplay_api_AlreadyInitialised = 9, - sdrplay_api_NotInitialised = 10, - sdrplay_api_NotEnabled = 11, - sdrplay_api_HwVerError = 12, - sdrplay_api_OutOfMemError = 13, - sdrplay_api_ServiceNotResponding = 14, - sdrplay_api_StartPending = 15, - sdrplay_api_StopPending = 16, - sdrplay_api_InvalidMode = 17, - sdrplay_api_FailedVerification1 = 18, - sdrplay_api_FailedVerification2 = 19, - sdrplay_api_FailedVerification3 = 20, - sdrplay_api_FailedVerification4 = 21, - sdrplay_api_FailedVerification5 = 22, - sdrplay_api_FailedVerification6 = 23, - sdrplay_api_InvalidServiceVersion = 24 -} sdrplay_api_ErrT; - -typedef enum -{ - sdrplay_api_Update_None = 0x00000000, - - // Reasons for master only mode - sdrplay_api_Update_Dev_Fs = 0x00000001, - sdrplay_api_Update_Dev_Ppm = 0x00000002, - sdrplay_api_Update_Dev_SyncUpdate = 0x00000004, - sdrplay_api_Update_Dev_ResetFlags = 0x00000008, - - sdrplay_api_Update_Rsp1a_BiasTControl = 0x00000010, - sdrplay_api_Update_Rsp1a_RfNotchControl = 0x00000020, - sdrplay_api_Update_Rsp1a_RfDabNotchControl = 0x00000040, - - sdrplay_api_Update_Rsp2_BiasTControl = 0x00000080, - sdrplay_api_Update_Rsp2_AmPortSelect = 0x00000100, - sdrplay_api_Update_Rsp2_AntennaControl = 0x00000200, - sdrplay_api_Update_Rsp2_RfNotchControl = 0x00000400, - sdrplay_api_Update_Rsp2_ExtRefControl = 0x00000800, - - sdrplay_api_Update_RspDuo_ExtRefControl = 0x00001000, - - sdrplay_api_Update_Master_Spare_1 = 0x00002000, - sdrplay_api_Update_Master_Spare_2 = 0x00004000, - - // Reasons for master and slave mode - // Note: sdrplay_api_Update_Tuner_Gr MUST be the first value defined in this section! - sdrplay_api_Update_Tuner_Gr = 0x00008000, - sdrplay_api_Update_Tuner_GrLimits = 0x00010000, - sdrplay_api_Update_Tuner_Frf = 0x00020000, - sdrplay_api_Update_Tuner_BwType = 0x00040000, - sdrplay_api_Update_Tuner_IfType = 0x00080000, - sdrplay_api_Update_Tuner_DcOffset = 0x00100000, - sdrplay_api_Update_Tuner_LoMode = 0x00200000, - - sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 0x00400000, - sdrplay_api_Update_Ctrl_Decimation = 0x00800000, - sdrplay_api_Update_Ctrl_Agc = 0x01000000, - sdrplay_api_Update_Ctrl_AdsbMode = 0x02000000, - sdrplay_api_Update_Ctrl_OverloadMsgAck = 0x04000000, - - sdrplay_api_Update_RspDuo_BiasTControl = 0x08000000, - sdrplay_api_Update_RspDuo_AmPortSelect = 0x10000000, - sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 0x20000000, - sdrplay_api_Update_RspDuo_RfNotchControl = 0x40000000, - sdrplay_api_Update_RspDuo_RfDabNotchControl = 0x80000000, -} sdrplay_api_ReasonForUpdateT; - -typedef enum -{ - sdrplay_api_Update_Ext1_None = 0x00000000, - - // Reasons for master only mode - sdrplay_api_Update_RspDx_HdrEnable = 0x00000001, - sdrplay_api_Update_RspDx_BiasTControl = 0x00000002, - sdrplay_api_Update_RspDx_AntennaControl = 0x00000004, - sdrplay_api_Update_RspDx_RfNotchControl = 0x00000008, - sdrplay_api_Update_RspDx_RfDabNotchControl = 0x00000010, - sdrplay_api_Update_RspDx_HdrBw = 0x00000020, - - // Reasons for master and slave mode -} sdrplay_api_ReasonForUpdateExtension1T; - -typedef enum -{ - sdrplay_api_DbgLvl_Disable = 0, - sdrplay_api_DbgLvl_Verbose = 1, - sdrplay_api_DbgLvl_Warning = 2, - sdrplay_api_DbgLvl_Error = 3, - sdrplay_api_DbgLvl_Message = 4, -} sdrplay_api_DbgLvl_t; - -// Device structure -typedef struct -{ - char SerNo[SDRPLAY_MAX_SER_NO_LEN]; - unsigned char hwVer; - sdrplay_api_TunerSelectT tuner; - sdrplay_api_RspDuoModeT rspDuoMode; - unsigned char valid; - double rspDuoSampleFreq; - HANDLE dev; -} sdrplay_api_DeviceT; - -// Device parameter structure -typedef struct -{ - sdrplay_api_DevParamsT *devParams; - sdrplay_api_RxChannelParamsT *rxChannelA; - sdrplay_api_RxChannelParamsT *rxChannelB; -} sdrplay_api_DeviceParamsT; - -// Extended error message structure -typedef struct -{ - char file[256]; - char function[256]; - int line; - char message[1024]; -} sdrplay_api_ErrorInfoT; - -// Comman API function types -typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void); -typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void); -typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *apiVer); -typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void); -typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void); -typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs); -typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *device); -typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *device); -typedef const char* (*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT err); -typedef sdrplay_api_ErrorInfoT* (*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *device); -typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void); - -// Device API function types -typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE dev, sdrplay_api_DbgLvl_t dbgLvl); -typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams); -typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext); -typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE dev); -typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1); -typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE dev, sdrplay_api_TunerSelectT *tuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); -typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *currentSampleRate, double newSampleRate); -typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoMode_t)(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams, - sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner, - sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); - -// API function definitions -#ifdef __cplusplus -extern "C" -{ -#endif - - // Comman API function definitions - sdrplay_api_ErrT sdrplay_api_Open(void); - sdrplay_api_ErrT sdrplay_api_Close(void); - sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer); - sdrplay_api_ErrT sdrplay_api_LockDeviceApi(void); - sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(void); - sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT *devices, unsigned int *numDevs, unsigned int maxDevs); - sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT *device); - sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT *device); - const char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err); - sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT *device); - sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(void); // Must be called before sdrplay_api_SelectDevice() - - // Device API function definitions - sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable); - sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT **deviceParams); - sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT *callbackFns, void *cbContext); - sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev); - sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1); - sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT *currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); - sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double *currentSampleRate, double newSampleRate); - sdrplay_api_ErrT sdrplay_api_SwapRspDuoMode(sdrplay_api_DeviceT *currDevice, sdrplay_api_DeviceParamsT **deviceParams, - sdrplay_api_RspDuoModeT rspDuoMode, double sampleRate, sdrplay_api_TunerSelectT tuner, - sdrplay_api_Bw_MHzT bwType, sdrplay_api_If_kHzT ifType, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); - -#ifdef __cplusplus -} -#endif - -#endif //SDRPLAY_API_H diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rspDuo.h b/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rspDuo.h deleted file mode 100644 index 3c4566350..000000000 --- a/artifacts/sdrplay-api-headers/v3_11/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_14/sdrplay_api_callback.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_callback.h deleted file mode 100644 index 0da80502a..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_control.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_control.h deleted file mode 100644 index 5a52a1046..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_dev.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_dev.h deleted file mode 100644 index 5ac99ae25..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_rsp1a.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rsp1a.h deleted file mode 100644 index 3affbcc3e..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_rsp2.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rsp2.h deleted file mode 100644 index 930d3e956..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_rspDx.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rspDx.h deleted file mode 100644 index 0528de96c..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_rx_channel.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rx_channel.h deleted file mode 100644 index 010080402..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api_tuner.h b/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_tuner.h deleted file mode 100644 index a5c446d61..000000000 --- a/artifacts/sdrplay-api-headers/v3_14/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_14/sdrplay_api.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h similarity index 99% rename from artifacts/sdrplay-api-headers/v3_14/sdrplay_api.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h index e9e9fa45f..2844e21aa 100644 --- a/artifacts/sdrplay-api-headers/v3_14/sdrplay_api.h +++ b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api.h @@ -21,7 +21,7 @@ typedef void *HANDLE; // Application code should check that it is compiled against the same API version // sdrplay_api_ApiVersion() returns the API version -#define SDRPLAY_API_VERSION (float)(3.14) +#define SDRPLAY_API_VERSION (float)(3.15) // API Constants #define SDRPLAY_MAX_DEVICES (16) @@ -36,6 +36,7 @@ typedef void *HANDLE; #define SDRPLAY_RSPduo_ID (3) #define SDRPLAY_RSPdx_ID (4) #define SDRPLAY_RSP1B_ID (6) +#define SDRPLAY_RSPdxR2_ID (7) // Enum types typedef enum diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_callback.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_callback.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_callback.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_callback.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_control.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_control.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_control.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_control.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_dev.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_dev.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_dev.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_dev.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rsp1a.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp1a.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rsp1a.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp1a.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rsp2.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp2.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rsp2.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rsp2.h diff --git a/artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rspDuo.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDuo.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_14/sdrplay_api_rspDuo.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDuo.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rspDx.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDx.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rspDx.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rspDx.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rx_channel.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rx_channel.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_rx_channel.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_rx_channel.h diff --git a/artifacts/sdrplay-api-headers/v3_11/sdrplay_api_tuner.h b/artifacts/sdrplay-api-headers/v3_15/sdrplay_api_tuner.h similarity index 100% rename from artifacts/sdrplay-api-headers/v3_11/sdrplay_api_tuner.h rename to artifacts/sdrplay-api-headers/v3_15/sdrplay_api_tuner.h diff --git a/build.gradle b/build.gradle index 73b294e3e..5f42f376b 100644 --- a/build.gradle +++ b/build.gradle @@ -25,8 +25,8 @@ import java.text.SimpleDateFormat * Instructions for building/compiling the sdrtrunk application. * * Prerequisites: - * Install and configure an OpenJDK version 19+ that includes the JavaFX modules (e.g. Bellsoft Liberica JDK) - * - Optional: install and configure Gradle 7.6+ + * Install and configure an OpenJDK version 22+ that includes the JavaFX modules (e.g. Bellsoft Liberica JDK) + * - Optional: install and configure Gradle 8.10+ * * Scenario 1: run the application via gradle command line from the source code root directory: * command: ./gradlew run @@ -58,10 +58,10 @@ repositories { //Version is defined in gradle.properties so that we can CLI override it for nightly builds. version = project.findProperty('projectVersion') -//Java 20 is required for this version of the Project Panama preview/incubator feature +//Java 22 is required for this version of the Project Panama preview/incubator feature java { toolchain { - languageVersion = JavaLanguageVersion.of(20) + languageVersion = JavaLanguageVersion.of(22) } } @@ -90,8 +90,8 @@ dependencies { implementation 'com.github.nwaldispuehl:java-lame:v3.98.4' //mavenCentral/jcenter imports - implementation 'ch.qos.logback:logback-classic:1.4.5' - implementation 'ch.qos.logback:logback-core:1.4.5' + implementation 'ch.qos.logback:logback-classic:1.4.12' + implementation 'ch.qos.logback:logback-core:1.4.14' implementation 'com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.14.0' implementation 'com.fazecast:jSerialComm:2.9.3' implementation 'com.github.jiconfont:jiconfont-font_awesome:4.7.0.1' @@ -99,7 +99,7 @@ dependencies { implementation 'com.github.jiconfont:jiconfont-swing:1.0.1' implementation 'com.github.wendykierp:JTransforms:3.1' implementation 'com.google.code.gson:gson:2.10' - implementation 'com.google.guava:guava:31.1-jre' + implementation 'com.google.guava:guava:33.3.0-jre' implementation 'com.jidesoft:jide-oss:3.6.18' implementation 'com.miglayout:miglayout-swing:11.0' implementation 'com.mpatric:mp3agic:0.9.1' @@ -108,7 +108,7 @@ dependencies { implementation 'io.github.dsheirer:radio-reference-api:18.0.0' implementation 'javax.usb:usb-api:1.0.2' implementation 'net.coderazzi:tablefilter-swing:5.5.4' - implementation 'org.apache.commons:commons-compress:1.21' + implementation 'org.apache.commons:commons-compress:1.26.0' implementation 'org.apache.commons:commons-lang3:3.12.0' implementation 'org.apache.commons:commons-math3:3.6.1' implementation 'org.apache.commons:commons-csv:1.9.0' @@ -127,11 +127,11 @@ dependencies { def os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem /** - * This is needed for the JDK19 panama and vector API ... until it moves out of incubation or preview + * This is needed for the JDK22 vector API ... until it moves out of incubation or preview */ tasks.withType(JavaCompile) { - options.compilerArgs.add("--enable-preview") //Panama Foreign Function/Memory is preview in JDK 19 - options.compilerArgs.add("--add-modules=jdk.incubator.vector") //Needed while Panama Vector API remains in incubator + options.compilerArgs.add("--enable-preview") //Project Panama Vector API is still in incubator + options.compilerArgs.add("--add-modules=jdk.incubator.vector") //Project Panama Vector API is still in incubator } /** @@ -140,10 +140,10 @@ tasks.withType(JavaCompile) { def jvmArgsWindows = ['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED', //Needed for controls-fx.jar '--add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED', //windows users for JIDE - '--add-modules=jdk.incubator.vector', //Needed while Project Panama API is still in incubator - '--enable-preview', //Project Panama Vector & Foreign Function APIs remain in incubator - '--enable-native-access=ALL-UNNAMED', - '-Djava.library.path=c:\\Program Files\\SDRplay\\API\\x64'] //Allows Project Panama Foreign Function access to system library + '--add-modules=jdk.incubator.vector', //Project Panama Vector API is still in incubator + '--enable-preview', //Project Panama Vector API is still in incubator + '--enable-native-access=ALL-UNNAMED', //Suppress unsafe warnings for FFM API Foreign Memory calls + '-Djava.library.path=c:\\Program Files\\SDRplay\\API\\x64'] //SDRPlay API library path /** * JVM Arguments for running the application on Linux. @@ -152,8 +152,7 @@ def jvmArgsLinux = ['--add-exports=javafx.base/com.sun.javafx.event=ALL-UNNAMED', //Needed for controls-fx.jar '--add-modules=jdk.incubator.vector', //Needed while Project Panama API is still in incubator '--enable-preview', //Project Panama Vector & Foreign Function APIs remain in incubator - '--enable-native-access=ALL-UNNAMED', - '-Djava.library.path=/usr/local/lib'] //Allows Project Panama Foreign Function access to system library + '--enable-native-access=ALL-UNNAMED'] //SDRPlay API library path application { mainClassName = "io.github.dsheirer.gui.SDRTrunk" @@ -200,16 +199,16 @@ String targetWindowsX86_64 = 'windows-x86_64-v' + version * author's development environment, but can be changed to your environment if you want to use this build pattern. */ String jdk_base = '/home/denny/java_jdks/' -String jdk_linux_aarch64 = jdk_base + 'linux-arm64/jdk-20.0.1-full' -String jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-20.0.1-full' -String jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-20.0.1-full.jdk' -String jdk_osx_aarch64 = jdk_base + 'osx-arm64/jdk-20.0.1-full.jdk' -String jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-20.0.1-full' +String jdk_linux_aarch64 = jdk_base + 'linux-arm64/jdk-22.0.2-full' +String jdk_linux_x86_64 = jdk_base + 'linux-x64/jdk-22.0.2-full' +String jdk_osx_x86_64 = jdk_base + 'osx-x64/jdk-22.0.2-full.jdk' +String jdk_osx_aarch64 = jdk_base + 'osx-arm64/jdk-22.0.2-full.jdk' +String jdk_windows_x86_64 = jdk_base + 'windows-x64/jdk-22.0.2-full' /** * Download URLs to download the JDK as part of the gradle build packaging process */ -def jdk_download_base = "https://download.bell-sw.com/java/20.0.1+10/bellsoft-jdk20.0.1+10-" +def jdk_download_base = "https://download.bell-sw.com/java/22.0.2+11/bellsoft-jdk22.0.2+11-" def jdk_download_suffix = "-full.tar.gz" def jdk_download_linux_aarch64 = jdk_download_base + "linux-aarch64" + jdk_download_suffix def jdk_download_linux_x86_64 = jdk_download_base + "linux-amd64" + jdk_download_suffix diff --git a/gradle.properties b/gradle.properties index 1a69b9227..24645b0a3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -28,4 +28,4 @@ # tag name, specifically the dashes inserted before and after the alpha/beta labels. # See: https://github.com/DSheirer/sdrtrunk/issues/1651 -projectVersion=0.6.1-beta-1 \ No newline at end of file +projectVersion=0.6.1-beta-2 \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 943f0cbfa754578e88a3dae77fce6e3dea56edbf..033e24c4cdf41af1ab109bc7f253b2b887023340 100644 GIT binary patch delta 26632 zcmY(q1CS;`vo1WgZQIt4ZQHi(cgN;Cw(Xf6+dH;BJ2rNVyWctI|L;8!9bH*ji0 zd@?Ja3f~7$xB-V$mIH^t0D>Z5CgGujVk9xSfc{qv83F_Z#L3l)864#Q_E^XK??xa5 zC?P0DGa0BO+&@JUywiWFrT?eV2m$wBqYpwf*uMe-xdGyzK5!4Wc?R7d^q;u>Pc+Ar z{3kY7V@W{$)7%l9|GV$(<2L^#j0XRw|4DlPpRsNfn*YW&PteqXVPk-Rz`*=_BoPq) za(Fp7Xb=!@R1gpWpa~`+5Sa)XICDq~8Pe?7UxJd_5yu2|~_=yWmbXC`e-Tr8O8x(zdt)iZ1s^ zXT*Y`b0c!6_()7xz{Ccba97RRV&N!!I5C2BK;eg`9)HI2t$mzHOaHDIwTAG^XxEY? zCrY`)|43^CP#-dVtYXuqdPYscy5glEPdB5Mm@dpK<<(bb5$-V$X%ONoA z);JlOSAQV_3EtsVxK5N$n19fOg@s=D9(fdNrfWMS zp)S56N;Ut9i8Uq%aXXm~$tFrm9;U0*XFTw-<1%~IZu5mF-R~cjnc$3ofsRd`ZQUV` zEzh9hzwF|*JgOr>nd|%Me_=!UY9VqRk(wV%!aYx)wm0G_RH{rh_2r&yS_gJPS^ps6 zL1_G?TEycFsK1{xQrij|EDFuB&m?>jww2~K2-3SKAMCO(D~z+o4bV_qhMgiCeYtjY z;NjV}j}No#5_ls@*GJU`7z&wXH$%I7g&dnJsp|G!8s0cl@a8Pxma;J)(YP^sDYtP$ zmlh%T?aKocW%6m~k(xvY+0pV+Z*%(7g+6oWXSUCeEPm%5@weR1jSj&PX}S_Bih+af z*p*(k2WAfh)#eQ@PMsAPGX@R}J%BwlEpMA_ZWuDT?D&cd#Az1;3P2g*(uy?-Cjnu> zsqG>IRKpN>OjnA0uq!uF7b5Cf5St1z8(N=wsj96{ci3%aJt+Hgk(PW*}s9Lwj2?@-Gj^Oq3*V1vWdrv<}12wvu^u=R+ddk zpzaLAOnW*i3CTEh)?vFDxqc%#!&5+Zzs`NeIT2sY>x+t#v9&=-a8^>X(v~<6Drkcw5mA%yj4)) zCq{P+I^2$#@mKuw1K5F9axjn}M(ss-FapfBu~YRHbrix8&^~yfTHufsmPgIe22yJy z$sI0yC_iCfeD>(b+F95Pxps8kdaTRU0~x*ADZI_$DDbUX*p)HLGU6*;TgKNVHAEOABhJuhs|n3O@0%O&Pe6x}H$#by&{i3j7M_uF~J z&BlnU_QMShV4v#=-=3_O*|phe{|T$FVT6(k$4InFXeDzoapWH7HPga~xy1W=tHu_! zV+Y~Lm*0vBqkQMdUAk*jb+Mo~&PrsS4IyK68(JeasonlOXrO57(c zP&{?Mn}bfVn8FvU^s^ilPfVx91YzI$5U0d?5r=FZQk+5P=Kr+Mj6*=7n5Yw1I}0KbV(#5_Ka ziWd_M4YN|2H!2Mk9H{wPIF*8V4vbwdXFbs$;-OpIbSrmU?5r^X)1X`vjXut$h%4Qp zwS_^9G)o+Ix&Lrrz`Q9i$PrHWp8X;6%Spfu5KOcczWKWiu?4Bn{Ekf5%fxK&%5&DQ zAnj7-u>G6_tKkS13>upCf}!di_b5Mi%FC3C*vS8oKmTzeLbJB2m3^lyrT5 zzb^jt6b5Wf?)Wg(l)DR+lnRA1#Y^q}WXyJ`L!|XCODptz)}d`J^q*x59g=sk-c(3l zKw{JW?O4T~7uKjhq)_?TI#1ml)~1-$qA`PPgq6$wt^C~l{5DUJ-Fnb#OS|G8f8C9Z zHQreAA$H%x@{*!*Y?HrM`Rlpw8mVcmP~e@OZkpA;133c8j7c6(g2n;y8i`;Cso6*s=H(OpiZBlODaJ)9jg%|7T8yQ`}}ktIq!b{hIZ{f2RBAWdQqa@%~4;wI%<5V4Zk| zOuh>o1SARy1cV)UXG;K3HgUIBcQx^}aCI}W7qhl7v$JqzGP5^vb4yj%)56!l_zH)x zgb`y_YlNhe^bL~V#Pt=CD{RS7tu3SF5-yc6h;Yuz@nl1v&H2gydXP^7=ua1{K&F*T zf4fd_?UpGhT z4@VoNP&o!lb+N+({LH^)8j*l8G7%g97bBC_x~4E%IZCQd!%WHCb399J6&cqaHkr;H zeX;}emJQMjsXu;QtZ%| z^CLN#tY+%ui;=9KrP0gxEL<)+HGkLYFH(mYnIZh{Fz#8{!&<*LFB~SiiNBPzp=Qz+ zeG{RIiL7{GkO-;}+P-HCKD7?nyF9J!I9ne*$BcD7jzAnhtTQ4`ISS7RyOBgy&IG4& zn7#w=W(Kbsz7HpCL=uHzd89jT(R+53!xf6kNUaweqI)oyQpaY=yCSWR{=ql9nA?LX zZz7sU4n!wy*~BW7L2CqQHo0_bQj$%Nx=1HiB%$eH<07Qi3Zo?onoILGEIiPXzT6^#Zx5V(nn;%Z+;&NUY zHp5pEzV01dE!hc3U6cE+4%^w=Wuo|XzbL(u!N#&$Jf#HZ1ijTYH)yaOZ^2&+t$(!axLY^xAP(+l|4j$Hl2~{zX>ImyTEH zkZ4Yt$!FWt`)k2u(~CCpHZdA*o+;f2%S%DEO(B8j4m5!Ftq}0Z;@&*ZC&HcYDJHj_ z&JtKAM!Zw*L4q1jE?2$HMS=}%K|Vm3@g#EUmv=|M27P;SIp;3n%5i`5dUPt;S^$MI z9Q*(*env5`*%+o!I2d+Q%(Ih&9gzz2-^V6zjA>R!70tv9F1i zMait<$|4nqI&tr}&p5+NJ+b=#EPiKM6e7#@b%_*|Q~_ll-(ypp^YTK_qD`}V%s(?_ z+Z-|fsr$ntn@@OFG-3)l!aT4qrTjQ)tUk zT%F^?)}4~FR@~WE%HA*ZUnc4Qcj+Z@(y9f(KtQ1X1s#I_6L(kvUu`h}TCOI}&K9oX zHg4{&Hl`l#HcpNjuJ&S1j{mHJ`~PPSa@F*d&_yu5%COT`j>wcTQE4Gt7{|$aaqQ$_ zY(-V8Y)Zq&&e+lhEIiqB(H^z-;VF_|Y!95+M%nd3izp}@n@*-W0#4Yh0zcl~5c}!! z%#%iHLPW7(r*r^pH^u|^&^je|bIC;^$sue*{ce>dJ_CsiX;}!Bf1RaRV%1C0eq9I3 zoqBa+CR*0uz42SSGS>Q+$!8j@n|Ny?dTiR+^`gVn+nMjlScGcw-|pBENr?8P5Efg+ z*cWar4ER9W;eRQrAW^kaK8oD^2~RqY38Y}zT;*lNiNq@s;(RyiqG zEG{<@g@>EGxH51yxbYS{>=6r}_o93LVx9qIYKXuKe<$YlabK~0S}tTJi&=4Lkai`H zZ#ly`uD5Yp4`!EN>6#c1m`@>;DX^0b3m;2FQ2S*6lk{j?SmhC7%$SUc&ArFg{z<93 zog5>j{bdH=vD*oYu&^_5xx=YOQ2Ks$#gSx|d@B1z?Vt6i4nU1lnz$W$_|5VsT1y|l zR-=qjerOl-oueko^sK6SJhzL3Y=07Y0Wir)nbQ@>oYlkl?-fQy`dT5H$LHJ{jKHRl zl21`&h+HK34Fo~o(Xu0=kcKC0Vo^N&kZ?v64sZdnCOO^qw^k*I6oxz!rha!2zo$#h zN_x#cFwU;na-kLX2+VG+&my~%S?_U1K-fcp)Wf_*@Gfco$gt?+BNkZB@NKkiP{4LE z0GOA|511!(pNJCLWL5J%sgtwz>-W%&YJTJosQqM1vv`KBj;PB|Az$q0Du3-WyD4Bpgwi;RQqx&gD`Z zOcdK-YHKXV&EvY~;bHZe7$nbBsGrTT_Q3P!kM;|*%`pLDg`iZc4eMw9f)(3*81D$5 zDu}w#jSB9?JK=RN*F@IE$Omyt>VUE)k}n1cP+TFW-;rJrNNiE^a9TQ}?u2ErfKc4qyn*0% z^_-GvOW*LsoFW@bphfph4h!+=Z;P%$2H84;?yB6h_BTnUshi|NyF(@Kt)18ux{K7m z=AVZ>qkC@YYMY$Yv>h@7%~qSxgMxgkToAB73V9Al=_Smm3`Jji>8flZ)h&X2V%AP) z%&`TIx&_r!vTwqhIWWi9_42TR0vHJ4ozpLBA69-+@qbY>CFI*hMLd|eM;VIKTc`in zCFxb41-(h7TOY94*+&rWl9ZdSnEfp!zA8E4nt(57r1IV^e53hzjKEf&zQf5;KtY$oTBA&i~qmB>x3(H04yX32mB*6KHsH2aXrLEDSMy4*OB0}` zrS+UCLjijSW|y0}?w8-w_j%R){9EYz^9!e+_Je}_XGtuuoyLSKQVxx2GGnM4ff$RT zn~{`~JXQi%%Nd|C%GphxMu{s@Vxd2V*vJ6wq9(nANJhS&7Rrj7tDSU5wBt19;7_tY zM54ZLt-+wv_=mz7H-O9+#}4ftVWQi_nZB~Rb=o0(#b$ag2N%kSqjhReDT{Z;nWYr> zL$S39sXTrDxE{b(@g&MGO_#xy-erJ;aI-K$ zLW6xF-j;VO%M@nqAk~DWGr6#hB^FFG@%tkVB0%&b{kX-gai=AM5L_3&7HHy%L z?K;DNk_P@a8+U{MD%ckFt;UAOf6--8G1E34$Z~nb(hh8IOsP_dnuZj;ipD`&9rlzU zYnfwqwE}EUu|6*0X!|Ri=uq#Ujo)hvxaf`0`Q*kqmP=WV_lC4j>=>xWV6yvovQNgu zTjI5bdeBX0S^iPA{XJgiHmOj@ywR^mjvn1>rT9vqzwT5}Yq-QP=%A~I!RC-w!+J#~l^iqn{=lUX1yIzJ|~&(+ns%AqzhfcPAU#N43h8V(L1IQg4*N znqijUD5jgS!BEp7BknZONE7;S%;N+upxwnq>6muAk@LdOCgwniVJ(o9^2r0hrl6s4?#JX;h&cFLW7BK$%k&?9Sa;c z#B|h3#o`DhhfJnh;OIOq)=$5_svTtN36_CcyQNaumzcGL&Qthu4;b8d)egh2m2a-o zS`2FM3~GZu;QPzLUdJ84ohCxV3a3}=8bIU4lWtzCz8a&Wa&P0gdzGZ`1XGd}qSNXs zW8H%A>3AB$e#P6i4)zKV?v~3dSpiB-=@EB-!`-)DzO2x4i7Qi+?ALh%-*b+tub=5G zp3Sz>;(XM6EaC%`6Ax?Z;av{88tQz1ZL5?jx5IVZfUssaI|2tn*RfS~s?)+p17KV4 z3QMfZay7P%E7#q$xxMpz8`oAOR=`DL1h0(3V3+!g2pb^C!un=SSX2)ofGYq_zG>XI zAO~+)_G=k4oK?R10GA{hM*vrnMOL#V^RHMDpa5f6WHPm}Z@vfKi0aStcaZQXw$e?3 z2mV5S7mTI!QrcZyDrx$>B3x-~Jivh<I`kSxDYdxwKdWp z=^R-hFS0u&=^fTsMz%TZ;jlEk58VN#??Y0)jQrdziI7k9K8GRYwuAdV0>F?w*|2`@ z@N9=$GW0Us8HC+C zMzzS<(Us&KHOCG98{*Oi6sr~TWc$sCWI{M);c9;&}2Xzj|x_AQoMP7utAETgCl*{zKO!!nvUop9%{ z&2HPboc#$IXsd0)G0*7f49=c+8Emm?eg{wGk*wz)1!QGPBwnv zBY3G=p?Fh|&trxIjAv?5R$GgXZoB?Ydt5VSUvOOw$2hLHXvxo_edA|~0EVhq5vJ}V zEVrMOVy28S2(sK-b*f!l+XJ!c_rD`0D`hnCT9cjL{^~joxmR@$&LzP5Vo^k2?}9s)m2)ukbB9zj zGz?uIs9@FAptW<4I!}_0uCicHz`ZA@F|bbZQeM-XI*=Mqi>A^pxIBLAIkGXOb}f4a zEDDz3{wVTpFHPU#d;P;Wz~+i$B?^LfIwAm`%VSjlzYR50Jl2mXk5Ubbn2)b5`nw;7 z3HNc!zrbW2&>v7^t&N$+OjAoeXUW6tkt7LTYzK-XBv6&|y z3Z~5xUFXP;B%;F*N2bljO07MK%`r)I9D;~s#u%0uoBNB6tsv$m{D?R$()3)EFdF#Q zruYsw9rZ}0?Q4%6^!UP*($W;OCwImvY(}mA6B5;&PFEX7rK~U{3>Ntj_=Pjr(Cvth zmi{{xAdEDZ<=Y(ej4t{JX$hs5_xbbbky-gGJdfxS;aa5hZrx4XnjHoC6V5>+<6Bf- z-pt%T%o!#)l}zWa7`Y~@xHbmtN<0zP7>t~0j)!TMhm5Dqf}FL2CwqHriaB?PN)yx{ zTlqZv@?UV2s22qezP)%UM%*+fX1>10*2s*kfbE?ORp7asKAGh}$s73_#7Rjfa<285 zq+ucF&t-SjQifjP&DggeWOm!MPZRx3_g(Sr#KmQ`YTg} zz4iTXe+(;LBRCH@?k56xcS4s!`FgTx9#g|sYla7IJ1+F2LBBL1&(59^TBx=c^ z(_}wP@cQ<+&7OpRh<#>i?zKo%y+p}=YSEFt3D>H_dORJ7x1#fMxO!T7_GRY2T6*5B z{@d0^*kh1|iZ|hq9nt|0@Ybq4De^|Xp+5r$CqC#7VvW6MHzom8fvD)m?j>h2dmX}2 zx$DOjpbV76Cm=lTWd%Xh(K``ev=<(thcf}TtEe6jz$I4cPbTtc*4f(jqhuv~J7m0u z8VywNsP`cM83{RrkjnV+M>Mhay)+6jrFqvs?pM{EXN-}Y*_vn)s~Atow+yA+SVMFW z8`*!i-m}p;0R{lRUJJP0zc??5V@ZYsSj$xu^1X}mzk85quD_Zdt$zCt{gqYlOS@pn zku8mR9_A)HkrrwbisT=ro4A>2l_hIv3{#t#e$P8ffyE$AyveGYMnSxd(U7?tI}R`j zmpu=nXUUnW2DXg0`3Sa_+OwAUisIQs{6 zA>4V2g%7QB8H&6TC?g^Tabni~c7c-#zx=*{4mazfZgD_xH%}%_QC%9V%s&3J%Be$H z95x+I_Dcbv#L2BON%|X$0+afcjwf8K*^Rv|4Og+RYPXCg>U^YwjFD4Hfq%1uafQ-q{UlRuO*o0i9v})pp(qI!P%y&S!wq}M5hUqbdl>`$A0qt=wOII`YFDlkAZ&hcqf_nn#s_R@635een?hu_2ei=i3VS z{y8Q>fW(QDK@pO8K+oO+*(wAG*^CTVqeT3n#;HvbM}n_TimiQohn4b-qTv{O$pM%C zb$|+2kG!b$_6`2Of87Oel6k&=DOnB%-~fOTuq;HKIpvqxZ4WLE1u6xJpp!}`7mSJ) z3`+sZ4$D!nAa$P{D{r}=qiw&u5$)M*S{kF<)|$q&U`mgULcbxQ*R>wd7NeJ5zj9qY z{Vep{v!2YlaPuD67btwab+qNz`ptW?1FQ6LF%S`Djr-k`LD#V~WTAg8QZJe%YtxMf zn7vQTw(>g_$x|ED@YjVUJn2|?;mFexh04D!gqTg=2}a`^h36C$v$UMd478a^IcA8P zeNx6`P989|NrMS-bFWJ?kn^aUZ(k9E@0c0-yG0TcN3=0|;(JQ(pEo+`9+(<|b@$rj z8ZwO{T~5Ipg#2wJt-s(bLw zWlmFxh{!uuwBZ^*!{@wSXx|jG>lhQW^9DxbVLHyjwORQzbEHczUKF12?ClF)r(4F% z=n1q$uVN;BRFcr`Yd!po$lG_|b9%ll_0PO)*SBO^^^TaSpI=X5B*eSHsD&;C;3khI zTWV*a+DMkd+WLphbcv59&X^HxjG5$;^Cet-=w`-6Lz@!eowU!uB7cT>U35zw_OSg@ zI-&On%$3|-e)&t(8(qKhipP71h-XxNhwl*xoLN2VHafZR=oPX5Yq|f1mAhN@u<0Jy zHN$=Wft2gC@cPrfTj$Wr)*l`Sn8!uZn{Q3TjnQE(V_(r3vLwSW!d^#5l9(!-o*$Q9 ziXQ0zZEmz$T*)KU+wcR=&Gr>u@d)eKv`5I? zPZ|~G$3sZqU{7t87;J3Ejdx-dgOxi8k&jvVRd2MpyWCb>-s5ypwiEXQ@W$7*$^G~F z>h${Z{2ZaB&EZ@J+xTEcw8)JvLss{FwchDw8})Q+CBD+ulx}mY>+E3XN!VCQ5Bd)c z#xrY&SW*%y>dRxDw0nsQg)LH8&8UEioBvicmuIC!WQoa^S-g%s(POLjyfzD(Wfe|- znRh_1o8gQiPX}2m@+WHz;3o?a#zoquq|9(g;i#hg z8KhN8SnW%mw7Zs(^Hem&fpUNc3qfof%P-B@g7->-K6iLvH6xpO)a5|KG7x9eM&f-c zmsC!l0GC5dZ^~MEbf$z}5HGY0-jWT=-0^)^c7?VmmkS5>Cfo%au*eXg=#j?C4nHkd z?o$B65`R5p)%D3sooXfALcFQ9kqt0y-!~;~LxS#BWh>?0;hQ?z=ccUo+tS z@Q8coVMF4GbUi5Oku`d=@Uo597g71Xgdu35Y#>k^@|7#igBh>ZP1gIl2T=a0){-3Q zGYwc!q=UKs{C1)NP@echTsS*JR65#1s^GRY=tfSMX?j--u|@dSu2R+DfK@JlawY4V z0i4QnlbtbIr)F#1hYt@wdkiX=O+w+2AVSw=rQBE+);cN!ZVEWBYcQ#bM9gQlid7Iz zj~kYW5fyaK2a`e7;)?xsl94zAnb}0&gv}uW#vAEuPcfnZi)1y(;S7|0mPm+EM=CSn z1?DW5YXuDH7@QOywpKij5<_J$X^}efzsS?n#FJb-slp>lg)!}&M&|d2wd*NOQ-;Z1 z*q1EAqz;O8sCC3DX?H;U%Fp%nC`cJHj*n^b%;wnH<$}idnCP$7a|nj2;M7w!&DF>R z^CH1v(|E%HN5RHCW3>BIMWb!D{@J5#b{~RqH_|`A19f>Y!PP!nNvy~km`V+c`IX1P%itNTla1%k3?d& zaZ7a7zF0#DW~WPF{|Xn|Td}T(1!I)RDO$cX;drhC94*1^i61kqVK{IX7ZxZ_|1O$n zjU&@fk~r055jkn8Av_OXE5+KY{DGQI;}jB=h}-tIn8rijm+!i)nFe1?pDq|L=Hd~= zwUcv*(VJd4>0d@ zk~g^oNaRj0yJ1{(LWcBfoJ5bLC<;j%W}tJA?i8^`?99HNe_;x_Irc-~lPBgrHT0Fv ziXgPPI^>&Lqlr%mlR^v>0tg=>kGr?(BL2N_j(8Yj`vo15Xmmkdz zpqieQI4&=Jj^&sw3eue=<+r54Zg}?{5&PhBl-wucP5Y8z-cKzcvA=!zfG-1l>a9LK zxj*S&-Xugt5(Wfhe^yPrxJ||i1xrQmA`J1f+M!^R0LqeKfa*3+X25S#OvEqJVJ(h! zc2W++uW8arbr#sMV2});uF8seF$)E_`{8pCv#HK zMxz6moeM|Z_-PgLJ$RW?6TYno%AS*?mN9X)uWczAGmLlXdnUqcwV_UV`8d)zI>HM0 zd!XI?*2Yn7cWd=y_5bR|9Y)(3m?TW&(47lOW zf6E_#x?J;3tDOQKUOebN{iQjET&Jhb%gpp_YD`yR2i-jBWPZ>;gnK4j;lW9oWjdiX z86EUa>Ceb%tW2b^PZhS%PWCfUALXQtFuv2;^US|W{})a zVwqmhC1@KTTM51QLMtLP+cxyw>`;`Czi$<8s%FXodEwC7P?Zun-9%VImF};^$7(9iuyoKp^&Xv6ofcZpfWq^Jp6&S&L}t)bB{4R`AAI@Qy(<-)m8z z0MJ+T4KnIYTWl2H;ddrxjcn4AyY(k|JxjN)T1XOdtim~1|G8R$Sn^_kdj3^i5_?W+ zuDbE}S@9$5U%g3JN~r2Q7}Ww_GTA~?_xvI2P>$qXH%&{{ti!B=qRJXgRmfV^nwd84 z5*-adnU2Q4i?61H`mMux!sLx-r9TC}k?g=xP~3GCiAMutVMPp>uu3$L$wcXvn(V@P=1$63hP5G$ zt%6*ua{oRMz{*&tH1{bxIQ=N|h9T&2UI2hjaf+`(ha;$>sJQ%vZ0rDL=kUijsvD1R z@$`j)kuqHpd4oI-flhfl0JxUYrEJZ-x4YY53BDJ4KPuL0a;ob+(Fa0PtzHai`-qd8Ul0b)$uD9>Kn{?sWup{j zo-P-xDr1!O&)!#+`hbO;2!5r^_(TX;feo5up$;ah6Ogo`I;*)3PV1z|{e)q(b$!*} z8IjRdRl5))$qP~8l<(k>Y2X&Wr-X%@!vU5J3c|u0Wl42h=@xQ!oyh z)ZgbN%mh;y>>0!>CTq&iO#maTJ%DzW=Tz?YlGxtaSGi=r&w zcpy1#CP%7S66piQ>Ey-N1$@4U$v_!}7W5=;m|bL(8yZh!^38Y>NXSK;w1E8L*&!NO zT~Irrx(^?oxSvChkZ)w|fD7Rx^hZjZd2pvdTtOyvsBnD4BA2+{!CJgpT^S<{NvlpY zA){hyLV{0t=wY9?BRhtxlFENmlv`aX8|F-QMtI5koOkZ z(>2b_OUd8<4dH(6mE$gMz;}q+ptDt^pDq^=zy7{#Ir{-8U0QiM0W#?6?=2Lya=hIF z%R0=8eeIPMO<6<>+3vU=49^(#G_-~)=k)hyGUo)^hWgIf2A;886gG#o>b}96h~8aP z74PO6zjF>gkE4^TRR8MeYVc+Ijz%Nzh(M+Bza#HRJ}l+@D#ExtUNNn!`orVksn(;! zoTHXgB8Q}~6JM&c1K6Q}^p{9Tx~7*^HTpDb=@FFqjHsxWK@X>Oc7XI3AJXzM%7s?n zfI!T#r<(;7P(i;g=iQFyYB;MfBrJsV_z;u9NbLQk1T5NBVbJhStinjabhT2 z1rOCCeXK9D?1Zv;K$PZKB~#sv1oI;_?jSA%2$1-IUzKr(01g;m-aS+9@l}Ex!A_A# zg0>Khi6Fl9&ffPPG0^50rFmw_QG0$?_s2XENxRao&N*yJw>`YNL)Vx5@ZsE^#wNvu z4c>t-kv@3inpy1U71=Gk0W(v9n0R*fWTk*Td<+5kCDC;X{U}Bkq+a|;{wP~GhD|z@ z5Y&iWi8^qX0w|F(1d3AlB9YBEqw4fCKBB+TVv0g}K4H1Af5rwP!KdD_VTwCq@+qnQ zrqE8cRj-`qipyI$#f{5bKIIJs(rLMvVh_5Y6|$gX(pNQCQ;~M3r6aZF%baF3OV6O$ zwLpS?d{9)0N(h3TAWP55i~deOOu|g){Lt-}xz`$)0jTnvE6ufn>hrX+XUW~U;RZ5| z%_4ntTLw>&8zd9;g#1drS1))^n)N)U_((807UY9Rd5v__;(^x{lI&A`{7a{|Ub(Aa zZ@Xqd(r4p*KWD-ta<3h)6WK5h&ZWlT7N>-nie2UrPJ6MQl z9!J45>|K}HSI}iPw$&-H2^grL;Ou(*l3TDLx&Xw50a6VQ9!(E_JAMQ(%}6RmIl8C!zxKeq+uho1RzRhZzDPhno`8KIRuEN#q{|f;G6x%DJhemZyD@@EUwY6o zuwY~K74IH~Lh)sP{mg@BcRNdXr1o~k;A%aollcA3{t4M*NRic7M2*wI>TrRdYEbHX zRSxKz-z6>9Zcl@w8t7FXzyWl?B3;RZiS1`TiEU55S3H-&}$`vh@%N zqU>D0&01nF_jz=O7OC)=q*LD5Rdymjg}L>-O5zB=#D92BstN?*|3snvDY^e(2f_`Bm!p0iRStwYWB*aRQ*UZLIGcml(b@E?el3-YF6fFq2(k;`CRm zBU>%SR2llLGy%%R)hi{$EWLz3u3ZJVh1LBG4qFcbEzC#90oeircQjHl7Jlde2lsU_ zE*Lb3kgP@~C~hN=F#@}^e&cQN!~3+_ORz$fm@RbYPtcoSZgQ+>fY01wET;O5y%0K3) z{v~enBJk?pxsm39tfBvKQNwc2{-1QEa~~rc=RcN5Iy?vn*?*CDzAB*s6s-Tl9MwEi z!_Y$c7VtDNCcqpZ_eP^M(FuY~5I;yFksbyqnk3E2n3@qxPcpG&XQ$7~c<;R_srlp9 z`zMB1yFxqF|4!|zL_Jydd1~+R-Q2!x>D%VRBO5djJ}$K)0v zgcS3grN&r1EVvmCAgQrrl9A-r{lh4RqTWm%*NSDpIC%gP6Fft8J|qT#X?b6Vf2?bg zE^iEes)$`qHY}(G?zb+Ka~LukT$#pYP-QZ*7UmR91I85GlF?!<)+DR@MNuXp3nOiV z$!S%ff>MTJ@Le(3MFzElZ(!dU90!w0UFO7VnOQ>DN>d^u;B)xpRRnEg*go9Mh?SjJ z%Ste)m2_;Hf~_vE)!cMuxmo9oifZUreM;&dyAPX1yEC*k9U1GnC;#oHjGGLb>@QeQ z?p8cAANkY<%2ndEu~yh1>wI8YiUR?g18;J+f{d5Ek_#GsI8QlxryZLii6k!-sKZ>V zOlGNH9)aWvyV48dT zX&~CxSK+_T?fUU`uP!!}+R6NGV-EAE-d&n{vpV6JF#Ix6J1Y%PKLHu6Q-&d)w>p~0 zL%0}65BAu!35s9q8GDw+pi>I|)r+1C@iamQh>K;D__M*cSd1!z>$Qa+)P?=K^DHdT zkwVB%Ezj)8pSS9LF$HIvr9?`sE@o8Ua{92EKbCXrA$Z-9YqK|N-Bl*uQsxO{QnSv& zVmNxXVG)U0wz9BLFcCqF-Lh+`m9LhgXgYIcumB$HF0f z&!X^t7k^>JU(T8>GPo9ZMk$q2is#m2Izz(2hjtfCPa3SMVP06AgkYtqg?T|YPi zNb*Keppu4h_4`>=aYUd_PM2jDHrc~(SmTLVgYsFTjH1j?(}OQZP$@eId4h{Yh;Fd% zafXn2BsnoCwl#PJ6d$J}KVsnF3^5=D0A@o%IHia_U<>58<^jwWpOq{ZA^{zW%Xj=l zy#|fmy5q_$oi*XcPW=G1fPsw!wSjezFyBZ|MDfj-+xmzKCE-uv|D6SDG%sKD{YTry z1`?HX0sawylyOG$n?3013HLrmnNw)ZNC=5dBTZu|B!Pw4>~go)H3X7{EzMU;-{bg9 z97)z3cMI^}G>3kQ@c3p>X%;uUPJVg2@7)6BpAXMt%pmaET!|7o;h6+sI=I)9?ut?p z@efe0+H;NL#vI_iXVKVSdB!-E*SF7GuKpJtfWv4hcaxYOjz3T?$Pj#hnivO|OwU=G zjBo_?GS!dfm?5tV@Z{H>cAJAc8kN++oaqsTFu0m>)XR$+Le{#Cuoq(edW@*ru%&AX z#e5rCeKHb~)$!DZzn<~Pyod1XT#q)lY9IQOd|Xv_e{j@BIBb@Mnv}YC4~bM+5&y_T z2MCyCTn0VbR4G~(J4DbSsSY>~cEaQ^O4+lO$SpeI-v5f+?7HYq<*;yGmT~D-HOXMi z#bwf|Oh`pC76H?Q0(m5g6Pqi7s6|5H3k*gwnM`GhLDo=x*bHJcpP#wQ0>YrDJFgGJ z%w)18ahn*g4SQ_OH4d|QND5Ka?NuQl18_$9W(>JKLkU@9zln=mE8<~&^Iab|N|h6l ztThuot*2BJuZ2&5O_bIg;IaARjt%$Rr}?Sp{3A8pLs{*@ZtR9(G0`UDRPU%0HOMB< zIHaDyWJIb^#EAutc-7a!`zg?t`%BOTqj(lbI?!VgGeOsyFw`eSQfgD&Q5QsI06VOe zEmgL{d_tbT>M?HIyR`H%R(p9 z_f$Y=bJG3>BxwqB3n?^lF*J${2zhM;ZHwe?ieg})I9F7LNXla8+U-kQyXSyc-Cwr7-yJv8l2D;v=LuWSI|efXliv)_@w0vJrPPtuNv-p8 zl-;^nP&RlyOTQKP>RkXRefK5l`u>_kovX5o4AXozGfxZfTL(v)jt>im-G*6+eEEl^ zV2z+?X0UFz8fk6z)EE5oc21tO&JX1Od! zA8q zzz>1$Nx2vwX|7)J6FC9@Oq7nTAuaF9ne#rje8a=%lSSqi@CE&&{p!+pJY*w!H=)!0 zi~CpK9Y$hqX}98tXYVs3f8Y$aU!}s!3pYU8*D0I&lz)F;{>t8TCzvaAQ7Y(| zoB(aUd}4kOLKG-{65$azJe1(;-4{!Ay8!ZUSDo40hYg@|GWLh}vQ&g<{Qk{)(5qvgBmD?k!^GHa7ZnyqwL&Rqxbg zEcQA2OCBJ>hz;clVJjNsY@{GXhK2CF%o=AG3De_j>PEt0?fU{P?>n~f29L#P5Z?Ag zg<^AVd|(Ov?}+jrB#F1TDV)WYH0hf9GG?q(*i6nJWJpXnfOZ4nQ@q+7%UghDLcCaLuME3j(&pZ-&Db$L@co|$ zwN%()WoAquyw4NHJQ>;}?t$wrfB1SSZl<3;rsZeCr4xR06jI`FZ9+kJPOXiCK#lMx zT?<>gkzl1bbuDI|A`jLqx?S6Yf^PYBnOTyUa6uiymSOTzu9*s$TCIB9mXO-ak{uwEN7E7q5GVrj!jQ5#v!@@9m@ zy(Z_k<>hwNvfajN29Y{h=5b<6xs)a?E2i6^itiC~L6I%h(?t5hdMt~>9}XE!Hub z!gy^jLphNkV&StbmAYAvNV+irWjH$X!%u+1EV`F&IVzWJ%UsuX{SJ;mo+D)KW(#t>yrwS%@V24k5f`EzbU>it(+k`-&vg6bC@96%!+= zohHC$U7KqMsF1iWvKICrLR zSe)X%c%itvyKB+n4#lBp@rB|pi_7BfuEn89aSFw)xI>WwrSG=)dCq;#^LwBDkezEX zGnq{CCCTKU)40JEfccp)Q)*c@7p;$J0XcC8hHXi`tOAWgAlOOM>s_yMu}k>!2E$0P%Z12ik;O^y>6PH4A*E5b(tdOaRB>QoH+g09V9|K#b)H6wMAXL?>5`NxTKt+ zKery7p(pOC2jFVCrkT;>apJ%AFpo^XR}UE9gl0eidRS;#C)KN8n(;{^N{MW;ZRr%3 z^oU`d-xcOv9zVtPonO%xxHs1%=GR{w_Yqvmw=Fo^WF|mZ^r2d{`4tM_H(S_Bq~@xn zV%R}p*(aRbrD4P9xON?Tu=%o)W7Ayj#8Uk+gJJA$#INOSs^bvNQKZH#D4J5|yOqCy zc-XMYc1bc{h76B72%zaik~d#2hZK=H(pX8;OEFEOqF2i^@is;3N7krtHjOUhNnP7& znu$7Q=BuRrY{@O2PIEl;F23}BhC~2$sJ4+)k>LlP#l7fwD%e9!q?BJPo%g)q<@<2<8k zCU}}OPPIxr&ROdD%_(W6H5(q?ssOv*`WX^E`5VN`e%0CSpvGkVJ}3N}r^I!`%BO`( z8&BId?$t=$RJTcSQ)I6-vxiP)u9MgBhy~j~=)tQr$ir3_VexCA*bIey9>-76wJZ71 z-jBk1WCGf-CoD7h+Xi!$6f*mYQ$;XO z6$*ohJLd3}%vA(^PZ>0I6e;G_J>15`svlO^=x~7z9hz@XTI}cat*{a<7b`!weh#eB zCekl{V`cM2Uu9NBo4qQ22q2{adIl~7TrxxT+xs-(kJf8UzhbnMS;T2~T5a*@J#}_G zB2m!~l8&db@-)dXdfG;#J4S|0Spm#U;u!nl^p;&uxifmGqNlX9BkNuYVwILzWqLnt zt1TX(ITm|%& zas%A+OmekfsgA~2W=Iuux=BZ$BC>6UhArgdb4>{KX&`@bch${?FWxHv_l%5wG^){{ zV_(Ul%?gYeVpBpr^suYyS zYj92B;j7dXRy|+pCrq9Yd)WK@%UIE}W7G2N=X2$Fb3q}$wlxH=@i2>*ZLgR$P__GB zM3%vibEsCxG`Ic8%^03u>E&YY8Gjs&9dU2eChal#pd!RIN<{Gl6yuv5X(iySy4u%9 z(?y4^FwEUr$5=XELAnTIQC<|^qId0B635r`iqOB^GlYl)Kvg@G73X}6>^tVWk!tGi z;*;v{M)#4teZyY8)LrL2JYWFEyH+z0-jx+2pCjEklu z_3f|LrAW)WnaEMlLA1)STM%EPd(hKbm(5)vy$c<^;fL^5jnE_oyJf>&&|ni2UN61hbsGOz<6$)I1Wi( zgvgmVf;Q}1g}#;94apEu!-^{Wp2y+N38%m$1fr=)7vS)II5}!WOGx}Ab(*);-VwOo)Z0n))B|6rql`f)U zgQqf>g!yj^RUqasSSX>>jz&Yf8Rld{Dyh3|RG+~whIkfu%wE>HH6j1#^Rj4o3TK5A z={1ApUdBR}>o1#>O65~!9CtY`<}@?>P8VZcA?6=idX5HX*A{oK7ROBhl?kzLV)!rtV$g`pfYG7eaY$^>*xn86S6~HJeG1P zL=7T;X#rGjXfaH8I+Fjnp2eY7O4>!!fGfa7nJ?Hbx0jvm>y<<&6>_KCP5b~?j{!3! zy{bX!7KRt6sKGv3vNPVVb33sEFTK4W|JeaG18$n8Wh^bi0rb{{rF>U0YfD@{g_XpD zzh`J0b{s@82t*&{=CrgDxa*Z!aQw&?8^f^}$&-OP+R-dbFli`+9jB71LNl)*E%@Vr zydy3BY#>ecZs!pU+_1WT#`71v`3Yo9%3|vx9NkUx5tYX*-yisn3>iv)q(7DOg)up& zBNVvIHV~DZyc+m+#Oz8q>qcE9CJVWW`b1ybbp_(MO4SjO{ed)(kt-*ZvTBoN0X=t= zFAWOE=LXvy;#Cx~nHH@UD3}y|ikQ#37(7yGn}z=Gil4K`=E;?9$azOy%|@AV>W}xx z|L_7XzTr{cvCpxgo9~!DylltNl(24}+I4&LCPrAHkW`huA(l zy@!aaN71B_Xdh`hEj-b{f6^>d_t=%$tuyV=G+@^FD!J`0>1cElzJV^JLVP@@4J%8$k8JLcwU_IZFJ-)hlP)PGY zcaS{5-FVGDaYXtOG;?B>8GNeBkQtq3#z>a08K2yCPWtf*#*0kO{?H*4BT`!EG$EQE z#>OKtt%GA(Dd4D3-iD@!#|KQjw_>IPLx3+EKm#kt(Z(K5=`K+(~D3eY_`>?Kr z^v16@U_|)Zx>CDQ@{Yf=d^VJTytmC(HQV$1l<~w16jp2;Db$Qq9fD?}oW8IF)T_>I zqy`;2!)9b4`Xw4SJO##^a&c_pegJi~3~;lR>*Y-%r4Xdh+z9q8c&A4RF@=|}LOv`; zRWYOlmIva>iYja8X{|9VR0H!7nw@fe(+L)iu5`c6-7Wf5@l7S_)79mqaUbAdRSL>0 z4V8>D_YX7)yA9hO;D4`@kG%?zCkO-lyFkAfy|%x& z6U=u)Y6gzhbV1Y$C&N)BW_u#K9=OVWTx%*6A1qc2V%9JQCW|M=B2=r4l{em;VT&_+ zWpu*@8zGkZ#u=+8Zbst4KS8Z@*A}CZ?M-=s*@`TuiZ4|CmKd9pq#rAUTjxof2LKDX%`l$_Ei`D2-pt_U7qi zqgTn2@RpVq;}`KdF7Z8_z&5`Y?B58!HHPnd-28kuM{EgsYnfHV-iXZ^P}NWEC6Cgm z8X5Q$5%>r_+2wx*`owBYO*vi;gKy*7F6;$=ZnMxVu^oD>1lE4lD_0V(raHC7Zz-)- z@Xq`e*4Sb>*7}CoP5`7j2F<0RFI;*Vz4($+XC#xc$=W$_jTv`RJ>QN3l8aCxieyX? zA}0(VBc{BPzyUXsak#pWlGGX3#;1k-6E&6B`ok#CiFU`Jh^oior3Nb5d34mjXG**&uX zXg_@%Df1YOp7MaFf^MrtmC1Ctq_kB)+H&nsZJR0voA0B7n`ThOv$F3rx~KH&Ow)Ot zF9nM2CsXYWyPUt%ES0&7rDws&+H05TmP1lAc?;QJ()XhyD2pGlN?$<$r4U#?$P0vI z354iGku*5OW{?*o(i-mKBf)lVa7;V8KqG~~wz>4p%WvVBdFO)SdRo5Z>?X)JKQUa^ zVJqei?!F_Hl~PFT#={h3@qW0?WoNAGiF`(*iKZ}?1LgNf*5e+aK9Kw*>#CKxeLz|e ztlL+7p!-Qt7QsP~B#PS4iZAe7JlBIQv`*;*E~$~QkpQVO^tP%tnl`k{lRHzLTJA;j z9kQ(4$@YCWc&RQBA!^E_K_m`#o*0Nicc>T)%S6t z2kVBiBK#{Amd16jD0A5YYZ!^m8Xoaf+mMdwbgqVrCx()0SIJEfC^6vX8B0=jNn-iX@! zla`3`n}7_8)4xYrX&|SzDH-0)Ipj7Denj>*p(xoj=B)60c-f&=$g-G$0}%zyv?L}9gp^5$Iw`SxXOVe)h~2HJX66sXcHMVn^@N}wqcKH#3W*1{ z(sj{;w~PUVp;%=Gz#!Yaxu5)@LS!=7y?OK?R4kYmgzsb2l;?SrFZI)=c$6bQHVrdo zBMR;MenLLgYMwJ&MmWXL`!d%*sXxWVy;MqQWd0*&YK}uWjVk^lt73PRBZW%q2qb8+ zU!Q*#f508O{ohl41iZ3-8;eKYGpEv5L6&CYufU!!g$Cz)o2@ z=#wT2;j}qxkv{7ONHjJY?W`w6n()%HBgx;LBrY;xK-miOa+5kJi%!ld9CUyK;AJ7Yx0;;^ebG$MOH?uW>8k!v>+3;4Y8&raPL}@ z$PAmM_m0yz(Y5hMx&YkhILdx{Wl|!XL+Z71x`uA8QhArEwp`V`P#o#GTH<5?FHUP>H%QP5*i_>p-u$PE^hH4RNB#k6$?2)#g0J$Q6~Oz}@)T89%(W`O=x+>xASZ zoX|Q$s5GSO{z`32FzDKtgY~)KC?mXaUE9l8X0fc4%Rlqm97Ft69*W^>QDYGLAn!K& zthDt7vE6o~4NGld^{V8@Rm6DRcqu&+^zHU&zUkss49vs4%8M@YDH3msqd;{?}M+Y_OjYnyhoX;}`-- zHJahCOUisSwLa$A84-AS7yIjNA{=~cpiC*N-)9V*#wlEg6LBh^;=c=cQ|3~7>$dV} z>sK=7c*B1gB|ysGo6?J$Y5Yq4xaU(l{{CXuFQotEm6)9Y!E?U2;H)#WM#>(y-{~YZ zXTZklzOmo1WnKevzwyj^$1oA_{(HJ4ZX%Oz1w|^;Ljj+^114P%gJP2%HRr^!KHae= zv>@69rJ{}n=dmC}7Hq;H19tN@dh-Lh4$yFIn1hno6&Se!XiW}c$gKUgkS?SI&S)jZ zTwMGbecRW5ow2p1Jw5!~p@UKGl||cTXBsesH@ zY|m-WiD#v2otKRM3Dg`LoN2F18{D#8f2*#kvZnpM1$7Q>JN6P`Vg~4bFQ7e9RYnt& zfiHRn0@qS!m1Y)twYRCyRfR= zr#pW-&S>a>JUA5y1@_cKT%V*JV6E-o?_%C zj~Gw9Tu`k^1`!((?$$sYN~sl9-`4I&DL#H0U%YrfXXrE#GplMtA6D@(8f7?p7)flK z5R>Xz3P4S=3JP&?;NJ;x6QQzt@tskGei^+Jwrp5vdgqB+X6#HoLwB@dDg2>9!mWpf z_>4cN2=G2HzAtc7a$4xKP+UNi&Zpt}T8D}KXr)J?;^OL`UnXv75CrpIn8D9}IBe6$ zH`8bHJScpJCoh=>ShJihI>ooSUTD{AZfXFu=E(&aw}Gm~0fKn)iB#9Qe1zU?Y-4+U z^#KR{l+Uo+_n495xY~o-xF0|4gM(fpbPHV^_EJahV zGhiH=oQtoOho3{nGf6e?ffb1~iY(#E&Im~KN>HDV2@RaSD7#F@lHQZhdN~5e5%D=# zSat%8m0$_O$qH|~BLP8`(BhCM!Q_n1%)m;}f&pErA>(XG?1fOq4^m>2TVnJ4z)CoS zv6Mu{*_C($!(74BB2e;)xlv|GCNPi!F=wMqxG*&&Cp?jne@c{H za(S`BsCy-}N+uBU`@=@`2X{$LJYr!zgsSfVUteEg{yPJqHaS)H5al-*FaZn<{qK|B zqzfdlGNdN zGPepiv&7ckr?liSh5T0Dz=8U!n#Ej+-Q1(%`B!KP7`4ikKi2?fXH3}hJ;%BKr$^8y z-;KL<(T8urn6NekQPN$CgE_EW`jW85)Z5KCPyDnXiC&}6-Z>GANEe9M&dKlaoRidI z_>^=5EvVM1%wERfgZI{+yqQ38*Zsa;TPt3kwIQuLWL0;QFzZ7*of-ZVQ|q|BzTSQm zpmmB~6mqfNZOp3^DOkVsPme#Y6JbQhc0S#6VfQMKi%oXqZZ5&WW^cPB31|unv2253 zg-6ansz?_MaffIxD7L47*w!=-{iPW{>q6B1!WRAB^i$twhq&=i)f*>Vcngm;vdQ05 zb>sD>A!waONLz>`o_?&C*Vz|$e*Gx^{Yw%4}^$6IlR? z`Zt!#T1k84G>Pg6&_pB$=g5|JEZ5LAmU<&r&{h(unY+%o_;tq(+{`)#tj>424y1y5 zXu6r7blNM5nnsqE)=KL;apu{Xg)by-krlU1O>&-1gUg6lh4_@kXd=bLB_$;YTFcnh z$}BVUIlG$k#f|zx&G4Z{cJ_8YxN}A7+(mTZ&DgLWryU%#+~)L`A9mN8VU|nFJ zgHIwNYUgZu=98V$$@B$P>>BlwKm|U-L>i|!M%g;_v1n|jOI&GqLuWN+u+82NyzR>` zNvu2bVhFcMESD<}^lnw2yX1#kFNlob8ZU1xlS+6?-i|Aa2k&Uw5D0TCPlmjymajz} z@}L5D05vexfxH^^6XqW1u5jQ>N5AlD|1_UjVS80sJPx4ILF%RO_Yt)v(Bk>lBWD;E z;UyeUY;cE@bz9Do@gjXTp`Sxj!j@RY9Z7J;lBe#f_h z3=W`JD~D6c<%>7qc$;#1$4EPadm1HB3Uyr&XyU_0U0$-_bej`tgu3Vr+U{2CJsI^n z^UmEpoKcEDvDK?fQM9u4>aDTrv=Hp3H3e3Ru#IFpNsF}CrS`}yT&fzp;z^?Fi2sB) z*IC%s*=ht>cdYKO1SeJFoV7;f)2ejtHS#T=SiCK)jH}vSNSbd0E1H*NUd7?zFG_sr zMtq_*n#c^~nIiQEJ&Sa(=YW<{zw8~=J??tza4x=ZnS-nf8?olMcksSffH<{iDI|9n z$rot<)F0!eD_#p>sqZ6;R7p-O;wts5_Agy2W){)eu8e*6^-GgY{Cf#7yFW0$wj~#~ zKdmRbfo@gNRqq)$*#vVHksjC#VWVHTz=Xo@eteicM^YRDVI8hG>F@h?PZbG-&sQ$_ ze&ide<(@i7IsDO)iCbpV46ZR_&5y9QO_{i&(gIRDyh_lB;pXAJ#z`SG>%Ln%|4;~n zQ<3y-AAP_|;q^#>p-j&+!Swk$LYX9qC(eyw0cu^`fe~v*)H4;U55o*!+X2>0r_p!U zf)%6hj0Hl5AouhGRl>Ch%8e3k%&SnlSofh>UBw<<-}-RwJDe|3RGF~ab65{0>eGZ6 z1gd>}=%5X}s1iz5-FH)^wbi=eq7P%YRNoDzhrXsEkOtX|68D3VSA%Kh=+9m#c5~@Y z>k!33!h}PU8XcIk?F*+H)D@}gGTDjMgLzmD&{c`pKy~h+#KZ?879{v*1qhcW=H;xCk3=yd#btz|4y|K-H)bj%A{)4-wch#m5AfLHZkM z)h(`5m%Er))*Bs-NA`?lBK3JAD;@V-v)cPL3~jI9EOqHe>sVj+^VSBSqJwoEuZbOv z=kOMkLE8d!YHPMur^G_`H`&c!G(rs`zF1O;Jqoy*^ozi?@h>@qC87m;Hg(O2GhQvvOJ-h!UJ22=Qb4{ z8ek#jnoXBWR2N}ERjXi=0l-isLa0vJKV`w?0{XGEmmOhT;AO-k14OII8hp4;=1VB{u*+=^DNYYIN~X%H3iJA};<>N$aw{F}g^-5M(C1c2 z;QZ*09h2{nWj>YtsiGino=p@(iw0vnCB8gD>=*8ZgbfD~OYf$60e|701E4KO*kM!W z6-cemd-GKU(XOzK%-7eP6t)z3ARk!)plwN_1?tzw0LOsXQ@0_qciRLBA!k+2t_zRe z{?FSIi{>Ct7gRpMc11PufHNfYmK(<`|H|V^KXBWbCBf)=nAzAR@)$jltf77F78 zkzsBZe9Fusaog-S+32|a4)rXB2NG>KR&Foz5l6QaT|H5@7B+d4C_GM|uBzC^8@rj` zH+*Vb8DU!gVb|5ajL-T4CG<5V{dQSTdXv-C8Hf*`ytbnLVHKliZvVmW8|cSpn#8m; zAtUPo+GC~Io#;Rv{fGC$=xR!^06YNPf6%6F*Ixd9)B*@DTBC=q?S2DLZ?BR5Md7Ve z|3#^+GeIfubscCqv#$1s3j_;oi2PL_w?PM`S~iTKCH|%jv<%q%O|NafftHm7K(NY| zAe6c!1%mUpgrU^>)^Dl6mq4)Twj7iy+qQ+4I6H2*|6NG_{gMSZeMc8sd$~gmSmFe4 z(Nlv3zCrzl;&f937J0yZ{0!joZ@;}BhB8+9p$q{qXy^CS8BDv>fD<9`jF2F>=i6^a zB9w6`@<&B{4-x%8w;uk41R9ZgaUl4`9x7l*{4asuHuI%`(5n*v`4t7tfrIvhpxlpp z)Bt+fKfbWblK*9#T>*&pUr}=fXf@UUY9e5t8h~I3J~E((uCSp40c~~D0ti0dM+M+m zLfKSc;K6UWaOMMQ0IxMz{Xi1>kqrGnwFRHs2!Sy+fA`||IAI-Pz^;KQ4xx{U{Q17H zga4~>ESOUXbbGMz;Y-^82J>I|;s4_#^uH)b_O~dh%>Rid{+FNsCmQkp7%K|WaE4kU zA^87;5`%wj;Qzy)f1t?1u>FsTKmHuMfMxXhUH)4S8jiaQwS6e?T{!&E$yLV=1)Bu8^KkTft-&48<%IN>}htbwkw0g(>8I7~)Kh-B=WZ<52#DDbUzgtcJyC=_Ieyb#1Q2s;uKda%t g7Q_E?zh>z_(nw(Q3jz#&7=D;+To{(L52Ty)(*OVf delta 24877 zcmY(q1CVDu@Gd;IZQHhO+qUiB&g|H>ZCg8@9ox2TfBWA5t$XiRb?PMP?o>`ya{B3{ zpTymOhVFraE6IX_!6X60p(o&=0>dOQI0OH$79toB5RjvbB_k-%|Fu{{{~u)%7%)CC zOcM#P1I#}`0<7cz5=;GWr6C;lKczQZB*?!446z>UpB&)?yJ;HL5BOiz{$JG$UE*K0 zsR~0J;-BOW@BH7};S{^+2|p6_pZpi`{eOL3$u$1;Z5pSl1wn%W0)m42_esJ)x<$U2 z3lKm+6v#<8?376c=XiiAtus$lb+n%zj;Z1WVA%v3ac8m9M7O{oUJYCE@@DZG3|a=b zv3P`HR(Ff}ppRb0^6+JNB`{?*CEe=woFW2FzHjv0gPq;I@|S73dGf$!zxxSa$Lp?- z_e8^=w|iWmsaG`#dWSUSFkZ4v>LM&$S?I#M#)vd7MrZ>!i7fyfF}83XnCJ+JU4n9G zjh~G8tRVy{1}XgC@)7+{Ygs3AH4~;FVr*u+qy~J?hbev*hrXU@FGH{w*26%S&2UI> zZ>fPnzb`05L7mXi+h4(>8IRD=iZWg@LJbglgDhS88%#+kxx{}vp^@J0IOVq-WUXV1 zctPaxQ*-QO)^z|RC7i>m5~^8CJ9QZm2!o4tD|V7?n2N=J^oTBHk+j@kRPsXWC-x8e z_{eg@hrmQgsGaqumdN>J7kgp0;E=57sxQF&G~AVBOV-BkW9irPmy!oPIG(6SqspoTczyE+5{k>xStDa&jZ~OPLCG+r07M30*P<#% z?&YGC*2&$z*7w2!XFWXiNHbwV!3cwRq|L(yG|;_?8zb||<7`7uMcl~xD%yNn;rtqB z3cIbiz4aQPF~e1eCv|pNg2H%2B(x!wFyEHz;@ahRlZZm(Fic-HhK0f6wxFU8)bw!}>Pw z&K+9p?RnF<413CVP4o(hA|=4(wJMFUGtucr#bIgzgF1n$V@qRX{gw94{Nd;KyPd@1 zFO@swOPS;fF`4yllI--F?kzQ)l^He^-nbR)F_br*^16>)*3T#g7Ec~DUf^9|8m*a? z+k(3eGl>J?A$QmO91Fnlt4Ckvx1xaOaN7J@oewgQdeDE8Sv><;k#r}X;FgO>^MeqxVT$ycobN)VfZePt&sNiYV1sa&dAzA2kr zF*ZuXYGVm|;rsv!c6ufL9u0AOukP`6{jFty-b87jVS7HfP3heF=d>_<+A`B{r(w~z zuXV0;V}YrS@SM{aE79>$mdGSuNtSfmOwy79Kj41iSDy|Ea|jP$3$N3n07lpqd62U7%ONS6xPF<-Ac#@mFm za)=$1fWscSk(pKAErcf6@Sx5t*v#==M za5Tu2>Y_$T#L!g3(fQFexa&{fWf9lG#wyh~>x!#O-I*Q=uBbTjGHOvrScGYVr8v4b zsEHt%^Dj2RaGN_|ogw1ps5m}Y8viqG*v@*Gl|+ZCGdz(wZ`iYLh^xR>T>h&-axz7n z;f%rbnZ(h*+*l*krsbFBjCt+=uSS%nHNQJ*nqf<&;c!Z=J8bYEP2YAAaw2|x5bLRC zRu!^%4=UU&rorJfR4j22i6BB4fu7mFZNx$NmOBVV7D1K0q%+eOQW%)u15MGz8t$)V zu&4a&k*?i?BeT8Hu+vju=EmRo(FrSa+JX`uNvqy&T!y>6bmx)m(fdIF(4X(4CT%_m zZuVGD4~V+XD0Gs=%zr}Z(Rt@Gj-(@`9h2Hu1m-(_@h8Yl>VTp6S7_eh87z!Hv$SWN ze&n$SkaxTRC;+eT$V5dCm2D4|?5I0*@7gGql!phe-9Ze#IQMpezd_(oqYAf47on(B zDNYAFt{|Ipwy&wFww zfp@-jlln&d9|R6O$8LIIIs6Y9H`&4d!^u4^#Q%yr-p~JlmG~072~uG9KmDoD&A%e) z>JmH23>_!QNCGm6{R+8>R1Eq*ExiQyf88vl3sL?VAzWi8saYZ=37H`^iRvvt{?lNZ zk^VDC>b}NqQnT#*52+EY=l>hxUzm`Te*>2EVT19%Ta>n>nEw}>ySvb>0ziR)u>Qm6 zBx74VfR443s-3kHgQ=adt80jwtmlFR+BZcb>9B?ul*&L+1rC8UTD%TX2pJo=h?TXx zS9&l-aa05=m#Fzz%1H59Y1VhdE27(Ap_{SGx@zZ5-1!;)8W`rJa8yP|T*rwx^%!)xs?z95j;160&J9WKXx5nxPa^R;Hpa3wph|`xBk?rrVH^ zDxF@7z0MGCSWY@RG$&L;gk9Rr`O-RiKhwgYS%A2N$`mu!0qO)?$D5ZZ(n*mM{WVU2DP;BZ1F+MmA^B%nMce=qq zK(ZhP8G{(jn!zD^XMjcbW3b?n@ZTaEC5?#a$|h9DDk#eF&m4o+{>J^38^;Hqum$4` z260DI_@@CKb1s7j(qZ%D?f8iDa;*=+6!ls&JZ8ARj|I^j`!#H|NNm$&9R;GBUY6&Y^Z39Yb-d^+-01g`x6<9$Hu^xOsw@WvkRR}Vm< zyQbB0t-@MaV^6G`GRjG{%BQ0(oC(^JESr>KU-7qDh`4`y{Q^ab*G(`^B-jg0A^T&QFTr|Ts@IKQqGtL?a3frjSBVz%0ynDWFT#qX!erp3eStcNT<>L@}S zlFD#9Fgj#=w`(`m9fg!~X0$4iE&2UUDK?P}Vp%?4BsMUA*`uDhOBSTP!bsV>RH~-K~;pok|hUTrEukSNGFss zo-|D(i&kVuOn+XiZ`6^01u>RS?wv5MwnBqS)L2@=^ysBVYA98X+ilW=M)N|I6&AWqpw*uDA=;tw%0K? zq^?t@8sv#mDeistV8+OEc0u%fmYGC3R3G^G14(3iFloCSSt+!I#81?Y@L#c7ug0nH zT%)i#Fy{Fk;gjF`cyIWFw*1hRZ?JunYQ1HPnC#4W;kK>`Lf5 zz0~nCJ!7~70P>3L0eWa}3hx5G-s_E%Cq(pP1INgB&AK8cu|E?F|?llO7RhYbYWrZA5aST<6j4URfHd?@dXv#HKe(n^w=7h!r| z!;J2#*(|uv^O(2gxlsvGMBs1-)@b+<3yw>j%*p0dOp}clpGoRlww!sc-%znGX&9Xu zQl(&VSF3$XqCj=Ntx{Bq!Px0h9G06kT%abIc?&OBxcugOx?>t5wF|jzpsEK5Sf4Q^ znI^#{^Yg6(6ic5P@J%4QK(1&x8I*pC9_?>L$g}&_cjQyx=TPYDJ%>B(_I`6%^P#`$ zurzVAEQ4IBXW?_WEPy|@S^R!+s6gFFI$aEH>)xp#Y% z$Pt}#Jh^~p8Rk@2&sFcC=UOBhH-$~FX>IZ>PnE?T6^K-Q&bCB~d|n!&Q!0mShV=${ zYQi>F``~?ml?{gb9smEcXbntPMFi;x>ipY z&P)>#)F2`agv!{WQLhn0H49D;Y~Q@jFh*SM;BjVAG;4EH)5G@?*!B(mOuov}vXJIc z3P?J5sNQ~CKORnsts|{AAm$rVIgTJHpSy4_gjrH@FNq3 zHCA37k18TUU@(>*2>>PvEetk?Fdt{@$YE}F$wfV?DP^0fkXIR(i-#zPUZEYO5dgPvP8As@u zwCc=oXWQ6&<`T`PtAzuNxHzZ3icRHUYf7KyX?4ID<&ShIVLXK(^t`k3NZ`A)Bb_Aj zWuUAPRw3SH;y5=@2W|M;VNT*kOp4#lN9M^%>0n=y+bvbKraD+A-5ceS@`t~urriX^&4r^O z^Mp3mA;TQHt(-@;Q(LJeGQ;q=71t0@NbX)UrW8%@3}gNAWC{K_{Lm>sOYa+_XHgTG za}p#SVWT;b%#?2g^czOu0DpWygUb~iurMe430Q?g#jY|z+b=yDf*%hXJeX#QGjyXx zt22#K%*%ZecxpwS6Z z*-%jjH{6v4H{7#5FZP*d4OKrb?1ky=H^SGe!C{M1g9AR)1>e~V47$1dReFgYX15z2 zM0iU&I7>^z^e9jVu)c5Af2i@mS=fZZ*-T?+wk8eww5Q9mwPia!a?dT>wQ=Npzqb!@yuV6 zJYot|89C`%5q^7#X#2HgPG#sw)A8Nq$h2Nc;^iZH0qxH~Qlt{()Gg>{=0@iR?!ng^ zo;AXYxTdS=zLP&t8%5tVK84@6u`~mwfmTG_NyVhxhF+Sj zkz1zyR`K2#lBfPNOXWX|kF}z)?*P$c;a|^P`KqVIu8hK4VF-@}c>!F}q_J?~bt<2n z&Pe2uJtA{Er0~d_#h60$T+X~=9_hZa2Tb5NeKfJNQD8%@R$ZrLZLN`Dg*M(nv(nv{WKN9+-5D}i5#=XrfkyOnCam(9x2i>E^Mmkv_VxH=!dDHq(QE&fef*HKF&@Bu+b z?o>d+p3OTHNF5k=eIHV`6YWq-ixq(TQ^(Xi!}sC1QJyxUP?zHhe4%OR=h$SnPTM^+ zS2|$AZuQ$Z13NlM^dQ)N`63&H0dM%?5nxtSB(0v=o9Or+^DZ{!R@pr;o64}wu`*db z_;nf6A>!bpV>Lf1BTi-%-g9aZo~j>~_%42}_Jxyk$@aT9NzW`AMdWQdx&yGTmW`s9 zlcSQZZs77j0j;*Mp>=f>dXjK*lo_#W?=>-nVNrIS`c~=KfzWW8pG41Tcb=FwU}iw$ zIppcTuw8(?Q`Fv6oVE!ud`REV(wStb1%z`t;tqPn<&Y1W1EG*V(WecET4fARh@CDv zCL}nG^|;wxW4zr5PiLitmJ5hG(?ZOjauTUscY9px2tClH^;@AvN@Mdg*;UXKmPtWB-D+8Dcw!CGY)XIj% zV{EuirWaBtqd(N17KjKx#y6TMuXV<9u|Ce*r-R*v1O=aBb$+81T3f+|_ZBcqeLG~6 z`9^-zFLa8SvNS=bVs8o&u{Hyf7ugZLN=ZD$+lR?KYes&-)4$>~e+o+hPzX*b59Y!a z?mOjW^e8MrxP@HLrvMb&ZBTQVSU2_^KkTvQy9Gpm#m?>KZyPpYKfw3A!}YAt=Er@54GbbpTqwk-Rn)M?PtoBeg5Boe=N8!| zE5+Pc43yumpQJZkldO6kmM~)NiSM=?&O}LYZF!3qPcp5fyGiFjisi(5qgIZx(ijNQ zqzk?o|NpU>gpKmw!hd_>07xJpwj^V3!lau39Du#6syJG}GsPoC8!nDXiCVQ0Mjk;G!E8a zJ0R8-q7VjYSQ0r~^C84RZzwoc78#8sebISM2(cDRYS;AW3Kd_|UC;FNex=5SWrj(~ zt;ePIG9r=Q6*sqBtvD^qjT3JJy~G(Lw+U}TaE2-UJY0^EIT+SKn&lCVUQ%JDS1)Nh zNUO=3T-iFgT{x>80sM?-Kjy`tkd(Xm#P|wOth%2(B*I(PsCJwnByw zGRRx)**e@D&>yW7G=SYU<}s#fA%8!i!}$iGw`D5M(Q__(=YIKR7gc?j?x(|(FS7(h_egU` z^jM7D*)TClLl6&ZT3Er_0lp#HkVW9jWN=Dt>VL(B6scwiXH?h{N(HOplNzn`lOBtX4{7+c$e>Tfu^=j{1C_q5JsDXfp|NY7Y z|5i90pyQ`^(#4U2lNg(bDV&K$_8E%A2t*kL11r55r4 zD`grN7NkdHp##j{9|D639S-Vw&&G@vRUl?u7bfG~sWpi-C?}k+cBH+(XqVy-Gjlh~ zConeX`eufRf8uSD&N%yN!Zj>v?^iicM%~>f8s%LOhH*!N*fSV4?2&;ru3mdPtE)#1 z2&G|Giz<+SYa#H-Qhd2ZF`x-$MKdV9&mhp5p3o=zMn^@zg)ulQ;C!P?x!}{AsTwL+ z0%_FQg9w>9HbZd#gGC@fOG7S;;Xg|sJ_Pl=2x_8UJ?E3RzI>Qcqh-Ry9b9cq!QXt z@0BvwFGxe%-rEzn)?7pKgrnjszl|RkPVublmOY9e9}F6;&nHm!7CVYkkFCU0T~p(( zy?1bSiW~4n-ySV)2_2MZrY;^ek%+eb)-e@|3!7|7;NMdcyV*gDfs=^Qs;0*Ru)-6u zcmuC@Im&P1u?$$$D{_(oDO{YbuFiFon0_1|*9zHMLe8#xoOeB~#}g1#!>7*~dDZ7u z)KjCxX85dbR)_6}j;ArvYi(>cmX_7{`bxUKq)ykyY;@^vWbyiTwzajjwzNQGX7TVY zL!`Ga2{*T=SL8R8m6UYY`sTX>Y*~fOht!%Ys$BIoU5V;@todJ^plDe;L=*aj`){S~ z6Hbk;jMQ!rv0Ho#-~Waq*Vrdz8A;)!lRH3&wp_hK#ovSW_t!g&6dCPKUT&!;v2$V1|Kg1V41{)2qHHbU z<8hEUqZZb|g#NYwRW)5hYs~xmbd;5mEuRn|dP@L@i+{I=FVU>KgUk{fLF(^g)kFXv z*#hsDDJm@GbFVfIG9&+EIIRP2+w@Mdx25D@lvs+HW=_T0qiiTJ2Ex$pj25_S)7s10 z#Ec=ubjwGIy^?m^i(eTAKqc}6lSp-Wjv+%=%e(lN)AhVwwSLTaN+KRu4gprZ*$8pH z=Llg`e`N__w6qaq4pdyNs7;?20?3hNLk&Y~Ah-HI&iw6zwvn#)KFU*7WPu|1n9xi< zbY%!~C*lfM<7^1}8+}2ADrNI$3Qs2CYVNN?3%`EN^KieEy)2U%Kx&KD2k-|8h?)r( z-MnxoJfpwf-&6Tn8_e}#TfkJzZr{l{(ZY6>tf#ewBLiD>)RVg?ARV;+ue!AiyS4(ZP~;OM z7(ABn+{A4Jv3Cz_KxxjN>Lln4F>8ReOy6`nHwtHgw8M)uXhz&uDE&~TQ8!ZR*NtK)>KAYgqN{>KubBDr2WKF0U9DssXNuW zL%Jw(x|afk!6Ft^piWH-q~BEhUunHz9f_t7LSBIA6o`j~WwUl%Xb_041%yUvDA|4_ zoLJi;1*e<#7yM8wR=!B6qN~!kk}h+tn9l zTuf6`6W+fi0eu{}djWF@7+SDhX*AM~B}Ug$ljoiHqz!VrnN~aTR>SY_NDQ#4*#SJN z^3$KG=j0TckKH|7N6=#Xa{{76ypW;oqU|bnc=N9iy~=x8Y~O4<)pzuMRU>(O8|kGd0ICz5o#{5~PwjW51Ky!ag>O8Z zIqIR=Q;qj%iMF{GoGk?=^Dnf&umT0rkb|GzF#@ulR&JbI`EyNfPy*~`nWXHbBrhWl?@4h~NjUbBfK7z#9Jc_<2j3C|(O8t!C zEmE;o0Os;CD&k>SS>29P+YPb8|CHYqeWpv?%=_Yeg$e}6fDbOsGqQi95YE0%e4@wv zp$Q#*gO15NEMxn|Ayj*{j>+4rv;Cyo$z;or3d^a;H@znhdAyl3{mz$KoO=zoeq4b% z4?|P1;u{ZR7Z{jfP8cx75u9;~#tim20fwzjf9Sq?s$RC@)3D7Ndu3Lewv!XWzdrq6?<8Y|zO|Nc?%Dg8s(O8|cz z4x5ehQyL%W#~3>tq*Ni8OM+D{{0i%mV0DYq)z?l>!RC_}P6w)Zt_*@~Hx z*fz3U_NjC}eA9nYe9z>a+Gg`dR@OG=OsE!;rb5#IkJ92|R`ZrPeA;P6Ii0nSR; zaNEafIR;7qg?C*fwdQZ-YxbC^QwD3|CYddG3ZltU)gzVq1e1+@oph9x^wCQU(QgwN zBj-neBW%@}or63Q-XkfW8e7$#(=pYfA@b8@C1;o>7~o>XI$dLs3ruoW7ykLgJzL8^ zWXr)02$d6CQ05fPP7pp83RV*?fSl_BE3>#Kyqt`toWIZfZ=IpPpnl7hTBeyVZ&zE^ z(-1BJgMNufV_*n9X;&t4*)Wyl&(l2??~66@6p!*m_muik+lj;Cr$$|RkS$qv^j}DT z3e;v+)T;tFZFrA{pJr;N$_wydCq8_~02(FJPEGKCi@-*?)F&mquBm#80aWc7v`C;! z`K<>S@A;Sqo4a6#9Ws0T`4v*o}%wXav2WxxeR`{{=Sy|aXC!_yr>5qJo{Jd)N)T8 zy0%JfSHG0)iqA@Fd`^uk0i>P>WxH9N=<)jGdQtZlYub5f3{z?w?PE-|v(Xz}s*s+P zPx(5gp8>EmBy?D|@}5jk4|<41Qp#_V?KBS38v8)!vV6;I!5c$Y3zXf=9Ck>aUC(03 zE8%)l3pDP>AFJtsAR@>^Je|Y zk3SxAPFE6MrvUGBVsv>}Al`^mswEy=s>RjUa3Y`!(wkW2CDzRX_+^ zTeUUKA5?>cfWa^^mbJ;CL@i!(Hu0wQL8VS@WPb~pOtj|i%`+QE09PU4o{ zgyUIx>8jM8KjP*>RXuot1m z#$R~_zcO_-7xgFOabCGtWfuW@M1SBSNW(%_Cp+w|IPH)S1;p9k_jTS2WVm#eK?!`^ zsMTC#1z~m~zl-BvKMbWI3NogZUF6AHf+DR;$XX_O;z`sK|JP%Zgu+UkhuX#`7iWYh zwibxre+?*Qc6o_SoYzPodV)G)ZPCOhj@xzQrT~{?OjuUd_78^1Kv4@GV=L9X?d227 zYyo1pIu7?2$nMzi$99{$hovf^ol{= zs$28>Yp);E-iPwxUR3opK3@-PAFSGvoJbz3p8}vma`DPsTxcGXTU4Zq__*;2Mhh6Pc7U2qTP2qLN7Y3Dd!Vgpshrli-yU2K$@z) z?EoMkYep+uJDM+1P4S2|(OPsOCLsQGozG@0^oyp???q^OiqB86n1vXck(a7E%NR`=aYFrOachfYb2QM>1E0S(-aYm^@`VTTKqVlC40NV zN_kzB*US^RXi-$i%u+-1xXXqpZCjs}H!%nx#?D8*EhnE?=zcKaH`Kh~#q1qEBx0#z zJzypd;rSLo--YeCw*S7+O9`_U4#HUO7`0Nq!J@wg-)mH+xw-8?RZ~8xE`KBjRs#(9 zsk=wcoYg#2Ls#B$7a$l0*(4<`_)mk;SGcAm&pp`W&}hh}`QB@y9oA7jcKF!@O`q!L z=DiTT9<|l~bFn$>*?^O;V&jRXpJ`v~ z*kEj07-0twa-$M($?|RaC4nVoR)C;z6+-k*Sk2k?612^2M{L5mEBWc=xoL9^kMIdz z{xy#{5?+zSVLHXlIv6`Fv~KqWQSknd}t{u91A@8zzvOC1N;c~ z3^zR8&k3c}(c~Cdu8X-j}NhKFDjB?RD@61$pI3!9;5EiYSW#-r*Vk?36-p_@i25@Eo`yfMNrggu-NM{G8>qu@M$+N)A4$SQ_|Pp%6xwINk)q@ze|w5n6pifhQaq3+Lia^q)UD)LV5|u&#{~{|@fCH+qyWhc`YKvGpeJ zO^v0=#};{0Rz|cSm0l70ZpsgIMP|`Qa)zq-kO@9jhf*l0dngE8>wBerx7}0{Et}gh zItDZ2K=@rhmq*>;o5@R7)sGA8YU}y2hk40Ac(kA6eI7Qc>MdDh9yGN=Je|f8ouH!|@^2Y!T&9DV(B*!+S z&V_%}a*<8X1>v*m@cYNqB}G>jIr;I!nD4{($JU>lo0sj}j~h`$P^}Qav@k3k0YHVX zI~_7Bj14h1TEmPCF9CU=KDda*%*@L<`i}$r9y#BiWKV;U!3l4!=|OvzM6Zx&hwj9% zjgwu3?#Mp|^at$iNz&Je&YT9g0~hI!PsH7U<~_J^{kj>q_T7HIU5jS6;;mjPzt6tS0(;J33uA@3wV$eInIgt)Q(XOiVV4_i0iX!qSA?UI*W|3C$SNY3|xDB6qs0~FSznBq4IPodm=~)RaI7ZsSym2Z15>vWE zk;D14MIbK;D>4RT!6wbk1vxMK*15Sa_@})_cA-F>DrZZrT%%!=XVq7BSf+x)gu&9X zch1IRQyPd&n02C;sC*f_4#0r@H>GUWn6;pEA)UHpY6^ws9DidgFg*v^UQ+F4MNSkM zJ!4mVa`2b}3ws2qVfG%$scnDpd~D7}>`1d3!>Ef&OBmY*X&nnYeXc`WsQjSH!BBf% zeX0hc?Ny1EDjw}p1^yh|z`u0&m2{aa>AG|?S$iv&+o;Oh?NZvT1Aq=;)MCHp+<9?z z7J>b!QR+20SQUkU$d*!GQI?C|$y*@ZLBjJH(S~`Mzf4jwy)vmmdMot|3>-qqeTb#C zCPSe)Cg|_^_$uj(7B+9GxA6E$X~Y;5+s0(NaS5~xFPmjwr0i>R5F~S@5w3$;J#rSB z-SM7xyKp~-o%(F32LOB{fm}PJ5-r*|t#3dj++pfeLazxu`XD+e%qjJL-3*@k6|S!B zpb3UxBsgg1?$&$z1EjZnSN63rsBX6krMGnVf~#y7_q8-w63q`bj^>qvg3M2{-}8V-n1Z-+Y8>m%XTjy1 z^|;2TG8d+NyTJ-Y9;CoQUS8LNR{9H<_tW!Jv_B~wsXQyvz;ndyv6zE8*;Jh2@{ouz zw?a$Wm)ZiX7Lbk12C|}W5^EZC}i+QhKGZG2Wkz zB^rBV53Pqvz49#k;aQUFFatWpp7ySxr0DB0P0HK$2q>c`J+SIhv-|~8G-9HY$xxZ% zrcQ3*502i&95tP-x-n^^Ia%DAp42n;P;0V%-$6H{n>hhu_JSwNi=%%eFx3jn7_NVq zA^L4?)7W=@q5V**ZOafk^vS{lB~5LB9ee_Q6fXjeFw#+=#DbZkEa+}1?WcLw;NBTS zI*b@>4k&Rf>ej8wW6wWw-Lxi0VbF@|%jq(*0P%b+9H2rCO-X05htFztelB%C1Z~_S z@pqsxDtJ9SSt3WKg+QPr7Hd&_>fIr_g)saCU zb}i>f;#q2$z`M{D5kUHW3gFFE+{AxuAw-Y2>TNZCqY@j8R90hSiyc@&dX5{|K|+Wo z0n8#H#FDHsL7V{>R`%yGXNCW(~4fN9sPqpClYT;?;;Y z?S~R!Tgv5$31Kr#5Klk7@Zm3De-XLQ1N_=)i&*}4raRZ+3o5{t*W$AlsS>=Li9k7M zXOYx#MMq|{aArp~SH8g)2pbOjvaBBptKUiTkayhPcc!yT6t5|b5tSWnh;3hVtMC3`gN1A%6SzAKyKpei`qX@3*cl2n@w zpHd7$&~z+7BJV~KTcnp(;;b2@W}>wG|hd!d6)x(8aEHGu8@ z68so8l|FOkxP(S^xG z8pe_irx0hf$=uzlhch>}9&@PrCUtC|6)T(@l4bl<9${_TK$L-Jlb@Mf%X#6xSWLP_@y)pzu%+?~O*8tfy!=Md8Fj;gj2k;=c3dZ{wQ&Kl zw7Ih(`q%CFigqwNC-6E6&>HRCYxOqvGu9kdDFn49Oor@V9G+WG{Kkak&D7oQX&=3} z*vt2pOCdHBwpxME7r#g2VuLM1k~fKB&aEzL@M&1o-81*yPn>kU9N${2^jhq$mpe}W z@^zOJddOb{jJ8r6Yfa@{J7u5Wl_>xgtOZTev4f(mDitg?d=b>~%7XS@-S@b=VpomB zk6~}HR9ZON5INqISCjkIDLYDBG76IaFzGdt5Kj0DiGyg20>Kf+Fj#2^EssFt2ndfk z=vLMll*-|>XpA<6&}|4BMWLAN$#0I}qV!D~_LpT7&Z^MbV zUY;#{4Oi_$&wfl7DV7pSIBA3#4ZyI^epz5!hmC+89U{1iQ0oRtu=c%1ykgJ>{QlOi zU{H;o;I+fhv~qx`a#Cl8TRWr@Nr)jrQ$PmcL|!wJS}mlLIY3LvqngeWqD@sm`kEg! zD+kkp#?ciDqBlv@hRJ|8OCJHy3r&$_S7g|6hzR=J8)sm$jr&&YYg+v&u+7UCk2@1_ z>$5fQv!wysDFMJG9J;3F_VHKZ+*Ze9l5R8{6y!F6W@BB;B18}x9Y?26!U@*T?c-TU zh8JO?3SM4$8Ghm?JPc8j=U&)9=cngTB0O`~nE+e2d_0bkK-n+;TbbDZZe#wRe6yvj z`OYdD5D*-;3<*jn^(k0+1R6s zpnqc8*zTyG9{rb#;L0rkhHzzkQYPWsO}l+u@t|XRw5mi<^uR}u{*WDq^VOPp)!3z6uWY3moumwQphx_Y}{ z4e5@vFG(lw<4NRJ;jiukW&dCIu zUa89s+U|=mTG+FYP%n&XvU-!=J$tbBvsDP>TGiPpV$~owxkwJ2Ub3O4JlUY|`q$jy zH%M(-nP;9i*E@*&7___LXh^b)MRQ07-%~5#E+5tQmqq|AG-b(B;2b$MLrE>%Wur3W zYMD(!6Km!pM6Q%Me`R}0b78cmvgGK068reKQ;cGCnV}|iQEc0=#8e}WPKK&AugTdl zF;NqQw_zp7OOVjroC&urA%~t&@Vd16!=HW8Lod`%qVE+CH?J!Hp7KBpYYo{@g&u?% zHB~2XT^I!1$uvZ?7m|DCRvflV3m0kBD+Xt&-uE&i8{-%!#bsz5jXb$)sib!mHw>n; z0)$Oz#@TpCD(n7cEWWy8)e`bevfZR>#7{g4AQ6DNsAk8;{_^G6G)W|QTt%+yWrO^W!nI3QMHck^`{TdnYx$=LLE2I2D_<( z%p&E9tXqpwjH|j_;Af$&YN6V)q+y%&>_L7H(5-Z8S&oBHE`-Z8vwIGHgqkxQ{qCj* zUI->uq1Q|dFT$lSGT*={Qr(j~ux0xWlJI5wCRu2|vLM-9&av%(y5ov>A0es9UW7IGYMeA(N3Dll5ARktZv~b2yG~H_)kjGTnvuG1!O%|dZC5laxxip^0Eq} z;x#*u2{oi?SbvrTurKUY4ar2ho?s%XU#3TrHnx;sv2pcVHK<6436l$AE0XKTp(71W z)+#g&v*<2GGn$y9R6^w3C0BJy&IXl`wjluYD(6g%=CK^&ur+9akDFqJZNu4tl8ddE zJb-;uv7B-;!b6j!BY=i>jck(tyOrwmt_^swZH!gY2=%C-vCcs2GT?H;vdBCF2Z5A+LY zm6NNUdj%$YJ+!z9mF9#AYvSo|8W3&GaTpMGuU-dpGBw{NIt&p0_Uv_1P0xF@XFB z#5aYUmwSDlov9b8CdCtiUf~l1pMO-~l%Sx06LZhrb47jaNN9rSR{IEujOm;bMftAJ`_+uBHRcY;H3*HYZQw75fYf)pvP!D(>_ zT8g`Six)4_0)gW0UPy5$+{Zx9>r@TyxgpOwdDZQE6qX`83d!u|TG>uWllv2N1uCD-fFf z=E-BDWtlxFSBKMUy&`&10SUY?)Z$RgNQj0Q{Y==Xv5neOlxL=0q+NC+=4DFl$d0N`lqrus-EoHm##DET>GK|MIA`|Jr25@xS10- z1YL+1no?aerIvb69BdECG1` ziZ9+YKo^f=-vE)!A$Ztzv5Rw2L!YQJ&-UJ&dHw{mS>ovAKyU1RRE$7fm)+B!{NWd@H9w-cyZTyT$@2M|hE>}%oGJv*pl507_ooaRo4cMrsXykO zSqx`yM(t!YVW>K8lq*+8Q>6^Q?s=L`b#%m&67~`%&&qnUs}KjSJ)`aCGZGgOh>X_U zO!xQ+27au9<$44~JXD>%xUS7uv6xL4{Wt=ix)BPZW~#OV6i*rdh#Yf?2Ci;=wBr;n z@|wJ%O>TcEKl^xXll{Q;Ek}F~;D|;XM)YdR?OV$Ay3|J62T#BBpOt4~KTPvrdr=5e zv71#<8bNj?Ol6ubVVJ;4L)|Y$A{oZrANkCLRp|Xpp z{$YfuZJiHKt+G|ME|}=I{oPEn&!3^Xx0%YYEjb$@H`D5x@L&7c^yVpukda!&P}j1C zergb#5@C6jeV+8q78CVNbysD>!NrTO*Y(`~>h8lz+;gZ#$1SPuHH@8#w`#Quuq^d; zBycHb_iH@q$_CV4j22WA@_8F%Vk%UWRMdJ>(38b=ih?cjS$XHYD&5m&Pv197;>DuI zIBE{O*mH?zP4XKmu|CFA1nb<~Nsi@Ep*5H>-Q@yjbAJnt453n52>#OCsj#z`gIe`Qi1#wT}>Mk^c@6ljCVd?Dm-67sgS0gLLQO}55- z;~3d-#93!rQ|zo-jqLl=se~9C-N@uX+0h;b?`TTOM)2p6%rdR{D#FY`D zgGo_5XGzQeE;||Zs3eelc!u%}JH--#E+esRk9gvN_Wh2aP-;|jt3ticcb8d85K)$b| zdKIRZ=~#wH=Bd>8(GG2l8S<mq5*mc-l8cBUd<(WO?o4^Hp!BmO)S_@7YBqTVJ)LX_EJ{r~0lL@^NK(}6 zyIqSfyxCF^qZH$?=ll|a?QYNhrBK^m(ljhnD~mZWq)WLdN1j>lIfHJFA7QHr`8}a& z3_+5u)QyVV$EK<%#Tprbiu`jLijXKMy?6Jr914Achn1{ZEFPZE9SH2CZQo6Knv$-2 zu4RE2=N~+{Dxy55FyY3>sxLFcB>3i8p*AQp***0O7ssyFEx#$+8|!=hy~@0eD7_b9 zsU~yAs_pxzpvM?~E6Tza(`yi%_>+O6yeV;v1h%U9w)oIn8 z*bj?UaB5J#K@0bkx)Q;q6WQJZ>NV&-exUD2-uZVWK$lcB@fulH5u5R(bPhkz0nMbG znJ>BzUfR`!3cWWiN|xXLR^q4TZsR?imXnWhws9puMDKj>ZxMI$`)BAPgoB2ti0PWm2c{!VS!H1SW3RGiWR5n(Y^=47 zY!AY~WZQ|-vUlA5U8cM{19QzW4$#_AE6TNnFRqRPRErobp2)6bhz|PZM-&&iWjM@S zdHd%$x6H9b2wz;FG#L#<+qPg4#NzI+Bs>r8ayveWhy7>1D!_aBL+VsFIkr+^bKjrQ(sKmpV!h@)E44bfe= z)h>C>!5ggz>q4q8m@H;&Ut*S2<=}R|_sx67y{r~kH@{!^BZ2p@3sKI#}||{p<+El zD+nbr76mv2O1+e&kX^lhoVb@Ih+RgGm4L}y(wFNFl z7r9_nPY=Ckpxgh%9)eRCagLwExc}9M<`Z6@yf(^8&Cw%Lsr=+U$aP?J&U-5a z)N?R9l(yHR-buLi>JoZg(h!<(p>;vwyjQrbzH(PqGOSyNWX4k#F}{AA8rSL3mffjO z?+-ltdR&qk*wj{@Fa}D#x-~PJQp2IQK5MSK5S^P?l(Tyr5fB9mkmfLOQBv-nos)~p zN+KEPr=+-?u+BPS7T*Y%dro_j&kUGjpaElUgiqXpI9P)U)~aYkjm=-zM2+p|yI;v> z$re?O+7}+wDjd{Vv_uT%2NKT&VPE+7PrCn2#AlngOd>(!o?7-CW$i!#;r1%{Ky9QjJNVG{Er!E*St18gr(I8V7`S9& z9Pt_LlWMf%7f4+6qG3TOw=^1;lP=voIBlXiIojr6)|ike9o|Az#an-~kWTz^n73iw zZ1TAGqkupF?PjTB;WkBQ9@GKHK76IHoScZR#homPbKx~pRur1dCGXdIfenBUB!fcR z{HS!Ny{tIO=x`MCGmS$#&>!h;8k{U8v!kDKxp~B8-|D${?@v6z!d4&-@7ZfemnW%3jn)IBJc?|8A_N4HUEXzFc>1Fb?T6v;g#X;0DVs*NgvXjSg z{yKfGALcdgH<9nUu19J73@^YmNH@xD&TAcUmWdpw@~XKB$U$Vcre$BfY}}{)wx|jo zEG`4L*x!{XlPbJZ!kSkYol|c<%GW(A&9hMXlpA)9k33Dgx4r=mKa>eS4qZd$0+U{Zk52d%I$A|mb>O8 zY;3+bcWGgRTpVRT^gMG@7qZ8vh805>Po@~+3c4={c*k*2GMnrK{h~C0=N)o455?lT zjMfRS9mtOOQ*h4|Ws;!ayb6&5ekgjI!<$WXA*SP20w>*R0*a@HOKk$`0 zXmK<0JkNtt7B{cxhX>2Zvu6dmy12d z{hvo?2cBrsUtvj%DA9JidpS*8roW>xvIoS!d;u;$(&bc5MVIl%Ky@Mzq#}3^6>6dJ z>}REIpUY-8d}FpFp6r^9ad3&0Mfcc$?yzp&KOjq}`^yTIsvRA;wqp35_aerptmy&A zLnP6g;3{P5D{2;HJMuMWpd~dnx9deu%QcnTv1gGrnChk>B_PjwmQB)NwnjSuomOQT zz_NlV3G}gkJ1)(#Bhq-|%7U3i6@JRvUlPVQmwBlfE93jxxoVg1S{lEo{j{f!h!#62 zRbgxOLL8^m^5+BUFVevy%tp$A%3oqOpFVB=Ql_E41T^*!bHn)u5I4Aq4ZVEyFXjPR zNV*{@d<~uk`fq&%o*62zsrHmKapbtH{Q}{h_YE-t@j{-wj0R%N1ZlONt5G+=B_m~! z(20my#b$7ID`ITUZ4e6_EHwgiBFtNMw(AhFYuxQPk({48A76d(5z!pwQWigw1xXyI zyOA!oHxeNWajsx=SJ2vij&u#>i*9tDMv496sVX^ymBg0_@ z7j0@x)+2`O3)2BDjQ*vZ$b#8z%$al1#j9ua5 zVEt-+KRn8WbPH{W=oFBCa;eWAafbAG>|_M<*nQO?=C*HZTXoRWJ<}+EOhvb;V^76V zqL|yMo*P(V_=ukg+*dW~sa-Clb2F*K&8?#ybh7g-T;VJD92k+SQcT=It)?#i7O6t1hns;&BKVld_U0j1${(Ou+Cc0J?rscsm8M%HE zKgtygS^JcMK$}A#`+zQ5>gr7qXjjM3mg7ok%STj{b2bLyn_5UbNA7o-jSRALFOd`X z;L1?~>c1QKhPc4R)hyG|gCWxHUY6-irRAKyE3JQC0p9DmG7mxCu#zEdp^Hh}3Ar}F z#}HBrl-{e_>j7}T?hfU2mtmBI@2m1`oAH!;kqtLOW9#S+O%m?{5(!AHk%h7XrITrf zkhztEQHEd1q}|XVl3J4qwMx>l;mPlWJ~B*{;2x5bR8BXaq`TFI(&4fuo??Pme2ZiCBTgLvwVJMEW|euQXe6I|5COH? zykuw&Z_XrtcH~G!U9a8$@I}^MCGXAh2@p8xh_G|PS$`=m*`50#>J*n|b$AQS*Xv2R zH|!c8yh7dU?<3xu8ztw%lW=0SQYh{(KX@m1jZowDxms1+r|9R(8L*;>@r1`8*n6e^5^T}ER@X4t_?{;y%!q`mexZ}aKS0wMPGF) zA$tKa+gLS&85^U`Y=6P_U|oh_cb;%?33PQT{Lxq=j-+y zjqVsd+O0ZHsLG+>|z7Vu)J1tp0v6 zRqZFegh_W7rre>{`?Qtm>g^?Wp~KiJi`w+MCRsJ`EY~8lOo5epPQd*?$_i z3@YV3CES2Mu&7y^`UF3n2P})UfBTV`Y!a0j%k#3(exWEg?Qmv}`%8l-SgoHe&v4WF zWnlugR|2xUs6d$ z$qF8wk>fBxRkf%^8(enAK4OCslUTO}CL_(3fvA%UH>UBKEE?RI3)2ko1hV6MLv?B+R-2vpsXQ8~&e5Rvfmph*6f4 zP6JEeYJO`74~ZC3ma-Df4H6~Ij=?4%(xG$OO_o@nsOa1cJDqOH>NN3=VNPqs2(s3X z3YXVUmiSpB`t<8qz~CCocY!c0(jRI+R0nE(FDYX+(kZzPy8)!&tmt;P#d+&ji(Jbi zD@)%6)k$H-Bp>@ubbo{hFvSo6z&bFNABKZ3bbgS4wPA3Q(x8;?4=g)Ir#(Jk0Xu^~ zwm(CI+UjnRl4NOV9G@I*9J%3(_AzEcn=yu3ukt`c#xVEu9FZ6@K6Zw%`NYO+&wc;2-=~gFJ z)JAYSu^m)81)S5MN@!M^@^War(WdNT<_@RS}EW1Sh8H&!QS#k-}hWAre zF+6FLL=ELbIj;ys)zOqaCLSv=3F&lU-Hh!RG0(~et}=Zlcxw05tH0NMbzv(*5Vp8s z%Jk|ufR?4v>GZHO=!5uv>W2u=mt8Jz4I@ViPW?YU$%cTtT4yyD)NEe{zKaOoYtAUG zvC1vPOm4~eN%JLNDiYJE4v^inAX~}qF>wpXxd6T)Fy1V!}OnHucI*+KLI6-gbh-I&=daxa$dR5o>J_9P^i=RnnD=xzq z9&w~=a#??!Lhr`_hUitD4ym@-9^rRrao~7diOCjIQKL_cmCp$tVEAw&zHp_&sqc3S zw}NegVj+*CPR+&Lkj^YWz2=WAVH1q8_mRZYHsA%vrLl2(T#}0TS6jN&H+ttcdK37v z@<+sEe_I4tJBt zulm#nZi)XH=0ZFcOEA(08f=77tsiKU54t1rS)r*}4rXdInJmXvl%f~C4P`G>E%|sU z$P7xS+x(R7mrd5 zTC6DaU2=OW==n?~;vCrpYSMM~8>P@wkuhj$!jk_-(@F?Myfuf^-$ zi{)hWir$*~ldIw-j4Eh2s_1EJev3$H$TQ@MsLrttXUon4nJ8Ovgf!9+iEAMS zRHC)ipquDFssXN%wRGQ^uAzZQh!s?eWk`Id-%6{k2|5@dDG`+tJf$)XKyR*p0@fYT zEZ3n{Q&z!$D~mbC^qKb?<7@{$mMfXf{<8eXPegg|3%Fk@m@b$AeZ5$+w-C7cV?aD~ z4f-+{fN+~7k}9T}_85zU!rL|N>H;-q%r?_ktljF{M-p1=>HZS=j$8+m2L}x61ECK& z4@eqnh)Bf9|FBZvD%=npYz)ZFCjBqLZ~#PbixvLZ^-CM{)fUxXR?!ylFKc;=18!k# z>%&`%ZH?b305ZBQ@t2=whXrma?wG;b;vEpY#ohg7zueV>x0R#-$nvfz+=5X7Abfk` zaLak`S5z=P0CKvg1h<~-+r!&}eRraNiu_w89Kw2F0QZI*0Fes#A?vI_$nXKYZpe}l z02@A%-&;{gp3rYs&LJv<>M<$g`Qa~J^7SVGh|3`+Qt^|&oWBMK6Z>~wv)JEx7)NAq zH~kS1sX^jzaN-CR=l>b*f6XE!6dq6|{jY#uogNX`%`Y{j*rtmw!PLbxX zQrh4khYB2IfaIy5qWz~c+;2dnF=Gh53G3gGB^+9`fRXz{T5tAFrI?BF#8JzMarB|1+(B2)zDh`r!Mb z5IjeSvkRrjA9}C{C>r-nTF z{_E=7z=38693X+@o-xCLK{(Ly7Q&ay^Y`_mKL;WOXG3HzNFgTY#Q&=CpG6f22n>Im z)FB5RP9^xCB^LiZuYc1X;aa_a&MR8!uSAGz8PWe-j6WD@f1K@0IXvmt?*Qe%zrP@x zUBAawbn#1S_`?MdDWT^#FguKsJVgHY@Tf0=NbY^VJ^Giw?m#y<&_41TpoLQZPaXgK zq4VFxkBO2Xlh8hZdLJ$yy;U6Fo0)qPTucQA1^@o1p diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 99c3f1d98..9b1c73eb7 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ # # ****************************************************************************** -# Copyright (C) 2014-2023 Dennis Sheirer +# Copyright (C) 2014-2024 Dennis Sheirer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,7 +19,8 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip networkTimeout=10000 +validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index d461c8cc7..3d21f3546 100755 --- a/gradlew +++ b/gradlew @@ -2,7 +2,7 @@ # # ****************************************************************************** -# Copyright (C) 2014-2022 Dennis Sheirer +# Copyright (C) 2014-2024 Dennis Sheirer # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -88,9 +88,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -136,10 +133,13 @@ location of your Java installation." fi else JAVACMD=java - which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation." + fi fi # Increase the maximum file descriptors if we can. @@ -147,7 +147,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -155,7 +155,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -200,6 +200,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java index 0ffd851c6..c7e083bab 100644 --- a/src/main/java/io/github/dsheirer/gui/SDRTrunk.java +++ b/src/main/java/io/github/dsheirer/gui/SDRTrunk.java @@ -55,6 +55,7 @@ import io.github.dsheirer.source.tuner.TunerEvent; import io.github.dsheirer.source.tuner.manager.DiscoveredTuner; import io.github.dsheirer.source.tuner.manager.TunerManager; +import io.github.dsheirer.source.tuner.sdrplay.api.SDRPlayLibraryHelper; import io.github.dsheirer.source.tuner.ui.TunerSpectralDisplayManager; import io.github.dsheirer.spectrum.DisableSpectrumWaterfallMenuItem; import io.github.dsheirer.spectrum.ShowTunerMenuItem; @@ -152,6 +153,14 @@ public SDRTrunk() mApplicationLog = new ApplicationLog(mUserPreferences); mApplicationLog.start(); + //Note: invoke this early in the application lifecycle, before the TunerManager causes the sdrplay classes + //to be loaded since the jextract auto-generated code attempts to load the library by name and that can fail + //when the library was not installed into a normal/default location, particularly on windows OS systems. + if(SDRPlayLibraryHelper.LOADED) + { + mLog.info("SDRPlay API native library preemptively loaded"); + } + mResourceMonitor = new ResourceMonitor(mUserPreferences); String operatingSystem = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH); 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 index af3321850..9d7a0cc81 100644 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/README +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/README @@ -1,11 +1,12 @@ SDRplay API -All source class files are auto-created from sdrplay api header files using JDK 20 jextract tool: +All source class files are auto-created from sdrplay api header files using JDK 22 jextract tool: -Version 3.07 is the oldest supported version. Versions 3.08 through 3.11 are all functionally equivalent. +Version 3.07 is the oldest supported version. Versions 3.08 through 3.14 are all functionally equivalent and +versions 3.15+ are functionally equivalent. -We use the JDK 20 jextract tool to generate java source files from the API include files that are -located in the /arctifacts directory. +We use the jextract tool to generate java source files from the API include files that are located in +the /artifacts directory. With each new JDK release where they change something about the Foreign Function api, we have to regenerate the java source files. My approach is to generate the java files into the source code directories alongside @@ -21,22 +22,42 @@ Generate Source Files from SDRPlay API Headers - Download latest jextract tool and alias the jextract command. - cd into the (project)/jSDRplay/sdrplay-api/src/main/java/ directory +Note: each version is auto-generated with a _1 suffix to avoid overwriting the existing implementation. Then, +you can just delete the original implementation and rename the suffixed versions to remove the _1. Then, +resolve any import or syntax errors to integrate the new auto-gen code into the existing codebase. + Version 3.07 -- cd into the same folder where the v3.07 header files are lcoated. -- jextract --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08_1 -l libsdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h -- In the generated RuntimeHelper class, comment out this line: System.loadLibrary("libsdrplay_api"); +- cd into the same folder where the v3.07 header files are located. +- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_07 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07_1/ sdrplay_api.h Version 3.08 -Note: API include files are from a windows 10 installer, with the windows DLL aspects commented out. - cd into the same folder where the v3.08 header files are located. -- jextract --source -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08_1 -l libsdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h -- In the generated RuntimeHelper class, comment out this line: System.loadLibrary("libsdrplay_api"); - +- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_08 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08_1/ sdrplay_api.h + +Version 3.15 - Adds support for RSP dx2 +- cd into the same folder where the v3.15 header files are located. +- jextract -t io.github.dsheirer.source.tuner.sdrplay.api.v3_15 -l sdrplay_api --output ~/IdeaProjects/sdrtrunk/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15_1/ sdrplay_api.h + +As a final step, delete the original api version branches and rename each of the new api version branches to remove the _1 suffix. + +Code Modifications: for each version, modify the sdrplay_api_h.java class to wrap the SYMBOL_LOOKUP variable using the +following changes, so that the code doesn't throw an error on systems that don't have the API installed: + //jextract auto-generated code modified to wrap with exception handler for systems that don't have the library + static SymbolLookup SYMBOL_LOOKUP; + static + { + try + { + SYMBOL_LOOKUP = SymbolLookup.libraryLookup(System.mapLibraryName("sdrplay_api"), LIBRARY_ARENA) + .or(SymbolLookup.loaderLookup()) + .or(Linker.nativeLinker().defaultLookup()); + } + catch(Exception e) + { + SYMBOL_LOOKUP = null; + } + } IntelliJ setup 1. Run configuration 2. JVM Option: --enable-native-access=ALL-UNNAMED -3. Add library location to the java.library.path: - Linux: /usr/local/lib - Windows: ?? - MacOS: ?? 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 new file mode 100644 index 000000000..fb20ccc3f --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/SDRPlayLibraryHelper.java @@ -0,0 +1,123 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + * **************************************************************************** + */ + +package io.github.dsheirer.source.tuner.sdrplay.api; + +import java.nio.file.Files; +import java.nio.file.Path; +import org.apache.commons.lang3.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Helper utility to load the SDRPlay API native library into the VM. + * + * Note: the jextract auto-generated code attempts to load the native library by simple library name without any path + * information. On Windows this can fail because the API library is not installed in the normal Windows library location + * and for some reason the system library VM option with the specific location that is passed in as an argument on + * the command line doesn't help the system loader to resolve the library path. So, we preemptively load the library + * here. + */ +public class SDRPlayLibraryHelper +{ + private static final Logger mLog = LoggerFactory.getLogger(SDRPlayLibraryHelper.class); + private static final String SDRPLAY_API_LIBRARY_NAME = "sdrplay_api"; + private static final String SDRPLAY_API_PATH_LINUX = "/usr/local/lib/libsdrplay_api.so"; + private static final String SDRPLAY_API_PATH_MAC_OS = "/usr/local/lib/libsdrplay_api.dylib"; + private static final String SDRPLAY_API_PATH_MAC_OS_ALTERNATE = "/usr/local/lib/libsdrplay_api.so"; + private static final String SDRPLAY_API_PATH_WINDOWS = System.getenv("ProgramFiles") + + "\\SDRplay\\API\\" + (System.getProperty("sun.arch.data.model").contentEquals("64") ? "x64" : "x86") + + "\\" + SDRPLAY_API_LIBRARY_NAME; + private static final String JAVA_LIBRARY_PATH_KEY = "java.library.path"; + public static final boolean LOADED = load(); + + /** + * Attempts to load the SDRPlay API library from the local system. + * + * @return true if library was loaded successfully. + */ + public static boolean load() + { + try + { + System.loadLibrary(SDRPLAY_API_LIBRARY_NAME); + return true; + } + catch(Throwable t) + { + String libraryPath = getSDRplayLibraryPath(); + Path path = Path.of(libraryPath); + boolean exists = Files.exists(path); + + if(exists) + { + try + { + System.load(libraryPath); + return true; + } + catch(Throwable t2) + { + mLog.warn("Unable to load SDRPlay API native library: " + libraryPath); + } + } + else + { + mLog.info("SDRPlay API native library not found at: " + libraryPath); + } + } + + return false; + } + + /** + * Identifies the java library path for the sdrplay api library at runtime. + */ + public static String getSDRplayLibraryPath() + { + if(SystemUtils.IS_OS_WINDOWS) + { + return SDRPLAY_API_PATH_WINDOWS; + } + else if(SystemUtils.IS_OS_LINUX) + { + return SDRPLAY_API_PATH_LINUX; + } + else if(SystemUtils.IS_OS_MAC_OSX) + { + //API versions 3.14 and earlier used a (.so) extension and 3.15 and later use the (.dylib) extension + if(Files.exists(Path.of(SDRPLAY_API_PATH_MAC_OS))) + { + return SDRPLAY_API_PATH_MAC_OS; + } + else + { + return SDRPLAY_API_PATH_MAC_OS_ALTERNATE; + } + } + + mLog.error("Unrecognized operating system. Cannot identify sdrplay api library path"); + return ""; + } + + public static void main(String[] args) + { + System.out.println("Loaded: " + SDRPlayLibraryHelper.LOADED); + } +} 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 index e0f1654aa..064f3278f 100644 --- 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 @@ -33,7 +33,7 @@ import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.CompositeParameters; import io.github.dsheirer.source.tuner.sdrplay.api.parameter.composite.CompositeParametersFactory; import io.github.dsheirer.source.tuner.sdrplay.api.util.Flag; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceT; +import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceParamsT; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ErrorInfoT; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h; import java.lang.foreign.Arena; @@ -44,35 +44,21 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.apache.commons.lang3.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * SDRplay API wrapper. - * - * Note: the jextract auto-generated RuntimeHelper contains a static block that attempts to load the sdrplay_api - * library. This approach fails because the API is installed to a non-default location. Comment out the library - * load code in the RuntimeHelper and we'll directly load the library. - * - * // System.loadLibrary("libsdrplay_api"); */ public class SDRplay { - public static final String SDRPLAY_API_LIBRARY_NAME = "sdrplay_api"; - public static final String SDRPLAY_API_PATH_LINUX = "/usr/local/lib/libsdrplay_api.so"; - public static final String SDRPLAY_API_PATH_MAC_OS = "/usr/local/lib/libsdrplay_api.dylib"; - public static final String SDRPLAY_API_PATH_WINDOWS = System.getenv("ProgramFiles") + - "\\SDRplay\\API\\" + (System.getProperty("sun.arch.data.model").contentEquals("64") ? "x64" : "x86") + - "\\" + SDRPLAY_API_LIBRARY_NAME; - public static final String JAVA_LIBRARY_PATH_KEY = "java.library.path"; - private static final Logger mLog = LoggerFactory.getLogger(SDRplay.class); /** - * Foreign memory arena allocation resource scope + * Foreign memory arena allocation resource scope. We use a shared arena with a lifetime bounded by the + * lifetime of this API. */ - private final Arena mArena = Arena.openShared(); + private final Arena mSharedArena = Arena.ofShared(); /** * Indicates if libsdrplay_api.xx library was found and loaded. @@ -105,28 +91,21 @@ public class SDRplay */ public SDRplay() throws SDRPlayException { - mSdrplayLibraryLoaded = loadLibrary(); + mSdrplayLibraryLoaded = SDRPlayLibraryHelper.LOADED; if(mSdrplayLibraryLoaded) { Status openStatus = open(); - if(sLibraryLoadStatusLogging) - { - mLog.info("API library - open status: " + openStatus); - } + mAvailable = openStatus.success() && getVersion().isSupported(); if(openStatus == Status.FAIL) { - throw new SDRPlayException("Service not available"); + throw new SDRPlayException("Service not available - open status: " + openStatus); } } else { - if(sLibraryLoadStatusLogging) - { - mLog.info("API library was not loaded"); - } mAvailable = false; } @@ -141,7 +120,14 @@ public SDRplay() throws SDRPlayException { if(sLibraryLoadStatusLogging) { - mLog.info("API library is not available."); + if(!getVersion().isSupported()) + { + mLog.info("API library is not available - unsupported version: " + getVersion()); + } + else + { + mLog.info("API library is not available."); + } } } @@ -151,52 +137,9 @@ public SDRplay() throws SDRPlayException /** * Open Shared Memory Arena for this API instance */ - private Arena getArena() + private Arena getSharedArena() { - return mArena; - } - - /** - * Attempts to load the SDRPlay API library from the local system. - * - * @return true if library was loaded successfully. - */ - private boolean loadLibrary() - { - try - { - String libraryPath = getSDRplayLibraryPath(); - if(sLibraryLoadStatusLogging) - { - mLog.info("Loading API Library from default install path: " + libraryPath); - } - System.loadLibrary(SDRPLAY_API_LIBRARY_NAME); - return true; - } - catch(Throwable t) - { - mLog.error("Unable to load SDRplay API library from default install path. Loading from java system library path"); - - try - { - System.loadLibrary(SDRPLAY_API_LIBRARY_NAME); - return true; - } - catch(Throwable t2) - { - String name = System.mapLibraryName(SDRPLAY_API_LIBRARY_NAME); - - if(sLibraryLoadStatusLogging) - { - mLog.warn("SDRPlay API library not found/installed on this system. Ensure the API is installed either " + - "in the default install location or the install location is included in the " + - "'java.library.path' JVM property contains path to the library file [" + name + - "]. Current library path property contents: " + System.getProperty(JAVA_LIBRARY_PATH_KEY)); - } - } - } - - return false; + return mSharedArena; } /** @@ -219,9 +162,9 @@ public List getDeviceStructures() throws SDRPlayException List deviceStructs = new ArrayList<>(); //Get a version-correct array of DeviceT structures - MemorySegment devicesArray = DeviceFactory.createDeviceArray(getVersion(), getArena()); + MemorySegment devicesArray = DeviceFactory.createDeviceArray(getVersion(), getSharedArena()); - MemorySegment deviceCount = getArena().allocate(ValueLayout.JAVA_INT, 0); + MemorySegment deviceCount = getSharedArena().allocate(ValueLayout.JAVA_INT); Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDevices(devicesArray, deviceCount, sdrplay_api_h.SDRPLAY_MAX_DEVICES())); @@ -356,18 +299,22 @@ public void release(MemorySegment memorySegment) throws SDRPlayException */ public CompositeParameters getCompositeParameters(DeviceType deviceType, MemorySegment deviceHandle) throws SDRPlayException { - //Allocate a pointer that the api will fill with the memory address of the device parameters in memory. - MemorySegment pointer = getArena().allocate(ValueLayout.ADDRESS); - Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDeviceParams(deviceHandle, pointer)); + //The GetDeviceParams function call returns a C pointer-to-pointer so we have to: + // 1) Allocate native memory to receive the address + // 2) Invoke the method call + // 3) Reinterpret the address to 8-bytes so we can get the returned address value + // 4) Allocate a memory segment for that address + // 5) Reinterpret the memory segment to the size of the DeviceParamsT structure + // 6) Finally, wrap the native memory in a composite parameters instance + MemorySegment pointerToPointer = getSharedArena().allocate(ValueLayout.ADDRESS); + Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_GetDeviceParams(deviceHandle, pointerToPointer)); if(status.success()) { - //Get the memory address from the pointer's memory segment to where the structure is located - MemorySegment memoryAddress = pointer.get(ValueLayout.ADDRESS, 0); - - //The structure's memory is already allocated ... wrap a memory segment around it - MemorySegment memorySegment = sdrplay_api_DeviceT.ofAddress(memoryAddress, getArena().scope()); - return CompositeParametersFactory.create(getVersion(), deviceType, memorySegment, getArena()); + MemorySegment pointer = pointerToPointer.reinterpret(ValueLayout.ADDRESS.byteSize()); + MemorySegment deviceParamsAddress = MemorySegment.ofAddress(pointer.get(ValueLayout.JAVA_LONG, 0)); + MemorySegment deviceParams = deviceParamsAddress.reinterpret(sdrplay_api_DeviceParamsT.sizeof(), getSharedArena(), null); + return CompositeParametersFactory.create(getVersion(), deviceType, deviceParams, getSharedArena()); } else { @@ -385,7 +332,7 @@ public CompositeParameters getCompositeParameters(DeviceType deviceType, MemoryS private void init(MemorySegment deviceHandle, MemorySegment callbackFunctions) throws SDRPlayException { //Since we don't need/use the callback context ... setup as a pointer to the callback functions - MemorySegment contextPointer = getArena().allocate(ValueLayout.ADDRESS, callbackFunctions); + MemorySegment contextPointer = Arena.ofAuto().allocate(ValueLayout.ADDRESS); Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_Init(deviceHandle, callbackFunctions, contextPointer)); if(!status.success()) @@ -410,7 +357,7 @@ public void initA(Device device, MemorySegment deviceHandle, IDeviceEventListene if(callbackFunctions == null) { - callbackFunctions = new CallbackFunctions(getArena(), eventListener, streamListener, + callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener, device.getStreamCallbackListener()); mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions); } @@ -439,7 +386,7 @@ public void initB(Device device, MemorySegment deviceHandle, IDeviceEventListene if(callbackFunctions == null) { - callbackFunctions = new CallbackFunctions(getArena(), eventListener, streamListener, streamListener, + callbackFunctions = new CallbackFunctions(getSharedArena(), eventListener, streamListener, streamListener, device.getStreamCallbackListener()); mDeviceCallbackFunctionsMap.put(deviceHandle, callbackFunctions); } @@ -505,7 +452,7 @@ public synchronized void update(Device device, MemorySegment deviceHandle, Tuner private ErrorInformation getLastError(MemorySegment deviceSegment) { MemorySegment errorAddress = sdrplay_api_h.sdrplay_api_GetLastError(deviceSegment); - MemorySegment errorSegment = sdrplay_api_ErrorInfoT.ofAddress(errorAddress, getArena().scope()); + MemorySegment errorSegment = errorAddress.reinterpret(sdrplay_api_ErrorInfoT.layout().byteSize(), getSharedArena(), null); return new ErrorInformation(errorSegment); } @@ -559,7 +506,7 @@ private Status 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 of the other instances become unusable for + * version 3.07, if you invoked close() on one instance, then all other instances become unusable for * performing device operations (e.g. release(), etc). This may be an artifact of the way that the Java * Foreign Function support is implemented, but not sure. dls 1-Jan-2023 */ @@ -579,12 +526,14 @@ public Status close() mLog.error("Error closing SDRPlay API"); } + getSharedArena().close(); mSdrplayLibraryLoaded = false; mAvailable = false; return closeStatus; } else { + getSharedArena().close(); return Status.API_UNAVAILABLE; } } @@ -602,7 +551,7 @@ public Version getVersion() { if(mSdrplayLibraryLoaded) { - MemorySegment apiVersion = getArena().allocate(ValueLayout.JAVA_FLOAT, 0); + MemorySegment apiVersion = getSharedArena().allocate(ValueLayout.JAVA_FLOAT); Status status = Status.fromValue(sdrplay_api_h.sdrplay_api_ApiVersion(apiVersion)); if(status.success()) { @@ -665,28 +614,6 @@ private void unlockDeviceApi() throws SDRPlayException } } - /** - * Identifies the java library path for the sdrplay api library at runtime. - */ - public static String getSDRplayLibraryPath() - { - if(SystemUtils.IS_OS_WINDOWS) - { - return SDRPLAY_API_PATH_WINDOWS; - } - else if(SystemUtils.IS_OS_LINUX) - { - return SDRPLAY_API_PATH_LINUX; - } - else if(SystemUtils.IS_OS_MAC_OSX) - { - return SDRPLAY_API_PATH_MAC_OS; - } - - mLog.error("Unrecognized operating system. Cannot identify sdrplay api library path"); - return ""; - } - public static void main(String[] args) { /** 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 index 1e55df884..133ca23e8 100644 --- 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 @@ -78,7 +78,7 @@ public enum UpdateReason EXTENSION_RSP_DX_RF_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_RfNotchControl(), "RSPdx RF Notch Control"), EXTENSION_RSP_DX_RF_DAB_NOTCH_CONTROL(sdrplay_api_h.sdrplay_api_Update_RspDx_RfDabNotchControl(), "RSPdx RF DAB Notch Control"), EXTENSION_RSP_DX_HDR_BANDWIDTH(sdrplay_api_h.sdrplay_api_Update_RspDx_HdrBw(), "RSPdx HDR Bandwidth"), - EXTENSION_RSP_DUO_RESET_SLAVE_FLAGS(io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h.sdrplay_api_Update_RspDuo_ResetSlaveFlags(), "RSPDuo Reset Slave Flags"), + EXTENSION_RSP_DUO_RESET_SLAVE_FLAGS(io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h.sdrplay_api_Update_RspDuo_ResetSlaveFlags(), "RSPDuo Reset Slave Flags"), EXTENSION_NONE(sdrplay_api_h.sdrplay_api_Update_Ext1_None(), "NONE"), 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 index 89f385876..ce9beca90 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -30,33 +30,36 @@ */ public class CallbackFunctions { - private DeviceEventAdapter mDeviceEventAdapter; - private StreamCallbackAdapter mStreamACallbackAdapter; - private StreamCallbackAdapter mStreamBCallbackAdapter; - private MemorySegment mCallbackFunctionsMemorySegment; + private final DeviceEventAdapter mDeviceEventAdapter; + private final StreamCallbackAdapter mStreamACallbackAdapter; + private final StreamCallbackAdapter mStreamBCallbackAdapter; + private final MemorySegment mCallbackFunctionsMemorySegment; /** * Constructs a callback functions for single-tuner use. - * @param longLifecycleArena for native memory allocation for long lifecycle objects. + * @param arena for native memory allocation for long lifecycle objects. * @param deviceEventListener for device events * @param streamListener for streaming samples * @param streamCallbackListener for streaming events */ - public CallbackFunctions(Arena longLifecycleArena, IDeviceEventListener deviceEventListener, - IStreamListener streamListener, IStreamCallbackListener streamCallbackListener) + public CallbackFunctions(Arena arena, IDeviceEventListener deviceEventListener, IStreamListener streamListener, + IStreamCallbackListener streamCallbackListener) { //Create the event callback function mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener); - MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, longLifecycleArena.scope()); + MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena); //Create the stream A callback function mStreamACallbackAdapter = new StreamCallbackAdapter(streamListener, streamCallbackListener); - MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, longLifecycleArena.scope()); + MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena); + mStreamBCallbackAdapter = null; //Create the callback functions union and populate the callback functions - mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(longLifecycleArena); - sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction); - sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction); + mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(arena); + sdrplay_api_CallbackFnsT.EventCbFn(mCallbackFunctionsMemorySegment, eventFunction); + sdrplay_api_CallbackFnsT.StreamACbFn(mCallbackFunctionsMemorySegment, streamAFunction); +// sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction); +// sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction); } /** @@ -73,21 +76,24 @@ public CallbackFunctions(Arena arena, IDeviceEventListener deviceEventListener, { //Create the event callback function mDeviceEventAdapter = new DeviceEventAdapter(deviceEventListener); - MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena.scope()); + MemorySegment eventFunction = sdrplay_api_EventCallback_t.allocate(mDeviceEventAdapter, arena); //Create the stream A callback function mStreamACallbackAdapter = new StreamCallbackAdapter(streamAListener, streamCallbackListener); - MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena.scope()); + MemorySegment streamAFunction = sdrplay_api_StreamCallback_t.allocate(mStreamACallbackAdapter, arena); //Create the stream B callback function mStreamBCallbackAdapter = new StreamCallbackAdapter(streamBListener, streamCallbackListener); - MemorySegment streamBFunction = sdrplay_api_StreamCallback_t.allocate(mStreamBCallbackAdapter, arena.scope()); + MemorySegment streamBFunction = sdrplay_api_StreamCallback_t.allocate(mStreamBCallbackAdapter, arena); //Create the callback functions union and populate the callback functions mCallbackFunctionsMemorySegment = sdrplay_api_CallbackFnsT.allocate(arena); - sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction); - sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction); - sdrplay_api_CallbackFnsT.StreamBCbFn$set(mCallbackFunctionsMemorySegment, streamBFunction); + sdrplay_api_CallbackFnsT.EventCbFn(mCallbackFunctionsMemorySegment, eventFunction); + sdrplay_api_CallbackFnsT.StreamACbFn(mCallbackFunctionsMemorySegment, streamAFunction); + sdrplay_api_CallbackFnsT.StreamBCbFn(mCallbackFunctionsMemorySegment, streamBFunction); +// sdrplay_api_CallbackFnsT.EventCbFn$set(mCallbackFunctionsMemorySegment, eventFunction); +// sdrplay_api_CallbackFnsT.StreamACbFn$set(mCallbackFunctionsMemorySegment, streamAFunction); +// sdrplay_api_CallbackFnsT.StreamBCbFn$set(mCallbackFunctionsMemorySegment, streamBFunction); } /** 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 index cbb686338..2113c45b6 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -33,7 +33,7 @@ * Adapter for Device Event callbacks. Implements foreign interface and transfers foreign memory event details to * native Java and invokes the appropriate interface methods for an event listener. */ -public class DeviceEventAdapter implements sdrplay_api_EventCallback_t +public class DeviceEventAdapter implements sdrplay_api_EventCallback_t.Function { private static final Logger mLog = LoggerFactory.getLogger(DeviceEventAdapter.class); private IDeviceEventListener mDeviceEventListener; @@ -65,44 +65,43 @@ public void setListener(IDeviceEventListener listener) public void apply(int eventTypeId, int tunerSelectId, MemorySegment eventParametersPointer, MemorySegment callbackContext) { - try(Arena arena = Arena.openConfined()) - { - MemorySegment memorySegment = sdrplay_api_EventParamsT.ofAddress(eventParametersPointer, arena.scope()); - EventType eventType = EventType.fromValue(eventTypeId); - TunerSelect tunerSelect = TunerSelect.fromValue(tunerSelectId); + //Use an auto arena to allow the garbage collector to deallocate, since we don't know if the device event + //listener will ever hold onto any object that is backed by our memory segment. + MemorySegment eventParams = eventParametersPointer.reinterpret(sdrplay_api_EventParamsT.sizeof(), Arena.ofAuto(), null); + EventType eventType = EventType.fromValue(eventTypeId); + TunerSelect tunerSelect = TunerSelect.fromValue(tunerSelectId); - switch(eventType) + switch(eventType) + { + case GAIN_CHANGE -> + { + mDeviceEventListener.processGainChange(tunerSelect, + EventParametersFactory.createGainCallbackParameters(eventParams)); + } + case POWER_OVERLOAD_CHANGE -> + { + mDeviceEventListener.processPowerOverload(tunerSelect, + EventParametersFactory.createPowerOverloadCallbackParameters(eventParams)); + } + case DEVICE_REMOVED -> + { + mDeviceEventListener.processDeviceRemoval(tunerSelect); + } + case RSP_DUO_MODE_CHANGE -> + { + mDeviceEventListener.processRspDuoModeChange(tunerSelect, + EventParametersFactory.createRspDuoModeCallbackParameters(eventParams)); + } + case UNKNOWN -> + { + mLog.warn("Unknown device event callback ignored. Please contact the library developer as this may " + + "indicate a change to the SDRPlay API change. Tuner:" + tunerSelect + " Event Type ID:" + + eventTypeId); + mDeviceEventListener.processEvent(eventType, tunerSelect); + } + default -> { - case GAIN_CHANGE -> - { - mDeviceEventListener.processGainChange(tunerSelect, - EventParametersFactory.createGainCallbackParameters(memorySegment)); - } - case POWER_OVERLOAD_CHANGE -> - { - mDeviceEventListener.processPowerOverload(tunerSelect, - EventParametersFactory.createPowerOverloadCallbackParameters(memorySegment)); - } - case DEVICE_REMOVED -> - { - mDeviceEventListener.processDeviceRemoval(tunerSelect); - } - case RSP_DUO_MODE_CHANGE -> - { - mDeviceEventListener.processRspDuoModeChange(tunerSelect, - EventParametersFactory.createRspDuoModeCallbackParameters(memorySegment)); - } - case UNKNOWN -> - { - mLog.warn("Unknown device event callback ignored. Please contact the library developer as this may " + - "indicate a change to the SDRPlay API change. Tuner:" + tunerSelect + " Event Type ID:" + - eventTypeId); - mDeviceEventListener.processEvent(eventType, tunerSelect); - } - default -> - { - throw new IllegalStateException("DeviceEventAdapter must be updated handle EventType." + eventType); - } + throw new IllegalStateException("DeviceEventAdapter must be updated handle EventType." + eventType); } } } 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 index 8951f1be1..065a8e3ad 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -32,7 +32,7 @@ * I/Q sample stream callback adapter. Implements the native interface and transfers the native callback data to an * implementation of the Java IStreamListener interface. */ -public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t +public class StreamCallbackAdapter implements sdrplay_api_StreamCallback_t.Function { private static final Logger mLog = LoggerFactory.getLogger(StreamCallbackAdapter.class); private IStreamListener mStreamListener; @@ -73,11 +73,11 @@ public void apply(MemorySegment iSamplesPointer, MemorySegment qSamplesPointer, { if(mStreamListener != null || mStreamCallbackListener != null) { - try(Arena arena = Arena.openConfined()) + try(Arena confinedArena = Arena.ofConfined()) { //Translate the callback parameters pointer to a memory segment and re-construct the parameters as a Java object - StreamCallbackParameters parameters = new StreamCallbackParameters(sdrplay_api_StreamCbParamsT - .ofAddress(parametersPointer, arena.scope())); + MemorySegment memorySegment = parametersPointer.reinterpret(sdrplay_api_StreamCbParamsT.sizeof(), confinedArena, null); + StreamCallbackParameters parameters = new StreamCallbackParameters(memorySegment); if(mStreamCallbackListener != null) { @@ -88,8 +88,10 @@ public void apply(MemorySegment iSamplesPointer, MemorySegment qSamplesPointer, { //Allocate memory segments from I/Q pointers, transfer from native to JVM array, and send to listener long arrayByteSize = ValueLayout.JAVA_SHORT.byteSize() * sampleCount; - MemorySegment iSamples = MemorySegment.ofAddress(iSamplesPointer.address(), arrayByteSize, arena.scope()); - MemorySegment qSamples = MemorySegment.ofAddress(qSamplesPointer.address(), arrayByteSize, arena.scope()); + MemorySegment iSamples = iSamplesPointer.reinterpret(arrayByteSize, confinedArena, null); + MemorySegment qSamples = qSamplesPointer.reinterpret(arrayByteSize, confinedArena, null); +// MemorySegment iSamples = MemorySegment.ofAddress(iSamplesPointer.address(), arrayByteSize, confinedArena.scope()); +// MemorySegment qSamples = MemorySegment.ofAddress(qSamplesPointer.address(), arrayByteSize, confinedArena.scope()); short[] i = iSamples.toArray(ValueLayout.JAVA_SHORT); short[] q = qSamples.toArray(ValueLayout.JAVA_SHORT); mStreamListener.processStream(i, q, parameters, Flag.evaluate(reset)); 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 index 143848966..d7b87b5b6 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -28,22 +28,22 @@ */ public class StreamCallbackParameters { - private int mFirstSampleNumber; - private boolean mGainReductionChanged; - private boolean mRfFrequencyChanged; - private boolean mSampleRateChanged; - private long mNumberSamples; + private final int mFirstSampleNumber; + private final boolean mGainReductionChanged; + private final boolean mRfFrequencyChanged; + private final boolean mSampleRateChanged; + private final long mNumberSamples; /** * Constructs an instance from the foreign memory segment */ public StreamCallbackParameters(MemorySegment memorySegment) { - mFirstSampleNumber = sdrplay_api_StreamCbParamsT.firstSampleNum$get(memorySegment); - mGainReductionChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.grChanged$get(memorySegment)); - mRfFrequencyChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.rfChanged$get(memorySegment)); - mSampleRateChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.fsChanged$get(memorySegment)); - mNumberSamples = sdrplay_api_StreamCbParamsT.numSamples$get(memorySegment); + mFirstSampleNumber = sdrplay_api_StreamCbParamsT.firstSampleNum(memorySegment); + mGainReductionChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.grChanged(memorySegment)); + mRfFrequencyChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.rfChanged(memorySegment)); + mSampleRateChanged = Flag.evaluate(sdrplay_api_StreamCbParamsT.fsChanged(memorySegment)); + mNumberSamples = sdrplay_api_StreamCbParamsT.numSamples(memorySegment); } /** 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 index b51e53c4f..6fbec9b79 100644 --- 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 @@ -28,16 +28,12 @@ import java.lang.foreign.SegmentAllocator; import java.util.ArrayList; import java.util.List; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Factory methods for creating new RSP Device instances */ public class DeviceFactory { - private static final Logger mLog = LoggerFactory.getLogger(DeviceFactory.class); - /** * Creates a foreign memory segment for a DeviceT array, appropriate for the specified version. * @param version value @@ -81,7 +77,7 @@ public static List parseDeviceInfos(List deviceStruct * @param devicesArray memory segment * @param count of device structures in the devicesArray. * @return a list of device infos - * @throws exception if version is unrecognized or unsupported + * @throws SDRPlayException if version is unrecognized or unsupported */ public static List parseDeviceStructs(Version version, MemorySegment devicesArray, int count) throws SDRPlayException @@ -90,13 +86,13 @@ public static List parseDeviceStructs(Version version, MemorySegm if(version.gte(Version.V3_08)) { - devicesArray.elements(sdrplay_api_DeviceT.$LAYOUT()) + devicesArray.elements(sdrplay_api_DeviceT.layout()) .limit(count).forEach(memorySegment -> deviceStructs.add(DeviceFactory.createDeviceStruct(version, memorySegment))); } else if(version == Version.V3_07) { - devicesArray.elements(sdrplay_api_DeviceT.$LAYOUT()).limit(count).forEach(memorySegment -> + devicesArray.elements(sdrplay_api_DeviceT.layout()).limit(count).forEach(memorySegment -> { deviceStructs.add(DeviceFactory.createDeviceStruct(version, memorySegment)); }); @@ -112,7 +108,7 @@ else if(version == Version.V3_07) /** * Creates an SDRplay device from the foreign memory Device instance. * @param sdrPlay for device callback support - * @param deviceMemorySegment instance for the device + * @param deviceStruct instance for the device * @return correctly typed device */ public static Device createDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct) 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 index 9ede845c8..18c579a4e 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,9 +27,9 @@ */ public class DeviceStruct_v3_07 implements IDeviceStruct { - private MemorySegment mDeviceMemorySegment; - private DeviceType mDeviceType; - private String mSerialNumber; + private final MemorySegment mDeviceMemorySegment; + private final DeviceType mDeviceType; + private final String mSerialNumber; /** * Constructs an instance @@ -38,9 +38,9 @@ public class DeviceStruct_v3_07 implements IDeviceStruct public DeviceStruct_v3_07(MemorySegment deviceMemorySegment) { mDeviceMemorySegment = deviceMemorySegment; - mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer$get(mDeviceMemorySegment)); - MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo$slice(mDeviceMemorySegment); - mSerialNumber = serialSegment.getUtf8String(0); + mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment)); + MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment); + mSerialNumber = serialSegment.getString(0); } @Override public MemorySegment getDeviceMemorySegment() @@ -60,18 +60,18 @@ public DeviceStruct_v3_07(MemorySegment deviceMemorySegment) @Override public TunerSelect getTunerSelect() { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment())); + return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); } @Override public RspDuoMode getRspDuoMode() { - return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode$get(getDeviceMemorySegment())); + return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment())); } @Override public void setRspDuoMode(RspDuoMode mode) { - sdrplay_api_DeviceT.rspDuoMode$set(getDeviceMemorySegment(), mode.getValue()); + sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue()); } @Override public boolean isValid() @@ -82,17 +82,17 @@ public void setRspDuoMode(RspDuoMode mode) @Override public double getRspDuoSampleFrequency() { - return sdrplay_api_DeviceT.rspDuoSampleFreq$get(getDeviceMemorySegment()); + return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment()); } @Override public void setRspDuoSampleFrequency(double frequency) { - sdrplay_api_DeviceT.rspDuoSampleFreq$set(getDeviceMemorySegment(), frequency); + sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency); } @Override public MemorySegment getDeviceHandle() { - return sdrplay_api_DeviceT.dev$get(getDeviceMemorySegment()); + return sdrplay_api_DeviceT.dev(getDeviceMemorySegment()); } } 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 index 4de672544..440af0978 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,9 +27,9 @@ */ public class DeviceStruct_v3_08 implements IDeviceStruct { - private MemorySegment mDeviceMemorySegment; - private DeviceType mDeviceType; - private String mSerialNumber; + private final MemorySegment mDeviceMemorySegment; + private final DeviceType mDeviceType; + private final String mSerialNumber; /** * Constructs an instance @@ -38,9 +38,9 @@ public class DeviceStruct_v3_08 implements IDeviceStruct public DeviceStruct_v3_08(MemorySegment deviceMemorySegment) { mDeviceMemorySegment = deviceMemorySegment; - mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer$get(mDeviceMemorySegment)); - MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo$slice(mDeviceMemorySegment); - mSerialNumber = serialSegment.getUtf8String(0); + mDeviceType = DeviceType.fromValue(0xFF & sdrplay_api_DeviceT.hwVer(mDeviceMemorySegment)); + MemorySegment serialSegment = sdrplay_api_DeviceT.SerNo(mDeviceMemorySegment); + mSerialNumber = serialSegment.getString(0); } @Override public MemorySegment getDeviceMemorySegment() @@ -60,18 +60,18 @@ public DeviceStruct_v3_08(MemorySegment deviceMemorySegment) @Override public TunerSelect getTunerSelect() { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment())); + return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); } @Override public RspDuoMode getRspDuoMode() { - return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode$get(getDeviceMemorySegment())); + return RspDuoMode.fromValue(sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment())); } @Override public void setRspDuoMode(RspDuoMode mode) { - sdrplay_api_DeviceT.rspDuoMode$set(getDeviceMemorySegment(), mode.getValue()); + sdrplay_api_DeviceT.rspDuoMode(getDeviceMemorySegment(), mode.getValue()); } @Override public boolean isValid() @@ -82,17 +82,17 @@ public void setRspDuoMode(RspDuoMode mode) @Override public double getRspDuoSampleFrequency() { - return sdrplay_api_DeviceT.rspDuoSampleFreq$get(getDeviceMemorySegment()); + return sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment()); } @Override public void setRspDuoSampleFrequency(double frequency) { - sdrplay_api_DeviceT.rspDuoSampleFreq$set(getDeviceMemorySegment(), frequency); + sdrplay_api_DeviceT.rspDuoSampleFreq(getDeviceMemorySegment(), frequency); } @Override public MemorySegment getDeviceHandle() { - return sdrplay_api_DeviceT.dev$get(getDeviceMemorySegment()); + return sdrplay_api_DeviceT.dev(getDeviceMemorySegment()); } } 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 index 8b2313bda..afd4a4623 100644 --- 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 @@ -19,7 +19,7 @@ package io.github.dsheirer.source.tuner.sdrplay.api.device; -import io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h; +import io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_h; /** * RSP Device type @@ -32,11 +32,11 @@ public enum DeviceType RSP2(sdrplay_api_h.SDRPLAY_RSP2_ID(), "RSP2"), RSPduo(sdrplay_api_h.SDRPLAY_RSPduo_ID(), "RSPduo"), RSPdx(sdrplay_api_h.SDRPLAY_RSPdx_ID(), "RSPdx"), - RSPdxR2(sdrplay_api_h.SDRPLAY_RSPdx_R2_ID(), "RSPdxR2"), + RSPdxR2(sdrplay_api_h.SDRPLAY_RSPdxR2_ID(), "RSPdxR2"), UNKNOWN(Integer.MIN_VALUE, "UNKNOWN"); - private int mValue; - private String mDescription; + private final int mValue; + private final String mDescription; DeviceType(int value, String description) { 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 index 956df5112..a94b7e419 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,16 +26,12 @@ import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.IfMode; import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.LoMode; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceT; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * RSPduo Device */ public class RspDuoDevice extends Device { - private static final Logger mLog = LoggerFactory.getLogger(RspDuoDevice.class); - private RspDuoTuner mTuner; /** @@ -87,7 +83,7 @@ public RspDuoTuner getTuner() throws SDRPlayException @Override public TunerSelect getTunerSelect() { - return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner$get(getDeviceMemorySegment())); + return TunerSelect.fromValue(sdrplay_api_DeviceT.tuner(getDeviceMemorySegment())); } /** @@ -95,7 +91,7 @@ public TunerSelect getTunerSelect() */ public void setTunerSelect(TunerSelect tunerSelect) { - sdrplay_api_DeviceT.tuner$set(getDeviceMemorySegment(), tunerSelect.getValue()); + sdrplay_api_DeviceT.tuner(getDeviceMemorySegment(), tunerSelect.getValue()); } /** 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 index b26891367..5fd8346c1 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,20 +27,20 @@ */ public class ErrorInformation { - private String mFile; - private String mFunction; - private int mLine; - private String mMessage; + private final String mFile; + private final String mFunction; + private final int mLine; + private final String mMessage; /** * Constructs an instance from the foreign memory segment */ public ErrorInformation(MemorySegment memorySegment) { - mFile = sdrplay_api_ErrorInfoT.file$slice(memorySegment).getUtf8String(0); - mFunction = sdrplay_api_ErrorInfoT.function$slice(memorySegment).getUtf8String(0); - mLine = sdrplay_api_ErrorInfoT.line$get(memorySegment); - mMessage = sdrplay_api_ErrorInfoT.message$slice(memorySegment).getUtf8String(0); + mFile = sdrplay_api_ErrorInfoT.file(memorySegment).getString(0); + mFunction = sdrplay_api_ErrorInfoT.function(memorySegment).getString(0); + mLine = sdrplay_api_ErrorInfoT.line(memorySegment); + mMessage = sdrplay_api_ErrorInfoT.message(memorySegment).getString(0); } public String getFile() 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 index 3b84ed6fd..015ce7334 100644 --- 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 @@ -26,6 +26,7 @@ import io.github.dsheirer.source.tuner.sdrplay.api.parameter.device.DeviceParametersFactory; import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParameters; import io.github.dsheirer.source.tuner.sdrplay.api.parameter.tuner.TunerParametersFactory; +import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_ControlParamsT; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DevParamsT; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_DeviceParamsT; import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_RxChannelParamsT; @@ -34,37 +35,37 @@ /** * Composite Device Parameters structure (sdrplay_api_DeviceParamsT) providing access to the device parameters and - * the tuner 1 parameters. Tuner 2 parameters are only accessible via the RSPduo sub-class implementation. + * the tuner 1 parameter. Tuner 2 parameters are only accessible via the RSPduo subclass implementation. * - * Note: sub-class implementations will constrain access to the appropriate sub-structures of the DeviceParamsT + * Note: subclass implementations will constrain access to the appropriate sub-structures of the DeviceParamsT * structure for each specific device. */ public class CompositeParameters { - private D mDeviceParameters; - private T mTunerAParameters; - private ControlParameters mControlAParameters; + private final D mDeviceParameters; + private final T mTunerAParameters; + private final ControlParameters mControlAParameters; /** * Constructs an instance from the foreign memory segment * * @param version of the API * @param deviceType to create - * @param memorySegment for the composite structure in foreign memory + * @param deviceParamsT native memory sdrplay_api_DeviceParamsT structure * @param arena for allocating additional memory segments for the sub-structures. */ - public CompositeParameters(Version version, DeviceType deviceType, MemorySegment memorySegment, Arena arena) + public CompositeParameters(Version version, DeviceType deviceType, MemorySegment deviceParamsT, Arena arena) { - MemorySegment parametersMemoryAddress = sdrplay_api_DeviceParamsT.devParams$get(memorySegment); - MemorySegment parametersMemorySegment = sdrplay_api_DevParamsT.ofAddress(parametersMemoryAddress, arena.scope()); - mDeviceParameters = (D) DeviceParametersFactory.create(deviceType, parametersMemorySegment); + MemorySegment addressDevParams = sdrplay_api_DeviceParamsT.devParams(deviceParamsT); + MemorySegment devParams = addressDevParams.reinterpret(sdrplay_api_DevParamsT.sizeof(), arena, null); + mDeviceParameters = (D) DeviceParametersFactory.create(deviceType, devParams); - MemorySegment memoryAddressRxA = sdrplay_api_DeviceParamsT.rxChannelA$get(memorySegment); - MemorySegment memorySegmentRxA = sdrplay_api_RxChannelParamsT.ofAddress(memoryAddressRxA, arena.scope()); - mTunerAParameters = (T) TunerParametersFactory.create(version, deviceType, memorySegmentRxA); + MemorySegment addressRxA = sdrplay_api_DeviceParamsT.rxChannelA(deviceParamsT); + MemorySegment rxA = addressRxA.reinterpret(sdrplay_api_RxChannelParamsT.sizeof(), arena, null); + mTunerAParameters = (T) TunerParametersFactory.create(version, deviceType, rxA); - MemorySegment tunerAControlParametersMemorySegment = sdrplay_api_RxChannelParamsT.ctrlParams$slice(memorySegmentRxA); - mControlAParameters = new ControlParameters(tunerAControlParametersMemorySegment); + MemorySegment tunerACtrlParams = rxA.asSlice(sdrplay_api_RxChannelParamsT.ctrlParams$offset(), sdrplay_api_ControlParamsT.sizeof()); + mControlAParameters = new ControlParameters(tunerACtrlParams); } /** 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 index c5ac79433..fe2edcb3e 100644 --- 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 @@ -33,32 +33,32 @@ public class CompositeParametersFactory * Creates a composite parameters instance for the specified device type * @param version of the api * @param deviceType to create - * @param memorySegment of foreign memory structure for the composite parameters + * @param deviceParams sdrplay_api_DeviceParamsT structure * @param arena to allocate additional memory structures * @return instance */ - public static CompositeParameters create(Version version, DeviceType deviceType, MemorySegment memorySegment, + public static CompositeParameters create(Version version, DeviceType deviceType, MemorySegment deviceParams, Arena arena) { switch(deviceType) { case RSP1 -> { - return new Rsp1CompositeParameters(version, memorySegment, arena); + return new Rsp1CompositeParameters(version, deviceParams, arena); } case RSP1A -> { - return new Rsp1aCompositeParameters(version, memorySegment, arena); + return new Rsp1aCompositeParameters(version, deviceParams, arena); } case RSP1B -> { - return new Rsp1bCompositeParameters(version, memorySegment, arena); + return new Rsp1bCompositeParameters(version, deviceParams, arena); } case RSP2 -> { - return new Rsp2CompositeParameters(version, memorySegment, arena); + return new Rsp2CompositeParameters(version, deviceParams, arena); } case RSPduo -> { - return new RspDuoCompositeParameters(version, memorySegment, arena); + return new RspDuoCompositeParameters(version, deviceParams, arena); } case RSPdx, RSPdxR2 -> { - return new RspDxCompositeParameters(version, memorySegment, arena); + return new RspDxCompositeParameters(version, deviceParams, arena); } } 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 index a3fb0a84a..a06ed54c9 100644 --- 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 @@ -35,11 +35,11 @@ public class Rsp1CompositeParameters extends CompositeParameters { - private RspDuoTunerParameters mTunerBParameters; - private ControlParameters mControlBParameters; + private final RspDuoTunerParameters mTunerBParameters; + private final ControlParameters mControlBParameters; /** * Constructs an instance from the foreign memory segment * * @param version for constructing the correct version structure. - * @param memorySegment for the composite structure in foreign memory + * @param deviceParams structure in foreign memory * @param arena for allocating additional memory segments for the sub-structures. */ - public RspDuoCompositeParameters(Version version, MemorySegment memorySegment, Arena arena) + public RspDuoCompositeParameters(Version version, MemorySegment deviceParams, Arena arena) { - super(version, DeviceType.RSPduo, memorySegment, arena); + super(version, DeviceType.RSPduo, deviceParams, arena); - MemorySegment memoryAddressRxB = sdrplay_api_DeviceParamsT.rxChannelB$get(memorySegment); - MemorySegment memorySegmentRxB = sdrplay_api_RxChannelParamsT.ofAddress(memoryAddressRxB, arena.scope()); - mTunerBParameters = (RspDuoTunerParameters) TunerParametersFactory.create(version, DeviceType.RSPduo, memorySegmentRxB); + MemorySegment addressRxChannelB = sdrplay_api_DeviceParamsT.rxChannelB(deviceParams); + MemorySegment rxChannelB = addressRxChannelB.reinterpret(sdrplay_api_RxChannelParamsT.sizeof(), arena, null); + mTunerBParameters = (RspDuoTunerParameters) TunerParametersFactory.create(version, DeviceType.RSPduo, rxChannelB); - MemorySegment tunerBControlParametersMemorySegment = sdrplay_api_RxChannelParamsT.ctrlParams$slice(memorySegmentRxB); - mControlBParameters = new ControlParameters(tunerBControlParametersMemorySegment); + MemorySegment rxChannelBCtrlParams = sdrplay_api_RxChannelParamsT.ctrlParams(rxChannelB); + mControlBParameters = new ControlParameters(rxChannelBCtrlParams); } /** 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 index 3048f3466..c177c90a6 100644 --- 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 @@ -35,11 +35,11 @@ public class RspDxCompositeParameters extends CompositeParameters { - return new Rsp1TunerParameters(tunerParametersMemorySegment); + return new Rsp1TunerParameters(tunerParams); } //RSP1A and RSP1B share the same tuner parameters structures case RSP1A, RSP1B -> { - MemorySegment rsp1AMemorySegment = sdrplay_api_RxChannelParamsT.rsp1aTunerParams$slice(memorySegment); - return new Rsp1aTunerParameters(memorySegment, rsp1AMemorySegment); + MemorySegment rsp1aTunerParams = sdrplay_api_RxChannelParamsT.rsp1aTunerParams(rxChannelParams); + return new Rsp1aTunerParameters(rxChannelParams, rsp1aTunerParams); } case RSP2 -> { - MemorySegment rsp2MemorySegment = sdrplay_api_RxChannelParamsT.rsp2TunerParams$slice(memorySegment); - return new Rsp2TunerParameters(memorySegment, rsp2MemorySegment); + MemorySegment rsp2TunerParams = sdrplay_api_RxChannelParamsT.rsp2TunerParams(rxChannelParams); + return new Rsp2TunerParameters(rxChannelParams, rsp2TunerParams); } case RSPduo -> { if(version.gte(Version.V3_14)) { - MemorySegment rspDuoMemorySegment = io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_RxChannelParamsT.rspDuoTunerParams$slice(memorySegment); - return new RspDuoTunerParametersV3_14(memorySegment, rspDuoMemorySegment); + MemorySegment rspDuoTunerParams = io.github.dsheirer.source.tuner.sdrplay.api.v3_15.sdrplay_api_RxChannelParamsT.rspDuoTunerParams(rxChannelParams); + return new RspDuoTunerParametersV3_14(rxChannelParams, rspDuoTunerParams); } else if(version.gte(Version.V3_07)) { - MemorySegment rspDuoMemorySegment = sdrplay_api_RxChannelParamsT.rspDuoTunerParams$slice(memorySegment); - return new RspDuoTunerParametersV3_07(memorySegment, rspDuoMemorySegment); + MemorySegment rspDuoTunerParams = sdrplay_api_RxChannelParamsT.rspDuoTunerParams(rxChannelParams); + return new RspDuoTunerParametersV3_07(rxChannelParams, rspDuoTunerParams); } else { @@ -70,8 +70,8 @@ else if(version.gte(Version.V3_07)) } } case RSPdx, RSPdxR2 -> { - MemorySegment rspDxMemorySegment = sdrplay_api_RxChannelParamsT.rspDxTunerParams$slice(memorySegment); - return new RspDxTunerParameters(memorySegment, rspDxMemorySegment); + MemorySegment rspDxTunerParams = sdrplay_api_RxChannelParamsT.rspDxTunerParams(rxChannelParams); + return new RspDxTunerParameters(rxChannelParams, rspDxTunerParams); } default -> throw new IllegalArgumentException("Unrecognized device type: " + deviceType); } diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/Constants$root.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/Constants$root.java deleted file mode 100644 index b103da3a3..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/Constants$root.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_BOOLEAN; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_FLOAT; -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -import static java.lang.foreign.ValueLayout.JAVA_SHORT; -import static java.lang.foreign.ValueLayout.OfAddress; -import static java.lang.foreign.ValueLayout.OfBoolean; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -final class Constants$root { - - // Suppresses default constructor, ensuring non-instantiability. - private Constants$root() {} - static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; - static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; - static final OfShort C_SHORT$LAYOUT = JAVA_SHORT; - static final OfInt C_INT$LAYOUT = JAVA_INT; - static final OfLong C_LONG$LAYOUT = JAVA_LONG; - static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG; - static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT; - static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE; - static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64).asUnbounded(); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/RuntimeHelper.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/RuntimeHelper.java deleted file mode 100644 index 76a18ffec..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/RuntimeHelper.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -// Generated by jextract - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.Linker; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_LONG; - -final class RuntimeHelper { - - private static final Linker LINKER = Linker.nativeLinker(); - private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); - private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); - private static final SymbolLookup SYMBOL_LOOKUP; - private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; - - final static SegmentAllocator CONSTANT_ALLOCATOR = - (size, align) -> MemorySegment.allocateNative(size, align, SegmentScope.auto()); - - static { -// System.loadLibrary("libsdrplay_api"); - SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); - SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name)); - } - - // Suppresses default constructor, ensuring non-instantiability. - private RuntimeHelper() {} - - static T requireNonNull(T obj, String symbolName) { - if (obj == null) { - throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); - } - return obj; - } - - static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) { - return SYMBOL_LOOKUP.find(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize(), symbol.scope())).orElse(null); - } - - static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> LINKER.downcallHandle(addr, fdesc)). - orElse(null); - } - - static MethodHandle downcallHandle(FunctionDescriptor fdesc) { - return LINKER.downcallHandle(fdesc); - } - - static MethodHandle downcallHandleVariadic(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> VarargsInvoker.make(addr, fdesc)). - orElse(null); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MH_LOOKUP.findVirtual(fi, name, fdesc.toMethodType()); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, SegmentScope scope) { - try { - fiHandle = fiHandle.bindTo(z); - return LINKER.upcallStub(fiHandle, fdesc, scope); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, SegmentScope scope) { - return MemorySegment.ofAddress(addr.address(), numElements * layout.byteSize(), scope); - } - - // Internals only below this point - - private static final class VarargsInvoker { - private static final MethodHandle INVOKE_MH; - private final MemorySegment symbol; - private final FunctionDescriptor function; - - private VarargsInvoker(MemorySegment symbol, FunctionDescriptor function) { - this.symbol = symbol; - this.function = function; - } - - static { - try { - INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); - } catch (ReflectiveOperationException e) { - throw new RuntimeException(e); - } - } - - static MethodHandle make(MemorySegment symbol, FunctionDescriptor function) { - VarargsInvoker invoker = new VarargsInvoker(symbol, function); - MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1); - MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class); - for (MemoryLayout layout : function.argumentLayouts()) { - mtype = mtype.appendParameterTypes(carrier(layout, false)); - } - mtype = mtype.appendParameterTypes(Object[].class); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mtype = mtype.insertParameterTypes(0, SegmentAllocator.class); - } else { - handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); - } - return handle.asType(mtype); - } - - static Class carrier(MemoryLayout layout, boolean ret) { - if (layout instanceof ValueLayout valueLayout) { - return valueLayout.carrier(); - } else if (layout instanceof GroupLayout) { - return MemorySegment.class; - } else { - throw new AssertionError("Cannot get here!"); - } - } - - private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { - // one trailing Object[] - int nNamedArgs = function.argumentLayouts().size(); - assert(args.length == nNamedArgs + 1); - // The last argument is the array of vararg collector - Object[] unnamedArgs = (Object[]) args[args.length - 1]; - - int argsCount = nNamedArgs + unnamedArgs.length; - Class[] argTypes = new Class[argsCount]; - MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; - - int pos = 0; - for (pos = 0; pos < nNamedArgs; pos++) { - argLayouts[pos] = function.argumentLayouts().get(pos); - } - - assert pos == nNamedArgs; - for (Object o: unnamedArgs) { - argLayouts[pos] = variadicLayout(normalize(o.getClass())); - pos++; - } - assert pos == argsCount; - - FunctionDescriptor f = (function.returnLayout().isEmpty()) ? - FunctionDescriptor.ofVoid(argLayouts) : - FunctionDescriptor.of(function.returnLayout().get(), argLayouts); - MethodHandle mh = LINKER.downcallHandle(symbol, f); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mh = mh.bindTo(allocator); - } - // flatten argument list so that it can be passed to an asSpreader MH - Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; - System.arraycopy(args, 0, allArgs, 0, nNamedArgs); - System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); - - return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); - } - - private static Class unboxIfNeeded(Class clazz) { - if (clazz == Boolean.class) { - return boolean.class; - } else if (clazz == Void.class) { - return void.class; - } else if (clazz == Byte.class) { - return byte.class; - } else if (clazz == Character.class) { - return char.class; - } else if (clazz == Short.class) { - return short.class; - } else if (clazz == Integer.class) { - return int.class; - } else if (clazz == Long.class) { - return long.class; - } else if (clazz == Float.class) { - return float.class; - } else if (clazz == Double.class) { - return double.class; - } else { - return clazz; - } - } - - private Class promote(Class c) { - if (c == byte.class || c == char.class || c == short.class || c == int.class) { - return long.class; - } else if (c == float.class) { - return double.class; - } else { - return c; - } - } - - private Class normalize(Class c) { - c = unboxIfNeeded(c); - if (c.isPrimitive()) { - return promote(c); - } - if (c == MemorySegment.class) { - return MemorySegment.class; - } - throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); - } - - private MemoryLayout variadicLayout(Class c) { - if (c == long.class) { - return JAVA_LONG; - } else if (c == double.class) { - return JAVA_DOUBLE; - } else if (c == MemorySegment.class) { - return ADDRESS; - } else { - throw new IllegalArgumentException("Unhandled variadic argument class: " + c); - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$0.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$0.java deleted file mode 100644 index 9e8f22be1..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$0.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$0 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$0() {} - static final FunctionDescriptor sdrplay_api_StreamCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_StreamCallback_t.class, "apply", constants$0.sdrplay_api_StreamCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_StreamCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_EventCallback_t.class, "apply", constants$0.sdrplay_api_EventCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_EventCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_EventCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Open_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Open_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Open_t.class, "apply", constants$0.sdrplay_api_Open_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Open_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_Open_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$1.java deleted file mode 100644 index 76be23177..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$1.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$1 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$1() {} - static final FunctionDescriptor sdrplay_api_Close_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Close_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Close_t.class, "apply", constants$1.sdrplay_api_Close_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Close_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_Close_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ApiVersion_t.class, "apply", constants$1.sdrplay_api_ApiVersion_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_ApiVersion_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_LockDeviceApi_t.class, "apply", constants$1.sdrplay_api_LockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_LockDeviceApi_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$10.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$10.java deleted file mode 100644 index 643d21a4a..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$10.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$10 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$10() {} - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoMode", - constants$10.sdrplay_api_SwapRspDuoMode$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$2.java deleted file mode 100644 index c9169c9d2..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$2.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$2 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$2() {} - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_UnlockDeviceApi_t.class, "apply", constants$2.sdrplay_api_UnlockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDevices_t.class, "apply", constants$2.sdrplay_api_GetDevices_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDevices_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_GetDevices_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SelectDevice_t.class, "apply", constants$2.sdrplay_api_SelectDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_SelectDevice_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$3.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$3.java deleted file mode 100644 index 3de44f6e5..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$3.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$3 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$3() {} - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ReleaseDevice_t.class, "apply", constants$3.sdrplay_api_ReleaseDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_ReleaseDevice_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetErrorString_t.class, "apply", constants$3.sdrplay_api_GetErrorString_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetErrorString_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetLastError_t.class, "apply", constants$3.sdrplay_api_GetLastError_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetLastError_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetLastError_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$4.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$4.java deleted file mode 100644 index 5c7575d8d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$4.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$4 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$4() {} - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DisableHeartbeat_t.class, "apply", constants$4.sdrplay_api_DisableHeartbeat_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DebugEnable_t.class, "apply", constants$4.sdrplay_api_DebugEnable_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DebugEnable_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDeviceParams_t.class, "apply", constants$4.sdrplay_api_GetDeviceParams_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_GetDeviceParams_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$5.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$5.java deleted file mode 100644 index 80bdf67f4..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$5.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$5 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$5() {} - static final FunctionDescriptor sdrplay_api_Init_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Init_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Init_t.class, "apply", constants$5.sdrplay_api_Init_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Init_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Init_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Uninit_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Uninit_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Uninit_t.class, "apply", constants$5.sdrplay_api_Uninit_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Uninit_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Uninit_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Update_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Update_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Update_t.class, "apply", constants$5.sdrplay_api_Update_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Update_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Update_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$6.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$6.java deleted file mode 100644 index 7c97f565a..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$6.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$6 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$6() {} - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoMode_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoMode_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$7.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$7.java deleted file mode 100644 index e57dc7314..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$7.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$7 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$7() {} - static final FunctionDescriptor sdrplay_api_Open$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Open", - constants$7.sdrplay_api_Open$FUNC - ); - static final FunctionDescriptor sdrplay_api_Close$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Close", - constants$7.sdrplay_api_Close$FUNC - ); - static final FunctionDescriptor sdrplay_api_ApiVersion$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_ApiVersion", - constants$7.sdrplay_api_ApiVersion$FUNC - ); - static final FunctionDescriptor sdrplay_api_LockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_LockDeviceApi", - constants$7.sdrplay_api_LockDeviceApi$FUNC - ); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_UnlockDeviceApi", - constants$7.sdrplay_api_UnlockDeviceApi$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDevices$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetDevices", - constants$7.sdrplay_api_GetDevices$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$8.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$8.java deleted file mode 100644 index 63590973c..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$8.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$8 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$8() {} - static final FunctionDescriptor sdrplay_api_SelectDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SelectDevice", - constants$8.sdrplay_api_SelectDevice$FUNC - ); - static final FunctionDescriptor sdrplay_api_ReleaseDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_ReleaseDevice", - constants$8.sdrplay_api_ReleaseDevice$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetErrorString$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetErrorString", - constants$8.sdrplay_api_GetErrorString$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetLastError$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetLastError", - constants$8.sdrplay_api_GetLastError$FUNC - ); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_DisableHeartbeat", - constants$8.sdrplay_api_DisableHeartbeat$FUNC - ); - static final FunctionDescriptor sdrplay_api_DebugEnable$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_DebugEnable", - constants$8.sdrplay_api_DebugEnable$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$9.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$9.java deleted file mode 100644 index 6d3108371..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_07/constants$9.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$9 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$9() {} - static final FunctionDescriptor sdrplay_api_GetDeviceParams$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetDeviceParams", - constants$9.sdrplay_api_GetDeviceParams$FUNC - ); - static final FunctionDescriptor sdrplay_api_Init$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Init", - constants$9.sdrplay_api_Init$FUNC - ); - static final FunctionDescriptor sdrplay_api_Uninit$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Uninit", - constants$9.sdrplay_api_Uninit$FUNC - ); - static final FunctionDescriptor sdrplay_api_Update$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Update", - constants$9.sdrplay_api_Update$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoActiveTuner", - constants$9.sdrplay_api_SwapRspDuoActiveTuner$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoDualTunerModeSampleRate", - constants$9.sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC - ); -} - - 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 index bc79d8e8f..05558d161 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,19 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; +import static java.lang.foreign.ValueLayout.OfShort; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_AgcControlT enable; * int setPoint_dBfs; @@ -38,225 +42,382 @@ * unsigned short decay_delay_ms; * unsigned short decay_threshold_dB; * int syncUpdate; - * }; + * } * } */ public class sdrplay_api_AgcT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_AgcT.$struct$LAYOUT; + sdrplay_api_AgcT() { + // Should not be called directly + } + + 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; } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_AgcT.enable$VH; + + private static final OfInt enable$LAYOUT = (OfInt)$LAYOUT.select(groupElement("enable")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable + * } + */ + public static final OfInt enable$layout() { + return enable$LAYOUT; + } + + private static final long enable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable + * } + */ + public static final long enable$offset() { + return enable$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable * } */ - public static int enable$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg); + public static int enable(MemorySegment struct) { + return struct.get(enable$LAYOUT, enable$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable * } */ - public static void enable$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.enable$VH.set(seg, x); - } - public static int enable$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg.asSlice(index*sizeof())); + public static void enable(MemorySegment struct, int fieldValue) { + struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); } - public static void enable$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.enable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle setPoint_dBfs$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("setPoint_dBfs")); - public static VarHandle setPoint_dBfs$VH() { - return sdrplay_api_AgcT.setPoint_dBfs$VH; + + private static final long setPoint_dBfs$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * int setPoint_dBfs + * } + */ + public static final long setPoint_dBfs$offset() { + return setPoint_dBfs$OFFSET; } + /** * Getter for field: - * {@snippet : - * int setPoint_dBfs; + * {@snippet lang=c : + * int setPoint_dBfs * } */ - public static int setPoint_dBfs$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg); + public static int setPoint_dBfs(MemorySegment struct) { + return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET); } + /** * Setter for field: - * {@snippet : - * int setPoint_dBfs; + * {@snippet lang=c : + * int setPoint_dBfs * } */ - public static void setPoint_dBfs$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg, x); - } - public static int setPoint_dBfs$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg.asSlice(index*sizeof())); + public static void setPoint_dBfs(MemorySegment struct, int fieldValue) { + struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue); } - public static void setPoint_dBfs$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle attack_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attack_ms")); - public static VarHandle attack_ms$VH() { - return sdrplay_api_AgcT.attack_ms$VH; + + private static final long attack_ms$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short attack_ms + * } + */ + public static final long attack_ms$offset() { + return attack_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short attack_ms; + * {@snippet lang=c : + * unsigned short attack_ms * } */ - public static short attack_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg); + public static short attack_ms(MemorySegment struct) { + return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short attack_ms; + * {@snippet lang=c : + * unsigned short attack_ms * } */ - public static void attack_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg, x); - } - public static short attack_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg.asSlice(index*sizeof())); + public static void attack_ms(MemorySegment struct, short fieldValue) { + struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue); } - public static void attack_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_ms")); - public static VarHandle decay_ms$VH() { - return sdrplay_api_AgcT.decay_ms$VH; + + private static final long decay_ms$OFFSET = 10; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_ms + * } + */ + public static final long decay_ms$offset() { + return decay_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_ms; + * {@snippet lang=c : + * unsigned short decay_ms * } */ - public static short decay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg); + public static short decay_ms(MemorySegment struct) { + return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_ms; + * {@snippet lang=c : + * unsigned short decay_ms * } */ - public static void decay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg, x); - } - public static short decay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg.asSlice(index*sizeof())); + public static void decay_ms(MemorySegment struct, short fieldValue) { + struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue); } - public static void decay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_delay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_delay_ms")); - public static VarHandle decay_delay_ms$VH() { - return sdrplay_api_AgcT.decay_delay_ms$VH; + + private static final long decay_delay_ms$OFFSET = 12; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_delay_ms + * } + */ + public static final long decay_delay_ms$offset() { + return decay_delay_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_delay_ms; + * {@snippet lang=c : + * unsigned short decay_delay_ms * } */ - public static short decay_delay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg); + public static short decay_delay_ms(MemorySegment struct) { + return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_delay_ms; + * {@snippet lang=c : + * unsigned short decay_delay_ms * } */ - public static void decay_delay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg, x); + public static void decay_delay_ms(MemorySegment struct, short fieldValue) { + struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue); } - public static short decay_delay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_delay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_threshold_dB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_threshold_dB")); - public static VarHandle decay_threshold_dB$VH() { - return sdrplay_api_AgcT.decay_threshold_dB$VH; + + private static final long decay_threshold_dB$OFFSET = 14; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_threshold_dB + * } + */ + public static final long decay_threshold_dB$offset() { + return decay_threshold_dB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_threshold_dB; + * {@snippet lang=c : + * unsigned short decay_threshold_dB * } */ - public static short decay_threshold_dB$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg); + public static short decay_threshold_dB(MemorySegment struct) { + return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_threshold_dB; + * {@snippet lang=c : + * unsigned short decay_threshold_dB * } */ - public static void decay_threshold_dB$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg, x); + public static void decay_threshold_dB(MemorySegment struct, short fieldValue) { + struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue); } - public static short decay_threshold_dB$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_threshold_dB$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_AgcT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * int syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * int syncUpdate; + * {@snippet lang=c : + * int syncUpdate * } */ - public static int syncUpdate$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg); + public static int syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * int syncUpdate; + * {@snippet lang=c : + * int syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, int fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static int syncUpdate$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void syncUpdate$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index d378d6cbb..e7fb49ce3 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_ApiVersion_t)(float* apiVer); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *) * } */ -public interface sdrplay_api_ApiVersion_t { +public class sdrplay_api_ApiVersion_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate); - static MemorySegment allocate(sdrplay_api_ApiVersion_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_ApiVersion_t_UP$MH, fi, constants$1.sdrplay_api_ApiVersion_t$FUNC, scope); + sdrplay_api_ApiVersion_t() { + // Should not be called directly } - static sdrplay_api_ApiVersion_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate) -> { - try { - return (int)constants$1.sdrplay_api_ApiVersion_t_DOWN$MH.invokeExact(symbol, _currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment apiVer); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ApiVersion_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_ApiVersion_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment apiVer) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, apiVer); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 341af08d8..1a80f9f57 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,131 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_StreamCallback_t StreamACbFn; * sdrplay_api_StreamCallback_t StreamBCbFn; * sdrplay_api_EventCallback_t EventCbFn; - * }; + * } * } */ public class sdrplay_api_CallbackFnsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("StreamACbFn"), - Constants$root.C_POINTER$LAYOUT.withName("StreamBCbFn"), - Constants$root.C_POINTER$LAYOUT.withName("EventCbFn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_CallbackFnsT.$struct$LAYOUT; + sdrplay_api_CallbackFnsT() { + // Should not be called directly } - static final VarHandle StreamACbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamACbFn")); - public static VarHandle StreamACbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamACbFn$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_POINTER.withName("StreamACbFn"), + sdrplay_api_h.C_POINTER.withName("StreamBCbFn"), + sdrplay_api_h.C_POINTER.withName("EventCbFn") + ).withName("$anon$71:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final AddressLayout StreamACbFn$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("StreamACbFn")); + /** - * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn * } */ - public static MemorySegment StreamACbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg); + public static final AddressLayout StreamACbFn$layout() { + return StreamACbFn$LAYOUT; } + + private static final long StreamACbFn$OFFSET = 0; + /** - * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn * } */ - public static void StreamACbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg, x); + public static final long StreamACbFn$offset() { + return StreamACbFn$OFFSET; } - public static MemorySegment StreamACbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn + * } + */ + public static MemorySegment StreamACbFn(MemorySegment struct) { + return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET); } - public static void StreamACbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static sdrplay_api_StreamCallback_t StreamACbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamACbFn$get(segment), scope); + + 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; } - static final VarHandle StreamBCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamBCbFn")); - public static VarHandle StreamBCbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamBCbFn$VH; + + private static final long StreamBCbFn$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn + * } + */ + public static final long StreamBCbFn$offset() { + return StreamBCbFn$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn * } */ - public static MemorySegment StreamBCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg); + public static MemorySegment StreamBCbFn(MemorySegment struct) { + return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn * } */ - public static void StreamBCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg, x); + public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) { + struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue); } - public static MemorySegment StreamBCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg.asSlice(index*sizeof())); - } - public static void StreamBCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static sdrplay_api_StreamCallback_t StreamBCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamBCbFn$get(segment), scope); + + 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; } - static final VarHandle EventCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("EventCbFn")); - public static VarHandle EventCbFn$VH() { - return sdrplay_api_CallbackFnsT.EventCbFn$VH; + + private static final long EventCbFn$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn + * } + */ + public static final long EventCbFn$offset() { + return EventCbFn$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn * } */ - public static MemorySegment EventCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg); + public static MemorySegment EventCbFn(MemorySegment struct) { + return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn * } */ - public static void EventCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg, x); + public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) { + struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static MemorySegment EventCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg.asSlice(index*sizeof())); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static void EventCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static sdrplay_api_EventCallback_t EventCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_EventCallback_t.ofAddress(EventCbFn$get(segment), scope); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index f4e9feb85..bc00f12ed 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Close_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void) * } */ -public interface sdrplay_api_Close_t { +public class sdrplay_api_Close_t { - int apply(); - static MemorySegment allocate(sdrplay_api_Close_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_Close_t_UP$MH, fi, constants$1.sdrplay_api_Close_t$FUNC, scope); + sdrplay_api_Close_t() { + // Should not be called directly } - static sdrplay_api_Close_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_Close_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Close_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Close_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 9e52f1e51..f313b3150 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,93 +21,265 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_DcOffsetT dcOffset; * sdrplay_api_DecimationT decimation; * sdrplay_api_AgcT agc; * sdrplay_api_AdsbModeT adsbMode; - * }; + * } * } */ public class sdrplay_api_ControlParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ControlParamsT.$struct$LAYOUT; - } - public static MemorySegment dcOffset$slice(MemorySegment seg) { - return seg.asSlice(0, 2); - } - public static MemorySegment decimation$slice(MemorySegment seg) { - return seg.asSlice(2, 3); - } - public static MemorySegment agc$slice(MemorySegment seg) { - return seg.asSlice(8, 20); - } - static final VarHandle adsbMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("adsbMode")); - public static VarHandle adsbMode$VH() { - return sdrplay_api_ControlParamsT.adsbMode$VH; + 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 : - * sdrplay_api_AdsbModeT adsbMode; + * {@snippet lang=c : + * sdrplay_api_DcOffsetT dcOffset * } */ - public static int adsbMode$get(MemorySegment seg) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg); + public static MemorySegment dcOffset(MemorySegment struct) { + return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_AdsbModeT adsbMode; + * {@snippet lang=c : + * sdrplay_api_DcOffsetT dcOffset * } */ - public static void adsbMode$set(MemorySegment seg, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg, x); + public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); } - public static int adsbMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static final GroupLayout decimation$layout() { + return decimation$LAYOUT; } - public static void adsbMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg.asSlice(index*sizeof()), x); + + private static final long decimation$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static final long decimation$offset() { + return decimation$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static MemorySegment decimation(MemorySegment struct) { + return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Setter for field: + * {@snippet lang=c : + * sdrplay_api_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()); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 07d4eb512..e7894dc71 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,92 +21,172 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char DCenable; * unsigned char IQenable; - * }; + * } * } */ public class sdrplay_api_DcOffsetT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetT.$struct$LAYOUT; + sdrplay_api_DcOffsetT() { + // Should not be called directly + } + + 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; } - static final VarHandle DCenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("DCenable")); - public static VarHandle DCenable$VH() { - return sdrplay_api_DcOffsetT.DCenable$VH; + + private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char DCenable + * } + */ + public static final OfByte DCenable$layout() { + return DCenable$LAYOUT; } + + private static final long DCenable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char DCenable + * } + */ + public static final long DCenable$offset() { + return DCenable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char DCenable; + * {@snippet lang=c : + * unsigned char DCenable * } */ - public static byte DCenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg); + public static byte DCenable(MemorySegment struct) { + return struct.get(DCenable$LAYOUT, DCenable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char DCenable; + * {@snippet lang=c : + * unsigned char DCenable * } */ - public static void DCenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg, x); - } - public static byte DCenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg.asSlice(index*sizeof())); + public static void DCenable(MemorySegment struct, byte fieldValue) { + struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue); } - public static void DCenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle IQenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("IQenable")); - public static VarHandle IQenable$VH() { - return sdrplay_api_DcOffsetT.IQenable$VH; + + private static final long IQenable$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char IQenable + * } + */ + public static final long IQenable$offset() { + return IQenable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char IQenable; + * {@snippet lang=c : + * unsigned char IQenable * } */ - public static byte IQenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg); + public static byte IQenable(MemorySegment struct) { + return struct.get(IQenable$LAYOUT, IQenable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char IQenable; + * {@snippet lang=c : + * unsigned char IQenable * } */ - public static void IQenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg, x); + public static void IQenable(MemorySegment struct, byte fieldValue) { + struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue); } - public static byte IQenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void IQenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 842a7d433..9f66a02f5 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,153 +21,266 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char dcCal; * unsigned char speedUp; * int trackTime; * int refreshRateTime; - * }; + * } * } */ public class sdrplay_api_DcOffsetTunerT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetTunerT.$struct$LAYOUT; + sdrplay_api_DcOffsetTunerT() { + // Should not be called directly + } + + 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; } - static final VarHandle dcCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dcCal")); - public static VarHandle dcCal$VH() { - return sdrplay_api_DcOffsetTunerT.dcCal$VH; + + private static final long dcCal$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char dcCal + * } + */ + public static final long dcCal$offset() { + return dcCal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char dcCal; + * {@snippet lang=c : + * unsigned char dcCal * } */ - public static byte dcCal$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg); + public static byte dcCal(MemorySegment struct) { + return struct.get(dcCal$LAYOUT, dcCal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char dcCal; + * {@snippet lang=c : + * unsigned char dcCal * } */ - public static void dcCal$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg, x); + public static void dcCal(MemorySegment struct, byte fieldValue) { + struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue); } - public static byte dcCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg.asSlice(index*sizeof())); - } - public static void dcCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle speedUp$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("speedUp")); - public static VarHandle speedUp$VH() { - return sdrplay_api_DcOffsetTunerT.speedUp$VH; + + private static final long speedUp$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char speedUp + * } + */ + public static final long speedUp$offset() { + return speedUp$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char speedUp; + * {@snippet lang=c : + * unsigned char speedUp * } */ - public static byte speedUp$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg); + public static byte speedUp(MemorySegment struct) { + return struct.get(speedUp$LAYOUT, speedUp$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char speedUp; + * {@snippet lang=c : + * unsigned char speedUp * } */ - public static void speedUp$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg, x); + public static void speedUp(MemorySegment struct, byte fieldValue) { + struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue); } - public static byte speedUp$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg.asSlice(index*sizeof())); - } - public static void speedUp$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle trackTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("trackTime")); - public static VarHandle trackTime$VH() { - return sdrplay_api_DcOffsetTunerT.trackTime$VH; + + private static final long trackTime$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * int trackTime + * } + */ + public static final long trackTime$offset() { + return trackTime$OFFSET; } + /** * Getter for field: - * {@snippet : - * int trackTime; + * {@snippet lang=c : + * int trackTime * } */ - public static int trackTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg); + public static int trackTime(MemorySegment struct) { + return struct.get(trackTime$LAYOUT, trackTime$OFFSET); } + /** * Setter for field: - * {@snippet : - * int trackTime; + * {@snippet lang=c : + * int trackTime * } */ - public static void trackTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg, x); - } - public static int trackTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg.asSlice(index*sizeof())); + public static void trackTime(MemorySegment struct, int fieldValue) { + struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue); } - public static void trackTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle refreshRateTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("refreshRateTime")); - public static VarHandle refreshRateTime$VH() { - return sdrplay_api_DcOffsetTunerT.refreshRateTime$VH; + + private static final long refreshRateTime$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * int refreshRateTime + * } + */ + public static final long refreshRateTime$offset() { + return refreshRateTime$OFFSET; } + /** * Getter for field: - * {@snippet : - * int refreshRateTime; + * {@snippet lang=c : + * int refreshRateTime * } */ - public static int refreshRateTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg); + public static int refreshRateTime(MemorySegment struct) { + return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET); } + /** * Setter for field: - * {@snippet : - * int refreshRateTime; + * {@snippet lang=c : + * int refreshRateTime * } */ - public static void refreshRateTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg, x); + public static void refreshRateTime(MemorySegment struct, int fieldValue) { + struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue); + } + + /** + * 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()); } - public static int refreshRateTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg.asSlice(index*sizeof())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static void refreshRateTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 727fe05d5..3011524cc 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_DebugEnable_t)(void* dev,enum dbgLvl); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t) * } */ -public interface sdrplay_api_DebugEnable_t { +public class sdrplay_api_DebugEnable_t { - int apply(java.lang.foreign.MemorySegment dev, int dbgLvl); - static MemorySegment allocate(sdrplay_api_DebugEnable_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DebugEnable_t_UP$MH, fi, constants$4.sdrplay_api_DebugEnable_t$FUNC, scope); + sdrplay_api_DebugEnable_t() { + // Should not be called directly } - static sdrplay_api_DebugEnable_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _dbgLvl) -> { - try { - return (int)constants$4.sdrplay_api_DebugEnable_t_DOWN$MH.invokeExact(symbol, _dev, _dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, int dbgLvl); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 86c7e78bf..e7d089dc3 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char enable; * unsigned char decimationFactor; * unsigned char wideBandSignal; - * }; + * } * } */ public class sdrplay_api_DecimationT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DecimationT.$struct$LAYOUT; + sdrplay_api_DecimationT() { + // Should not be called directly } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_DecimationT.enable$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("enable"), + sdrplay_api_h.C_CHAR.withName("decimationFactor"), + sdrplay_api_h.C_CHAR.withName("wideBandSignal") + ).withName("$anon$29:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char enable + * } + */ + public static final OfByte enable$layout() { + return enable$LAYOUT; + } + + private static final long enable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char enable + * } + */ + public static final long enable$offset() { + return enable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char enable; + * {@snippet lang=c : + * unsigned char enable * } */ - public static byte enable$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg); + public static byte enable(MemorySegment struct) { + return struct.get(enable$LAYOUT, enable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char enable; + * {@snippet lang=c : + * unsigned char enable * } */ - public static void enable$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg, x); + public static void enable(MemorySegment struct, byte fieldValue) { + struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); } - public static byte enable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg.asSlice(index*sizeof())); - } - public static void enable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decimationFactor$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decimationFactor")); - public static VarHandle decimationFactor$VH() { - return sdrplay_api_DecimationT.decimationFactor$VH; + + private static final long decimationFactor$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char decimationFactor + * } + */ + public static final long decimationFactor$offset() { + return decimationFactor$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char decimationFactor; + * {@snippet lang=c : + * unsigned char decimationFactor * } */ - public static byte decimationFactor$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg); + public static byte decimationFactor(MemorySegment struct) { + return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char decimationFactor; + * {@snippet lang=c : + * unsigned char decimationFactor * } */ - public static void decimationFactor$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg, x); - } - public static byte decimationFactor$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg.asSlice(index*sizeof())); + public static void decimationFactor(MemorySegment struct, byte fieldValue) { + struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue); } - public static void decimationFactor$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle wideBandSignal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("wideBandSignal")); - public static VarHandle wideBandSignal$VH() { - return sdrplay_api_DecimationT.wideBandSignal$VH; + + private static final long wideBandSignal$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char wideBandSignal + * } + */ + public static final long wideBandSignal$offset() { + return wideBandSignal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char wideBandSignal; + * {@snippet lang=c : + * unsigned char wideBandSignal * } */ - public static byte wideBandSignal$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg); + public static byte wideBandSignal(MemorySegment struct) { + return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char wideBandSignal; + * {@snippet lang=c : + * unsigned char wideBandSignal * } */ - public static void wideBandSignal$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg, x); + public static void wideBandSignal(MemorySegment struct, byte fieldValue) { + struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue); } - public static byte wideBandSignal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void wideBandSignal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 83ffe2fd2..3664bd851 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,19 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * double ppm; * sdrplay_api_FsFreqT fsFreq; @@ -41,166 +45,519 @@ * sdrplay_api_Rsp2ParamsT rsp2Params; * sdrplay_api_RspDuoParamsT rspDuoParams; * sdrplay_api_RspDxParamsT rspDxParams; - * }; + * } * } */ public class sdrplay_api_DevParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("ppm"), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ).withName("fsFreq"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ).withName("syncUpdate"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ).withName("resetFlags"), - MemoryLayout.paddingLayout(8), - Constants$root.C_INT$LAYOUT.withName("mode"), - Constants$root.C_INT$LAYOUT.withName("samplesPerPkt"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ).withName("rsp1aParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ).withName("rsp2Params"), - MemoryLayout.paddingLayout(8), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ).withName("rspDuoParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ).withName("rspDxParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DevParamsT.$struct$LAYOUT; - } - static final VarHandle ppm$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ppm")); - public static VarHandle ppm$VH() { - return sdrplay_api_DevParamsT.ppm$VH; + 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 : - * double ppm; + * {@snippet lang=c : + * double ppm * } */ - public static double ppm$get(MemorySegment seg) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg); + public static double ppm(MemorySegment struct) { + return struct.get(ppm$LAYOUT, ppm$OFFSET); } + /** * Setter for field: - * {@snippet : - * double ppm; + * {@snippet lang=c : + * double ppm * } */ - public static void ppm$set(MemorySegment seg, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg, x); + public static void ppm(MemorySegment struct, double fieldValue) { + struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue); } - public static double ppm$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_FsFreqT fsFreq + * } + */ + public static final GroupLayout fsFreq$layout() { + return fsFreq$LAYOUT; } - public static void ppm$set(MemorySegment seg, long index, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - public static MemorySegment fsFreq$slice(MemorySegment seg) { - return seg.asSlice(8, 16); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_FsFreqT fsFreq + * } + */ + public static MemorySegment fsFreq(MemorySegment struct) { + return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); } - public static MemorySegment syncUpdate$slice(MemorySegment seg) { - return seg.asSlice(24, 8); + + /** + * 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()); } - public static MemorySegment resetFlags$slice(MemorySegment seg) { - return seg.asSlice(32, 3); + + 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; } - static final VarHandle mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("mode")); - public static VarHandle mode$VH() { - return sdrplay_api_DevParamsT.mode$VH; + + private static final long 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 : - * sdrplay_api_TransferModeT mode; + * {@snippet lang=c : + * sdrplay_api_SyncUpdateT syncUpdate * } */ - public static int mode$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg); + public static MemorySegment syncUpdate(MemorySegment struct) { + return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_TransferModeT mode; + * {@snippet lang=c : + * sdrplay_api_SyncUpdateT syncUpdate * } */ - public static void mode$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); } - public static int mode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_ResetFlagsT resetFlags + * } + */ + public static final GroupLayout resetFlags$layout() { + return resetFlags$LAYOUT; + } + + 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()); } - public static void mode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle samplesPerPkt$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("samplesPerPkt")); - public static VarHandle samplesPerPkt$VH() { - return sdrplay_api_DevParamsT.samplesPerPkt$VH; + + private static final long 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 : - * unsigned int samplesPerPkt; + * {@snippet lang=c : + * sdrplay_api_TransferModeT mode * } */ - public static int samplesPerPkt$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg); + public static int mode(MemorySegment struct) { + return struct.get(mode$LAYOUT, mode$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int samplesPerPkt; + * {@snippet lang=c : + * sdrplay_api_TransferModeT mode * } */ - public static void samplesPerPkt$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg, x); + public static void mode(MemorySegment struct, int fieldValue) { + struct.set(mode$LAYOUT, mode$OFFSET, fieldValue); } - public static int samplesPerPkt$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void samplesPerPkt$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg.asSlice(index*sizeof()), x); + + private static final long samplesPerPkt$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static final long samplesPerPkt$offset() { + return samplesPerPkt$OFFSET; } - public static MemorySegment rsp1aParams$slice(MemorySegment seg) { - return seg.asSlice(44, 2); + + /** + * Getter for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static int samplesPerPkt(MemorySegment struct) { + return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET); } - public static MemorySegment rsp2Params$slice(MemorySegment seg) { - return seg.asSlice(46, 1); + + /** + * Setter for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static void samplesPerPkt(MemorySegment struct, int fieldValue) { + struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue); } - public static MemorySegment rspDuoParams$slice(MemorySegment seg) { - return seg.asSlice(48, 4); + + 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; } - public static MemorySegment rspDxParams$slice(MemorySegment seg) { - return seg.asSlice(52, 12); + + 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; } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_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); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index f9e872f5e..bda26c2b8 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * struct { - * sdrplay_api_DevParamsT* devParams; - * sdrplay_api_RxChannelParamsT* rxChannelA; - * sdrplay_api_RxChannelParamsT* rxChannelB; - * }; + * sdrplay_api_DevParamsT *devParams; + * sdrplay_api_RxChannelParamsT *rxChannelA; + * sdrplay_api_RxChannelParamsT *rxChannelB; + * } * } */ public class sdrplay_api_DeviceParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("devParams"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelA"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelB") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceParamsT.$struct$LAYOUT; + sdrplay_api_DeviceParamsT() { + // Should not be called directly } - static final VarHandle devParams$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("devParams")); - public static VarHandle devParams$VH() { - return sdrplay_api_DeviceParamsT.devParams$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_POINTER.withName("devParams"), + sdrplay_api_h.C_POINTER.withName("rxChannelA"), + sdrplay_api_h.C_POINTER.withName("rxChannelB") + ).withName("$anon$153:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final AddressLayout devParams$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("devParams")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams + * } + */ + public static final AddressLayout devParams$layout() { + return devParams$LAYOUT; + } + + private static final long devParams$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams + * } + */ + public static final long devParams$offset() { + return devParams$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_DevParamsT* devParams; + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams * } */ - public static MemorySegment devParams$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg); + public static MemorySegment devParams(MemorySegment struct) { + return struct.get(devParams$LAYOUT, devParams$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_DevParamsT* devParams; + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams * } */ - public static void devParams$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg, x); + public static void devParams(MemorySegment struct, MemorySegment fieldValue) { + struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue); } - public static MemorySegment devParams$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg.asSlice(index*sizeof())); - } - public static void devParams$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rxChannelA$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelA")); - public static VarHandle rxChannelA$VH() { - return sdrplay_api_DeviceParamsT.rxChannelA$VH; + + private static final long rxChannelA$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA + * } + */ + public static final long rxChannelA$offset() { + return rxChannelA$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA * } */ - public static MemorySegment rxChannelA$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg); + public static MemorySegment rxChannelA(MemorySegment struct) { + return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA * } */ - public static void rxChannelA$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg, x); - } - public static MemorySegment rxChannelA$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg.asSlice(index*sizeof())); + public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) { + struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue); } - public static void rxChannelA$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rxChannelB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelB")); - public static VarHandle rxChannelB$VH() { - return sdrplay_api_DeviceParamsT.rxChannelB$VH; + + private static final long rxChannelB$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB + * } + */ + public static final long rxChannelB$offset() { + return rxChannelB$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB * } */ - public static MemorySegment rxChannelB$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg); + public static MemorySegment rxChannelB(MemorySegment struct) { + return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB * } */ - public static void rxChannelB$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg, x); + public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) { + struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue); } - public static MemorySegment rxChannelB$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rxChannelB$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index a4d68f06f..b7a5b39b6 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,24 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.AddressLayout; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; +import java.lang.foreign.SequenceLayout; import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * char SerNo[64]; * unsigned char hwVer; @@ -37,173 +46,372 @@ * sdrplay_api_RspDuoModeT rspDuoMode; * double rspDuoSampleFreq; * HANDLE dev; - * }; + * } * } */ public class sdrplay_api_DeviceT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, Constants$root.C_CHAR$LAYOUT).withName("SerNo"), - Constants$root.C_CHAR$LAYOUT.withName("hwVer"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner"), - Constants$root.C_INT$LAYOUT.withName("rspDuoMode"), - MemoryLayout.paddingLayout(32), - Constants$root.C_DOUBLE$LAYOUT.withName("rspDuoSampleFreq"), - Constants$root.C_POINTER$LAYOUT.withName("dev") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceT.$struct$LAYOUT; + sdrplay_api_DeviceT() { + // Should not be called directly + } + + 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; } - public static MemorySegment SerNo$slice(MemorySegment seg) { - return seg.asSlice(0, 64); + + 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; } - static final VarHandle hwVer$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hwVer")); - public static VarHandle hwVer$VH() { - return sdrplay_api_DeviceT.hwVer$VH; + + private static final long SerNo$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static final long SerNo$offset() { + return SerNo$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char hwVer; + * {@snippet lang=c : + * char SerNo[64] * } */ - public static byte hwVer$get(MemorySegment seg) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg); + public static MemorySegment SerNo(MemorySegment struct) { + return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * unsigned char hwVer; + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static void 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 void hwVer$set(MemorySegment seg, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg, x); + public static byte SerNo(MemorySegment struct, long index0) { + return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0); } - public static byte hwVer$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg.asSlice(index*sizeof())); + + /** + * 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); } - public static void hwVer$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg.asSlice(index*sizeof()), x); + + private static final 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; } - static final VarHandle tuner$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner")); - public static VarHandle tuner$VH() { - return sdrplay_api_DeviceT.tuner$VH; + + private static final long hwVer$OFFSET = 64; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char hwVer + * } + */ + public static final long hwVer$offset() { + return hwVer$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; + * {@snippet lang=c : + * unsigned char hwVer * } */ - public static int tuner$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg); + public static byte hwVer(MemorySegment struct) { + return struct.get(hwVer$LAYOUT, hwVer$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; + * {@snippet lang=c : + * unsigned char hwVer * } */ - public static void tuner$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg, x); + public static void hwVer(MemorySegment struct, byte fieldValue) { + struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue); } - public static int tuner$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rspDuoMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoMode")); - public static VarHandle rspDuoMode$VH() { - return sdrplay_api_DeviceT.rspDuoMode$VH; + + private static final long tuner$OFFSET = 68; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner + * } + */ + public static final long tuner$offset() { + return tuner$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner * } */ - public static int rspDuoMode$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg); + public static int tuner(MemorySegment struct) { + return struct.get(tuner$LAYOUT, tuner$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner * } */ - public static void rspDuoMode$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg, x); - } - public static int rspDuoMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg.asSlice(index*sizeof())); + public static void tuner(MemorySegment struct, int fieldValue) { + struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue); } - public static void rspDuoMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rspDuoSampleFreq$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoSampleFreq")); - public static VarHandle rspDuoSampleFreq$VH() { - return sdrplay_api_DeviceT.rspDuoSampleFreq$VH; + + private static final long rspDuoMode$OFFSET = 72; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode + * } + */ + public static final long rspDuoMode$offset() { + return rspDuoMode$OFFSET; } + /** * Getter for field: - * {@snippet : - * double rspDuoSampleFreq; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode * } */ - public static double rspDuoSampleFreq$get(MemorySegment seg) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg); + public static int rspDuoMode(MemorySegment struct) { + return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET); } + /** * Setter for field: - * {@snippet : - * double rspDuoSampleFreq; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode + * } + */ + public static void 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 void rspDuoSampleFreq$set(MemorySegment seg, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg, x); + public static double rspDuoSampleFreq(MemorySegment struct) { + return struct.get(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET); } - public static double rspDuoSampleFreq$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg.asSlice(index*sizeof())); + + /** + * Setter for field: + * {@snippet lang=c : + * double rspDuoSampleFreq + * } + */ + public static void rspDuoSampleFreq(MemorySegment struct, double fieldValue) { + struct.set(rspDuoSampleFreq$LAYOUT, rspDuoSampleFreq$OFFSET, fieldValue); } - public static void rspDuoSampleFreq$set(MemorySegment seg, long index, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle dev$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dev")); - public static VarHandle dev$VH() { - return sdrplay_api_DeviceT.dev$VH; + + private static final long dev$OFFSET = 88; + + /** + * Offset for field: + * {@snippet lang=c : + * HANDLE dev + * } + */ + public static final long dev$offset() { + return dev$OFFSET; } + /** * Getter for field: - * {@snippet : - * HANDLE dev; + * {@snippet lang=c : + * HANDLE dev * } */ - public static MemorySegment dev$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg); + public static MemorySegment dev(MemorySegment struct) { + return struct.get(dev$LAYOUT, dev$OFFSET); } + /** * Setter for field: - * {@snippet : - * HANDLE dev; + * {@snippet lang=c : + * HANDLE dev * } */ - public static void dev$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg, x); + 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()); } - public static MemorySegment dev$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg.asSlice(index*sizeof())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static void dev$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 31c651a22..ecde690b3 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_DisableHeartbeat_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void) * } */ -public interface sdrplay_api_DisableHeartbeat_t { +public class sdrplay_api_DisableHeartbeat_t { - int apply(); - static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DisableHeartbeat_t_UP$MH, fi, constants$4.sdrplay_api_DisableHeartbeat_t$FUNC, scope); + sdrplay_api_DisableHeartbeat_t() { + // Should not be called directly } - static sdrplay_api_DisableHeartbeat_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 3b15c34db..ac3725a4b 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,77 +21,366 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; +import java.lang.foreign.SequenceLayout; import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * char file[256]; * char function[256]; * int line; * char message[1024]; - * }; + * } * } */ public class sdrplay_api_ErrorInfoT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("file"), - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("function"), - Constants$root.C_INT$LAYOUT.withName("line"), - MemoryLayout.sequenceLayout(1024, Constants$root.C_CHAR$LAYOUT).withName("message") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ErrorInfoT.$struct$LAYOUT; + sdrplay_api_ErrorInfoT() { + // Should not be called directly } - public static MemorySegment file$slice(MemorySegment seg) { - return seg.asSlice(0, 256); + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"), + MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"), + sdrplay_api_h.C_INT.withName("line"), + MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message") + ).withName("$anon$161:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } - public static MemorySegment function$slice(MemorySegment seg) { - return seg.asSlice(256, 256); + + private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file")); + + /** + * Layout for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static final SequenceLayout file$layout() { + return file$LAYOUT; } - static final VarHandle line$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("line")); - public static VarHandle line$VH() { - return sdrplay_api_ErrorInfoT.line$VH; + + private static final long file$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static final long file$offset() { + return file$OFFSET; } + /** * Getter for field: - * {@snippet : - * int line; + * {@snippet lang=c : + * char file[256] * } */ - public static int line$get(MemorySegment seg) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg); + public static MemorySegment file(MemorySegment struct) { + return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * int line; + * {@snippet lang=c : + * char file[256] * } */ - public static void line$set(MemorySegment seg, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg, x); + public static void file(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize()); } - public static int line$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg.asSlice(index*sizeof())); + + private static long[] file$DIMS = { 256 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static long[] file$dimensions() { + return file$DIMS; } - public static void line$set(MemorySegment seg, long index, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg.asSlice(index*sizeof()), x); + private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static byte file(MemorySegment struct, long index0) { + return (byte)file$ELEM_HANDLE.get(struct, 0L, index0); } - public static MemorySegment message$slice(MemorySegment seg) { - return seg.asSlice(516, 1024); + + /** + * Indexed setter for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static void file(MemorySegment struct, long index0, byte fieldValue) { + file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function")); + + /** + * Layout for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static final SequenceLayout function$layout() { + return function$LAYOUT; + } + + private static final long function$OFFSET = 256; + + /** + * Offset for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static final long function$offset() { + return function$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static MemorySegment function(MemorySegment struct) { + return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static void function(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize()); + } + + private static long[] function$DIMS = { 256 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static long[] function$dimensions() { + return function$DIMS; + } + private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static byte function(MemorySegment struct, long index0) { + return (byte)function$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static void function(MemorySegment struct, long index0, byte fieldValue) { + function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); + } + + private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line")); + + /** + * Layout for field: + * {@snippet lang=c : + * int line + * } + */ + public static final OfInt line$layout() { + return line$LAYOUT; + } + + private static final long line$OFFSET = 512; + + /** + * Offset for field: + * {@snippet lang=c : + * int line + * } + */ + public static final long line$offset() { + return line$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int line + * } + */ + public static int line(MemorySegment struct) { + return struct.get(line$LAYOUT, line$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int line + * } + */ + public static void line(MemorySegment struct, int fieldValue) { + struct.set(line$LAYOUT, line$OFFSET, fieldValue); + } + + private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message")); + + /** + * Layout for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static final SequenceLayout message$layout() { + return message$LAYOUT; + } + + private static final long message$OFFSET = 516; + + /** + * Offset for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static final long message$offset() { + return message$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static MemorySegment message(MemorySegment struct) { + return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static void message(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize()); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index f1b924792..5f0d31a31 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * void (*sdrplay_api_EventCallback_t)(enum eventId,enum tuner,union * params,void* cbContext); + * {@snippet lang=c : + * typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *) * } */ -public interface sdrplay_api_EventCallback_t { +public class sdrplay_api_EventCallback_t { - void apply(int eventId, int tuner, java.lang.foreign.MemorySegment params, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_EventCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_EventCallback_t_UP$MH, fi, constants$0.sdrplay_api_EventCallback_t$FUNC, scope); + sdrplay_api_EventCallback_t() { + // Should not be called directly } - static sdrplay_api_EventCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _eventId, int _tuner, java.lang.foreign.MemorySegment _params, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_EventCallback_t_DOWN$MH.invokeExact(symbol, _eventId, _tuner, _params, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) { + try { + DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 2172ce881..ca131745c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,54 +21,217 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.UnionLayout; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * union { * sdrplay_api_GainCbParamT gainParams; * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * }; + * } * } */ public class sdrplay_api_EventParamsT { - static final UnionLayout $union$LAYOUT = MemoryLayout.unionLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ).withName("gainParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ).withName("powerOverloadParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ).withName("rspDuoModeParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_EventParamsT.$union$LAYOUT; - } - public static MemorySegment gainParams$slice(MemorySegment seg) { - return seg.asSlice(0, 16); - } - public static MemorySegment powerOverloadParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static MemorySegment rspDuoModeParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index 92ba1bc9a..d2e845408 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,123 +21,220 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; /** - * {@snippet : + * {@snippet lang=c : * struct { * double fsHz; * unsigned char syncUpdate; * unsigned char reCal; - * }; + * } * } */ public class sdrplay_api_FsFreqT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_FsFreqT.$struct$LAYOUT; + sdrplay_api_FsFreqT() { + // Should not be called directly } - static final VarHandle fsHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsHz")); - public static VarHandle fsHz$VH() { - return sdrplay_api_FsFreqT.fsHz$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_DOUBLE.withName("fsHz"), + sdrplay_api_h.C_CHAR.withName("syncUpdate"), + sdrplay_api_h.C_CHAR.withName("reCal"), + MemoryLayout.paddingLayout(6) + ).withName("$anon$17:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz")); + + /** + * Layout for field: + * {@snippet lang=c : + * double fsHz + * } + */ + public static final OfDouble fsHz$layout() { + return fsHz$LAYOUT; + } + + private static final long fsHz$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * double fsHz + * } + */ + public static final long fsHz$offset() { + return fsHz$OFFSET; } + /** * Getter for field: - * {@snippet : - * double fsHz; + * {@snippet lang=c : + * double fsHz * } */ - public static double fsHz$get(MemorySegment seg) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg); + public static double fsHz(MemorySegment struct) { + return struct.get(fsHz$LAYOUT, fsHz$OFFSET); } + /** * Setter for field: - * {@snippet : - * double fsHz; + * {@snippet lang=c : + * double fsHz * } */ - public static void fsHz$set(MemorySegment seg, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg, x); + public static void fsHz(MemorySegment struct, double fieldValue) { + struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue); } - public static double fsHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_FsFreqT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg, x); - } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + public static void syncUpdate(MemorySegment struct, byte fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle reCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("reCal")); - public static VarHandle reCal$VH() { - return sdrplay_api_FsFreqT.reCal$VH; + + private static final long reCal$OFFSET = 9; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char reCal + * } + */ + public static final long reCal$offset() { + return reCal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char reCal; + * {@snippet lang=c : + * unsigned char reCal * } */ - public static byte reCal$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg); + public static byte reCal(MemorySegment struct) { + return struct.get(reCal$LAYOUT, reCal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char reCal; + * {@snippet lang=c : + * unsigned char reCal * } */ - public static void reCal$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg, x); + public static void reCal(MemorySegment struct, byte fieldValue) { + struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue); } - public static byte reCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void reCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 4858d523a..1b3c7e759 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,219 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int gRdB; * unsigned int lnaGRdB; * double currGain; - * }; + * } * } */ public class sdrplay_api_GainCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainCbParamT.$struct$LAYOUT; + sdrplay_api_GainCbParamT() { + // Should not be called directly } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainCbParamT.gRdB$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_INT.withName("gRdB"), + sdrplay_api_h.C_INT.withName("lnaGRdB"), + sdrplay_api_h.C_DOUBLE.withName("currGain") + ).withName("$anon$31:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned int gRdB + * } + */ + public static final OfInt gRdB$layout() { + return gRdB$LAYOUT; + } + + private static final long gRdB$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int gRdB + * } + */ + public static final long gRdB$offset() { + return gRdB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned int gRdB; + * {@snippet lang=c : + * unsigned int gRdB * } */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg); + public static int gRdB(MemorySegment struct) { + return struct.get(gRdB$LAYOUT, gRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int gRdB; + * {@snippet lang=c : + * unsigned int gRdB * } */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg, x); + public static void gRdB(MemorySegment struct, int fieldValue) { + struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg.asSlice(index*sizeof())); - } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle lnaGRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("lnaGRdB")); - public static VarHandle lnaGRdB$VH() { - return sdrplay_api_GainCbParamT.lnaGRdB$VH; + + private static final long lnaGRdB$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int lnaGRdB + * } + */ + public static final long lnaGRdB$offset() { + return lnaGRdB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned int lnaGRdB; + * {@snippet lang=c : + * unsigned int lnaGRdB * } */ - public static int lnaGRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg); + public static int lnaGRdB(MemorySegment struct) { + return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int lnaGRdB; + * {@snippet lang=c : + * unsigned int lnaGRdB * } */ - public static void lnaGRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg, x); - } - public static int lnaGRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg.asSlice(index*sizeof())); + public static void lnaGRdB(MemorySegment struct, int fieldValue) { + struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue); } - public static void lnaGRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle currGain$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("currGain")); - public static VarHandle currGain$VH() { - return sdrplay_api_GainCbParamT.currGain$VH; + + private static final long currGain$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * double currGain + * } + */ + public static final long currGain$offset() { + return currGain$OFFSET; } + /** * Getter for field: - * {@snippet : - * double currGain; + * {@snippet lang=c : + * double currGain * } */ - public static double currGain$get(MemorySegment seg) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg); + public static double currGain(MemorySegment struct) { + return struct.get(currGain$LAYOUT, currGain$OFFSET); } + /** * Setter for field: - * {@snippet : - * double currGain; + * {@snippet lang=c : + * double currGain * } */ - public static void currGain$set(MemorySegment seg, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg, x); + public static void currGain(MemorySegment struct, double fieldValue) { + struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue); } - public static double currGain$get(MemorySegment seg, long index) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void currGain$set(MemorySegment seg, long index, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 7eb4d1192..60d428db4 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,162 +21,312 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * int gRdB; * unsigned char LNAstate; * unsigned char syncUpdate; * sdrplay_api_MinGainReductionT minGr; * sdrplay_api_GainValuesT gainVals; - * }; + * } * } */ public class sdrplay_api_GainT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainT.$struct$LAYOUT; - } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainT.gRdB$VH; + 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 : - * int gRdB; + * {@snippet lang=c : + * int gRdB * } */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg); + public static int gRdB(MemorySegment struct) { + return struct.get(gRdB$LAYOUT, gRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * int gRdB; + * {@snippet lang=c : + * int gRdB * } */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg, x); - } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg.asSlice(index*sizeof())); + public static void gRdB(MemorySegment struct, int fieldValue) { + struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle LNAstate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("LNAstate")); - public static VarHandle LNAstate$VH() { - return sdrplay_api_GainT.LNAstate$VH; + + private static final long LNAstate$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char LNAstate + * } + */ + public static final long LNAstate$offset() { + return LNAstate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char LNAstate; + * {@snippet lang=c : + * unsigned char LNAstate * } */ - public static byte LNAstate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg); + public static byte LNAstate(MemorySegment struct) { + return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char LNAstate; + * {@snippet lang=c : + * unsigned char LNAstate * } */ - public static void LNAstate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg, x); - } - public static byte LNAstate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg.asSlice(index*sizeof())); + public static void LNAstate(MemorySegment struct, byte fieldValue) { + struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue); } - public static void LNAstate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_GainT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 5; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static void syncUpdate(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 void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg, x); + public static final OfInt minGr$layout() { + return minGr$LAYOUT; } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + 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); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - static final VarHandle minGr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("minGr")); - public static VarHandle minGr$VH() { - return sdrplay_api_GainT.minGr$VH; + + private static final 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 : - * sdrplay_api_MinGainReductionT minGr; + * {@snippet lang=c : + * sdrplay_api_GainValuesT gainVals * } */ - public static int minGr$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg); + public static MemorySegment gainVals(MemorySegment struct) { + return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_MinGainReductionT minGr; + * {@snippet lang=c : + * sdrplay_api_GainValuesT gainVals * } */ - public static void minGr$set(MemorySegment seg, int x) { - sdrplay_api_GainT.minGr$VH.set(seg, x); + public static void gainVals(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize()); } - public static int minGr$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void minGr$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.minGr$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment gainVals$slice(MemorySegment seg) { - return seg.asSlice(12, 12); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index e8a2526d6..4847603e8 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfFloat; /** - * {@snippet : + * {@snippet lang=c : * struct { * float curr; * float max; * float min; - * }; + * } * } */ public class sdrplay_api_GainValuesT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainValuesT.$struct$LAYOUT; + sdrplay_api_GainValuesT() { + // Should not be called directly } - static final VarHandle curr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("curr")); - public static VarHandle curr$VH() { - return sdrplay_api_GainValuesT.curr$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_FLOAT.withName("curr"), + sdrplay_api_h.C_FLOAT.withName("max"), + sdrplay_api_h.C_FLOAT.withName("min") + ).withName("$anon$53:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr")); + + /** + * Layout for field: + * {@snippet lang=c : + * float curr + * } + */ + public static final OfFloat curr$layout() { + return curr$LAYOUT; + } + + private static final long curr$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * float curr + * } + */ + public static final long curr$offset() { + return curr$OFFSET; } + /** * Getter for field: - * {@snippet : - * float curr; + * {@snippet lang=c : + * float curr * } */ - public static float curr$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg); + public static float curr(MemorySegment struct) { + return struct.get(curr$LAYOUT, curr$OFFSET); } + /** * Setter for field: - * {@snippet : - * float curr; + * {@snippet lang=c : + * float curr * } */ - public static void curr$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg, x); + public static void curr(MemorySegment struct, float fieldValue) { + struct.set(curr$LAYOUT, curr$OFFSET, fieldValue); } - public static float curr$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg.asSlice(index*sizeof())); - } - public static void curr$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle max$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("max")); - public static VarHandle max$VH() { - return sdrplay_api_GainValuesT.max$VH; + + private static final long max$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * float max + * } + */ + public static final long max$offset() { + return max$OFFSET; } + /** * Getter for field: - * {@snippet : - * float max; + * {@snippet lang=c : + * float max * } */ - public static float max$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg); + public static float max(MemorySegment struct) { + return struct.get(max$LAYOUT, max$OFFSET); } + /** * Setter for field: - * {@snippet : - * float max; + * {@snippet lang=c : + * float max * } */ - public static void max$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg, x); - } - public static float max$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg.asSlice(index*sizeof())); + public static void max(MemorySegment struct, float fieldValue) { + struct.set(max$LAYOUT, max$OFFSET, fieldValue); } - public static void max$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle min$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("min")); - public static VarHandle min$VH() { - return sdrplay_api_GainValuesT.min$VH; + + private static final long min$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * float min + * } + */ + public static final long min$offset() { + return min$OFFSET; } + /** * Getter for field: - * {@snippet : - * float min; + * {@snippet lang=c : + * float min * } */ - public static float min$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg); + public static float min(MemorySegment struct) { + return struct.get(min$LAYOUT, min$OFFSET); } + /** * Setter for field: - * {@snippet : - * float min; + * {@snippet lang=c : + * float min * } */ - public static void min$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg, x); + public static void min(MemorySegment struct, float fieldValue) { + struct.set(min$LAYOUT, min$OFFSET, fieldValue); } - public static float min$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void min$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 3e426d75f..1d2605d70 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_GetDeviceParams_t)(void* dev,struct ** deviceParams); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **) * } */ -public interface sdrplay_api_GetDeviceParams_t { +public class sdrplay_api_GetDeviceParams_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment deviceParams); - static MemorySegment allocate(sdrplay_api_GetDeviceParams_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_GetDeviceParams_t_UP$MH, fi, constants$4.sdrplay_api_GetDeviceParams_t$FUNC, scope); + sdrplay_api_GetDeviceParams_t() { + // Should not be called directly } - static sdrplay_api_GetDeviceParams_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _deviceParams) -> { - try { - return (int)constants$4.sdrplay_api_GetDeviceParams_t_DOWN$MH.invokeExact(symbol, _dev, _deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment deviceParams); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 4972d2826..cae0ac9ee 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_GetDevices_t)(struct * devices,unsigned int* numDevs,unsigned int maxDevs); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int) * } */ -public interface sdrplay_api_GetDevices_t { +public class sdrplay_api_GetDevices_t { - int apply(java.lang.foreign.MemorySegment devices, java.lang.foreign.MemorySegment numDevs, int maxDevs); - static MemorySegment allocate(sdrplay_api_GetDevices_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_GetDevices_t_UP$MH, fi, constants$2.sdrplay_api_GetDevices_t$FUNC, scope); + sdrplay_api_GetDevices_t() { + // Should not be called directly } - static sdrplay_api_GetDevices_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _devices, java.lang.foreign.MemorySegment _numDevs, int _maxDevs) -> { - try { - return (int)constants$2.sdrplay_api_GetDevices_t_DOWN$MH.invokeExact(symbol, _devices, _numDevs, _maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index dc6889cfc..6c4f3529c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * char* (*sdrplay_api_GetErrorString_t)(enum err); + * {@snippet lang=c : + * typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT) * } */ -public interface sdrplay_api_GetErrorString_t { +public class sdrplay_api_GetErrorString_t { - java.lang.foreign.MemorySegment apply(int err); - static MemorySegment allocate(sdrplay_api_GetErrorString_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetErrorString_t_UP$MH, fi, constants$3.sdrplay_api_GetErrorString_t$FUNC, scope); + sdrplay_api_GetErrorString_t() { + // Should not be called directly } - static sdrplay_api_GetErrorString_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _err) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetErrorString_t_DOWN$MH.invokeExact(symbol, _err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + MemorySegment apply(int err); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static MemorySegment invoke(MemorySegment funcPtr,int err) { + try { + return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 1b0d1ac12..a73dad14f 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * struct * (*sdrplay_api_GetLastError_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_GetLastError_t { +public class sdrplay_api_GetLastError_t { - java.lang.foreign.MemorySegment apply(java.lang.foreign.MemorySegment device); - static MemorySegment allocate(sdrplay_api_GetLastError_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetLastError_t_UP$MH, fi, constants$3.sdrplay_api_GetLastError_t$FUNC, scope); + sdrplay_api_GetLastError_t() { + // Should not be called directly } - static sdrplay_api_GetLastError_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _device) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetLastError_t_DOWN$MH.invokeExact(symbol, _device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + MemorySegment apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { + try { + return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 90c043b75..a5ba00305 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Init_t)(void* dev,struct * callbackFns,void* cbContext); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *) * } */ -public interface sdrplay_api_Init_t { +public class sdrplay_api_Init_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment callbackFns, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_Init_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Init_t_UP$MH, fi, constants$5.sdrplay_api_Init_t$FUNC, scope); + sdrplay_api_Init_t() { + // Should not be called directly } - static sdrplay_api_Init_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _callbackFns, java.lang.foreign.MemorySegment _cbContext) -> { - try { - return (int)constants$5.sdrplay_api_Init_t_DOWN$MH.invokeExact(symbol, _dev, _callbackFns, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index f2239c61a..44fce4995 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_LockDeviceApi_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void) * } */ -public interface sdrplay_api_LockDeviceApi_t { +public class sdrplay_api_LockDeviceApi_t { - int apply(); - static MemorySegment allocate(sdrplay_api_LockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_LockDeviceApi_t_UP$MH, fi, constants$1.sdrplay_api_LockDeviceApi_t$FUNC, scope); + sdrplay_api_LockDeviceApi_t() { + // Should not be called directly } - static sdrplay_api_LockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_LockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 64e2910fc..f3f334171 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Open_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void) * } */ -public interface sdrplay_api_Open_t { +public class sdrplay_api_Open_t { - int apply(); - static MemorySegment allocate(sdrplay_api_Open_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_Open_t_UP$MH, fi, constants$0.sdrplay_api_Open_t$FUNC, scope); + sdrplay_api_Open_t() { + // Should not be called directly } - static sdrplay_api_Open_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$0.sdrplay_api_Open_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 4cb9257e7..db34076bc 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,126 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * }; + * } * } */ public class sdrplay_api_PowerOverloadCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_PowerOverloadCbParamT.$struct$LAYOUT; + sdrplay_api_PowerOverloadCbParamT() { + // Should not be called directly } - static final VarHandle powerOverloadChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("powerOverloadChangeType")); - public static VarHandle powerOverloadChangeType$VH() { - return sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_INT.withName("powerOverloadChangeType") + ).withName("$anon$38:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType + * } + */ + public static final OfInt powerOverloadChangeType$layout() { + return powerOverloadChangeType$LAYOUT; + } + + private static final long powerOverloadChangeType$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType + * } + */ + public static final long powerOverloadChangeType$offset() { + return powerOverloadChangeType$OFFSET; + } + /** * Getter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType * } */ - public static int powerOverloadChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg); + public static int powerOverloadChangeType(MemorySegment struct) { + return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType * } */ - public static void powerOverloadChangeType$set(MemorySegment seg, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg, x); + public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) { + struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue); } - public static int powerOverloadChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void powerOverloadChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 2395afbe0..7e19244ae 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_ReleaseDevice_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_ReleaseDevice_t { +public class sdrplay_api_ReleaseDevice_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate); - static MemorySegment allocate(sdrplay_api_ReleaseDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_ReleaseDevice_t_UP$MH, fi, constants$3.sdrplay_api_ReleaseDevice_t$FUNC, scope); + sdrplay_api_ReleaseDevice_t() { + // Should not be called directly } - static sdrplay_api_ReleaseDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate) -> { - try { - return (int)constants$3.sdrplay_api_ReleaseDevice_t_DOWN$MH.invokeExact(symbol, _currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment device) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, device); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 4dfad5634..f02f9672a 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char resetGainUpdate; * unsigned char resetRfUpdate; * unsigned char resetFsUpdate; - * }; + * } * } */ public class sdrplay_api_ResetFlagsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ResetFlagsT.$struct$LAYOUT; + sdrplay_api_ResetFlagsT() { + // Should not be called directly } - static final VarHandle resetGainUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetGainUpdate")); - public static VarHandle resetGainUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetGainUpdate$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), + sdrplay_api_h.C_CHAR.withName("resetRfUpdate"), + sdrplay_api_h.C_CHAR.withName("resetFsUpdate") + ).withName("$anon$30:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char resetGainUpdate + * } + */ + public static final OfByte resetGainUpdate$layout() { + return resetGainUpdate$LAYOUT; + } + + private static final long resetGainUpdate$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetGainUpdate + * } + */ + public static final long resetGainUpdate$offset() { + return resetGainUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetGainUpdate; + * {@snippet lang=c : + * unsigned char resetGainUpdate * } */ - public static byte resetGainUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg); + public static byte resetGainUpdate(MemorySegment struct) { + return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetGainUpdate; + * {@snippet lang=c : + * unsigned char resetGainUpdate * } */ - public static void resetGainUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg, x); + public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); } - public static byte resetGainUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetGainUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle resetRfUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetRfUpdate")); - public static VarHandle resetRfUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetRfUpdate$VH; + + private static final long resetRfUpdate$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetRfUpdate + * } + */ + public static final long resetRfUpdate$offset() { + return resetRfUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetRfUpdate; + * {@snippet lang=c : + * unsigned char resetRfUpdate * } */ - public static byte resetRfUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg); + public static byte resetRfUpdate(MemorySegment struct) { + return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetRfUpdate; + * {@snippet lang=c : + * unsigned char resetRfUpdate * } */ - public static void resetRfUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg, x); - } - public static byte resetRfUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg.asSlice(index*sizeof())); + public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); } - public static void resetRfUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle resetFsUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetFsUpdate")); - public static VarHandle resetFsUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetFsUpdate$VH; + + private static final long resetFsUpdate$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetFsUpdate + * } + */ + public static final long resetFsUpdate$offset() { + return resetFsUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetFsUpdate; + * {@snippet lang=c : + * unsigned char resetFsUpdate * } */ - public static byte resetFsUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg); + public static byte resetFsUpdate(MemorySegment struct) { + return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetFsUpdate; + * {@snippet lang=c : + * unsigned char resetFsUpdate * } */ - public static void resetFsUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg, x); + public static void resetFsUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue); } - public static byte resetFsUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void resetFsUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 97a37772f..450fa5a81 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,93 +21,174 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; /** - * {@snippet : + * {@snippet lang=c : * struct { * double rfHz; * unsigned char syncUpdate; - * }; + * } * } */ public class sdrplay_api_RfFreqT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RfFreqT.$struct$LAYOUT; + sdrplay_api_RfFreqT() { + // Should not be called directly + } + + 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; } - static final VarHandle rfHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfHz")); - public static VarHandle rfHz$VH() { - return sdrplay_api_RfFreqT.rfHz$VH; + + private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz")); + + /** + * Layout for field: + * {@snippet lang=c : + * double rfHz + * } + */ + public static final OfDouble rfHz$layout() { + return rfHz$LAYOUT; } + + private static final long rfHz$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * double rfHz + * } + */ + public static final long rfHz$offset() { + return rfHz$OFFSET; + } + /** * Getter for field: - * {@snippet : - * double rfHz; + * {@snippet lang=c : + * double rfHz * } */ - public static double rfHz$get(MemorySegment seg) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg); + public static double rfHz(MemorySegment struct) { + return struct.get(rfHz$LAYOUT, rfHz$OFFSET); } + /** * Setter for field: - * {@snippet : - * double rfHz; + * {@snippet lang=c : + * double rfHz * } */ - public static void rfHz$set(MemorySegment seg, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg, x); - } - public static double rfHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg.asSlice(index*sizeof())); + public static void rfHz(MemorySegment struct, double fieldValue) { + struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue); } - public static void rfHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_RfFreqT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, byte fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 6ba81eaea..dbaf54df0 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,92 +21,172 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_Rsp1aParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aParamsT.$struct$LAYOUT; + sdrplay_api_Rsp1aParamsT() { + // Should not be called directly + } + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH; + + private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char rfNotchEnable + * } + */ + public static final OfByte rfNotchEnable$layout() { + return rfNotchEnable$LAYOUT; } + + private static final long rfNotchEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char rfNotchEnable + * } + */ + public static final long rfNotchEnable$offset() { + return rfNotchEnable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH; + + private static final long rfDabNotchEnable$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char rfDabNotchEnable + * } + */ + public static final long rfDabNotchEnable$offset() { + return rfDabNotchEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 7f788ae6c..77d1051eb 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,126 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.foreign.Arena; +import java.lang.foreign.GroupLayout; import java.lang.foreign.MemoryLayout; import java.lang.foreign.MemorySegment; import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; - * }; + * } * } */ public class sdrplay_api_Rsp1aTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aTunerParamsT.$struct$LAYOUT; + sdrplay_api_Rsp1aTunerParamsT() { + // Should not be called directly } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("biasTEnable") + ).withName("$anon$17:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final OfByte biasTEnable$layout() { + return biasTEnable$LAYOUT; + } + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index e5795abbc..2d8f6c040 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char extRefOutputEn; - * }; + * } * } */ public class sdrplay_api_Rsp2ParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2ParamsT.$struct$LAYOUT; + sdrplay_api_Rsp2ParamsT() { + // Should not be called directly } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("extRefOutputEn") + ).withName("$anon$22:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char extRefOutputEn + * } + */ + public static final OfByte extRefOutputEn$layout() { + return extRefOutputEn$LAYOUT; + } + + private static final long extRefOutputEn$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char extRefOutputEn + * } + */ + public static final long extRefOutputEn$offset() { + return extRefOutputEn$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char extRefOutputEn; + * {@snippet lang=c : + * unsigned char extRefOutputEn * } */ - public static byte extRefOutputEn$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg); + public static byte extRefOutputEn(MemorySegment struct) { + return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char extRefOutputEn; + * {@snippet lang=c : + * unsigned char extRefOutputEn * } */ - public static void extRefOutputEn$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg, x); + public static void extRefOutputEn(MemorySegment struct, byte fieldValue) { + struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); } - public static byte extRefOutputEn$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void extRefOutputEn$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index fa8510655..4782664cf 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,154 +21,262 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; * sdrplay_api_Rsp2_AmPortSelectT amPortSel; * sdrplay_api_Rsp2_AntennaSelectT antennaSel; * unsigned char rfNotchEnable; - * }; + * } * } */ public class sdrplay_api_Rsp2TunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2TunerParamsT.$struct$LAYOUT; + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH; + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle amPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("amPortSel")); - public static VarHandle amPortSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.amPortSel$VH; + + 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 : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AmPortSelectT amPortSel * } */ - public static int amPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg); + public static int amPortSel(MemorySegment struct) { + return struct.get(amPortSel$LAYOUT, amPortSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AmPortSelectT amPortSel * } */ - public static void amPortSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg, x); + public static void amPortSel(MemorySegment struct, int fieldValue) { + struct.set(amPortSel$LAYOUT, amPortSel$OFFSET, fieldValue); } - public static int amPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void amPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.antennaSel$VH; + + 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 : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AntennaSelectT antennaSel * } */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg); + public static int antennaSel(MemorySegment struct) { + return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AntennaSelectT antennaSel * } */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); + public static void antennaSel(MemorySegment struct, int fieldValue) { + struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg, x); + 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()); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index eb27e169c..def8c8aa3 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * }; + * } * } */ public class sdrplay_api_RspDuoModeCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoModeCbParamT.$struct$LAYOUT; + sdrplay_api_RspDuoModeCbParamT() { + // Should not be called directly } - static final VarHandle modeChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modeChangeType")); - public static VarHandle modeChangeType$VH() { - return sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH; + + 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 : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeCbEventIdT modeChangeType * } */ - public static int modeChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg); + public static int modeChangeType(MemorySegment struct) { + return struct.get(modeChangeType$LAYOUT, modeChangeType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeCbEventIdT modeChangeType * } */ - public static void modeChangeType$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg, x); + public static void modeChangeType(MemorySegment struct, int fieldValue) { + struct.set(modeChangeType$LAYOUT, modeChangeType$OFFSET, fieldValue); } - public static int modeChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void modeChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index db8af509f..e405b7ca4 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * int extRefOutputEn; - * }; + * } * } */ public class sdrplay_api_RspDuoParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoParamsT.$struct$LAYOUT; + sdrplay_api_RspDuoParamsT() { + // Should not be called directly } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_RspDuoParamsT.extRefOutputEn$VH; + + 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 : - * int extRefOutputEn; + * {@snippet lang=c : + * int extRefOutputEn * } */ - public static int extRefOutputEn$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg); + public static int extRefOutputEn(MemorySegment struct) { + return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); } + /** * Setter for field: - * {@snippet : - * int extRefOutputEn; + * {@snippet lang=c : + * int extRefOutputEn * } */ - public static void extRefOutputEn$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg, x); + public static void extRefOutputEn(MemorySegment struct, int fieldValue) { + struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); } - public static int extRefOutputEn$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void extRefOutputEn$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index c07ded903..82538861d 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,184 +21,308 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; * unsigned char tuner1AmNotchEnable; * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_RspDuoTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(8) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoTunerParamsT.$struct$LAYOUT; + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH; + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle tuner1AmPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmPortSel")); - public static VarHandle tuner1AmPortSel$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH; + + 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 : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; + * {@snippet lang=c : + * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel * } */ - public static int tuner1AmPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg); + public static int tuner1AmPortSel(MemorySegment struct) { + return struct.get(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; + * {@snippet lang=c : + * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel * } */ - public static void tuner1AmPortSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg, x); + public static void tuner1AmPortSel(MemorySegment struct, int fieldValue) { + struct.set(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET, fieldValue); } - public static int tuner1AmPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner1AmPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle tuner1AmNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmNotchEnable")); - public static VarHandle tuner1AmNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH; + + 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 : - * unsigned char tuner1AmNotchEnable; + * {@snippet lang=c : + * unsigned char tuner1AmNotchEnable * } */ - public static byte tuner1AmNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg); + public static byte tuner1AmNotchEnable(MemorySegment struct) { + return struct.get(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char tuner1AmNotchEnable; + * {@snippet lang=c : + * unsigned char tuner1AmNotchEnable * } */ - public static void tuner1AmNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg, x); - } - public static byte tuner1AmNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg.asSlice(index*sizeof())); + public static void tuner1AmNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET, fieldValue); } - public static void tuner1AmNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg, x); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH; + + 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 : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index b08a6e91f..5df47a6a8 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,184 +21,308 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char hdrEnable; * unsigned char biasTEnable; * sdrplay_api_RspDx_AntennaSelectT antennaSel; * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_RspDxParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxParamsT.$struct$LAYOUT; + 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; } - static final VarHandle hdrEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrEnable")); - public static VarHandle hdrEnable$VH() { - return sdrplay_api_RspDxParamsT.hdrEnable$VH; + + 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 : - * unsigned char hdrEnable; + * {@snippet lang=c : + * unsigned char hdrEnable * } */ - public static byte hdrEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg); + public static byte hdrEnable(MemorySegment struct) { + return struct.get(hdrEnable$LAYOUT, hdrEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char hdrEnable; + * {@snippet lang=c : + * unsigned char hdrEnable * } */ - public static void hdrEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg, x); - } - public static byte hdrEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg.asSlice(index*sizeof())); + public static void hdrEnable(MemorySegment struct, byte fieldValue) { + struct.set(hdrEnable$LAYOUT, hdrEnable$OFFSET, fieldValue); } - public static void hdrEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDxParamsT.biasTEnable$VH; + + 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 : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_RspDxParamsT.antennaSel$VH; + + 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 : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_RspDx_AntennaSelectT antennaSel * } */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg); + public static int antennaSel(MemorySegment struct) { + return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_RspDx_AntennaSelectT antennaSel * } */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); + public static void antennaSel(MemorySegment struct, int fieldValue) { + struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg, x); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH; + + 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 : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index cb28007b3..167ac3ad0 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,58 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * }; + * } * } */ public class sdrplay_api_RspDxTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxTunerParamsT.$struct$LAYOUT; + sdrplay_api_RspDxTunerParamsT() { + // Should not be called directly } - static final VarHandle hdrBw$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrBw")); - public static VarHandle hdrBw$VH() { - return sdrplay_api_RspDxTunerParamsT.hdrBw$VH; + + 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 : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; + * {@snippet lang=c : + * sdrplay_api_RspDx_HdrModeBwT hdrBw * } */ - public static int hdrBw$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg); + public static int hdrBw(MemorySegment struct) { + return struct.get(hdrBw$LAYOUT, hdrBw$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; + * {@snippet lang=c : + * sdrplay_api_RspDx_HdrModeBwT hdrBw * } */ - public static void hdrBw$set(MemorySegment seg, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg, x); + public static void hdrBw(MemorySegment struct, int fieldValue) { + struct.set(hdrBw$LAYOUT, hdrBw$OFFSET, fieldValue); } - public static int hdrBw$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void hdrBw$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 77eda0974..e4f0f43e0 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,9 +22,12 @@ 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 : + * {@snippet lang=c : * struct { * sdrplay_api_TunerParamsT tunerParams; * sdrplay_api_ControlParamsT ctrlParams; @@ -32,118 +35,339 @@ * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams; * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams; * sdrplay_api_RspDxTunerParamsT rspDxTunerParams; - * }; + * } * } */ public class sdrplay_api_RxChannelParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ).withName("tunerParams"), - MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ).withName("ctrlParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ).withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ).withName("rsp2TunerParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(8) - ).withName("rspDuoTunerParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ).withName("rspDxTunerParams"), - MemoryLayout.paddingLayout(32) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RxChannelParamsT.$struct$LAYOUT; - } - public static MemorySegment tunerParams$slice(MemorySegment seg) { - return seg.asSlice(0, 72); - } - public static MemorySegment ctrlParams$slice(MemorySegment seg) { - return seg.asSlice(72, 32); - } - public static MemorySegment rsp1aTunerParams$slice(MemorySegment seg) { - return seg.asSlice(104, 1); - } - public static MemorySegment rsp2TunerParams$slice(MemorySegment seg) { - return seg.asSlice(108, 16); - } - public static MemorySegment rspDuoTunerParams$slice(MemorySegment seg) { - return seg.asSlice(124, 12); - } - public static MemorySegment rspDxTunerParams$slice(MemorySegment seg) { - return seg.asSlice(136, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index a272a0d94..f6d93c4fe 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,60 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SelectDevice_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_SelectDevice_t { +public class sdrplay_api_SelectDevice_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate); - static MemorySegment allocate(sdrplay_api_SelectDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_SelectDevice_t_UP$MH, fi, constants$2.sdrplay_api_SelectDevice_t$FUNC, scope); + sdrplay_api_SelectDevice_t() { + // Should not be called directly } - static sdrplay_api_SelectDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate) -> { - try { - return (int)constants$2.sdrplay_api_SelectDevice_t_DOWN$MH.invokeExact(symbol, _currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_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 index 1fb93396c..823949d7b 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * void (*sdrplay_api_StreamCallback_t)(short* xi,short* xq,struct * params,unsigned int numSamples,unsigned int reset,void* cbContext); + * {@snippet lang=c : + * typedef void (*sdrplay_api_StreamCallback_t)(short *, short *, sdrplay_api_StreamCbParamsT *, unsigned int, unsigned int, void *) * } */ -public interface sdrplay_api_StreamCallback_t { +public class sdrplay_api_StreamCallback_t { - void apply(java.lang.foreign.MemorySegment xi, java.lang.foreign.MemorySegment xq, java.lang.foreign.MemorySegment params, int numSamples, int reset, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_StreamCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_StreamCallback_t_UP$MH, fi, constants$0.sdrplay_api_StreamCallback_t$FUNC, scope); + sdrplay_api_StreamCallback_t() { + // Should not be called directly } - static sdrplay_api_StreamCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _xi, java.lang.foreign.MemorySegment _xq, java.lang.foreign.MemorySegment _params, int _numSamples, int _reset, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_StreamCallback_t_DOWN$MH.invokeExact(symbol, _xi, _xq, _params, _numSamples, _reset, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(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 index 71c506980..ac4683223 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,178 +21,306 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int firstSampleNum; * int grChanged; * int rfChanged; * int fsChanged; * unsigned int numSamples; - * }; + * } * } */ public class sdrplay_api_StreamCbParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("firstSampleNum"), - Constants$root.C_INT$LAYOUT.withName("grChanged"), - Constants$root.C_INT$LAYOUT.withName("rfChanged"), - Constants$root.C_INT$LAYOUT.withName("fsChanged"), - Constants$root.C_INT$LAYOUT.withName("numSamples") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_StreamCbParamsT.$struct$LAYOUT; + 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; } - static final VarHandle firstSampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("firstSampleNum")); - public static VarHandle firstSampleNum$VH() { - return sdrplay_api_StreamCbParamsT.firstSampleNum$VH; + + 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 : - * unsigned int firstSampleNum; + * {@snippet lang=c : + * unsigned int firstSampleNum * } */ - public static int firstSampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg); + public static int firstSampleNum(MemorySegment struct) { + return struct.get(firstSampleNum$LAYOUT, firstSampleNum$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int firstSampleNum; + * {@snippet lang=c : + * unsigned int firstSampleNum * } */ - public static void firstSampleNum$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg, x); - } - public static int firstSampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg.asSlice(index*sizeof())); + public static void firstSampleNum(MemorySegment struct, int fieldValue) { + struct.set(firstSampleNum$LAYOUT, firstSampleNum$OFFSET, fieldValue); } - public static void firstSampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle grChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("grChanged")); - public static VarHandle grChanged$VH() { - return sdrplay_api_StreamCbParamsT.grChanged$VH; + + 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 : - * int grChanged; + * {@snippet lang=c : + * int grChanged * } */ - public static int grChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg); + public static int grChanged(MemorySegment struct) { + return struct.get(grChanged$LAYOUT, grChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int grChanged; + * {@snippet lang=c : + * int grChanged * } */ - public static void grChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg, x); + public static void grChanged(MemorySegment struct, int fieldValue) { + struct.set(grChanged$LAYOUT, grChanged$OFFSET, fieldValue); } - public static int grChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void grChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfChanged")); - public static VarHandle rfChanged$VH() { - return sdrplay_api_StreamCbParamsT.rfChanged$VH; + + 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 : - * int rfChanged; + * {@snippet lang=c : + * int rfChanged * } */ - public static int rfChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg); + public static int rfChanged(MemorySegment struct) { + return struct.get(rfChanged$LAYOUT, rfChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int rfChanged; + * {@snippet lang=c : + * int rfChanged * } */ - public static void rfChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg, x); - } - public static int rfChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg.asSlice(index*sizeof())); + public static void rfChanged(MemorySegment struct, int fieldValue) { + struct.set(rfChanged$LAYOUT, rfChanged$OFFSET, fieldValue); } - public static void rfChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle fsChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsChanged")); - public static VarHandle fsChanged$VH() { - return sdrplay_api_StreamCbParamsT.fsChanged$VH; + + 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 : - * int fsChanged; + * {@snippet lang=c : + * int fsChanged * } */ - public static int fsChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg); + public static int fsChanged(MemorySegment struct) { + return struct.get(fsChanged$LAYOUT, fsChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int fsChanged; + * {@snippet lang=c : + * int fsChanged * } */ - public static void fsChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg, x); + public static void fsChanged(MemorySegment struct, int fieldValue) { + struct.set(fsChanged$LAYOUT, fsChanged$OFFSET, fieldValue); } - public static int fsChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle numSamples$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("numSamples")); - public static VarHandle numSamples$VH() { - return sdrplay_api_StreamCbParamsT.numSamples$VH; + + 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 : - * unsigned int numSamples; + * {@snippet lang=c : + * unsigned int numSamples * } */ - public static int numSamples$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg); + public static int numSamples(MemorySegment struct) { + return struct.get(numSamples$LAYOUT, numSamples$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int numSamples; + * {@snippet lang=c : + * unsigned int numSamples * } */ - public static void numSamples$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg, x); + public static void numSamples(MemorySegment struct, int fieldValue) { + struct.set(numSamples$LAYOUT, numSamples$OFFSET, fieldValue); } - public static int numSamples$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void numSamples$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 0114308be..302a99224 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,62 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoActiveTuner_t)(void* dev,enum * tuner,enum tuner1AmPortSel); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE, sdrplay_api_TunerSelectT *, sdrplay_api_RspDuo_AmPortSelectT) * } */ -public interface sdrplay_api_SwapRspDuoActiveTuner_t { +public class sdrplay_api_SwapRspDuoActiveTuner_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment tuner, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoActiveTuner_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoActiveTuner_t$FUNC, scope); + sdrplay_api_SwapRspDuoActiveTuner_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoActiveTuner_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _tuner, int _tuner1AmPortSel) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH.invokeExact(symbol, _dev, _tuner, _tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment 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 index 255dddc22..2f1fee7ac 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,60 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double* currentSampleRate); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *) * } */ -public interface sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { +public class sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate); - static MemorySegment allocate(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC, scope); + sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH.invokeExact(symbol, _currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment 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 index af607c17d..040537b6a 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,67 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoMode_t)(struct * currDevice,struct ** deviceParams,enum rspDuoMode,double sampleRate,enum tuner,enum bwType,enum ifType,enum tuner1AmPortSel); + * {@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 interface sdrplay_api_SwapRspDuoMode_t { +public class sdrplay_api_SwapRspDuoMode_t { - int apply(java.lang.foreign.MemorySegment currDevice, java.lang.foreign.MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoMode_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoMode_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoMode_t$FUNC, scope); + sdrplay_api_SwapRspDuoMode_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoMode_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currDevice, java.lang.foreign.MemorySegment _deviceParams, int _rspDuoMode, double _sampleRate, int _tuner, int _bwType, int _ifType, int _tuner1AmPortSel) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoMode_t_DOWN$MH.invokeExact(symbol, _currDevice, _deviceParams, _rspDuoMode, _sampleRate, _tuner, _bwType, _ifType, _tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment 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 index 46c63a6e1..e6765eedb 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,88 +21,168 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int sampleNum; * unsigned int period; - * }; + * } * } */ public class sdrplay_api_SyncUpdateT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_SyncUpdateT.$struct$LAYOUT; + 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; } - static final VarHandle sampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("sampleNum")); - public static VarHandle sampleNum$VH() { - return sdrplay_api_SyncUpdateT.sampleNum$VH; + + 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 : - * unsigned int sampleNum; + * {@snippet lang=c : + * unsigned int sampleNum * } */ - public static int sampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg); + public static int sampleNum(MemorySegment struct) { + return struct.get(sampleNum$LAYOUT, sampleNum$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int sampleNum; + * {@snippet lang=c : + * unsigned int sampleNum * } */ - public static void sampleNum$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg, x); - } - public static int sampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg.asSlice(index*sizeof())); + public static void sampleNum(MemorySegment struct, int fieldValue) { + struct.set(sampleNum$LAYOUT, sampleNum$OFFSET, fieldValue); } - public static void sampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle period$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("period")); - public static VarHandle period$VH() { - return sdrplay_api_SyncUpdateT.period$VH; + + 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 : - * unsigned int period; + * {@snippet lang=c : + * unsigned int period * } */ - public static int period$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg); + public static int period(MemorySegment struct) { + return struct.get(period$LAYOUT, period$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int period; + * {@snippet lang=c : + * unsigned int period * } */ - public static void period$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg, x); + public static void period(MemorySegment struct, int fieldValue) { + struct.set(period$LAYOUT, period$OFFSET, fieldValue); } - public static int period$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void period$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index f01ce3fa3..e33730e8a 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +21,14 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_Bw_MHzT bwType; * sdrplay_api_If_kHzT ifType; @@ -33,144 +36,339 @@ * sdrplay_api_GainT gain; * sdrplay_api_RfFreqT rfFreq; * sdrplay_api_DcOffsetTunerT dcOffsetTuner; - * }; + * } * } */ public class sdrplay_api_TunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_TunerParamsT.$struct$LAYOUT; - } - static final VarHandle bwType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("bwType")); - public static VarHandle bwType$VH() { - return sdrplay_api_TunerParamsT.bwType$VH; + 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 : - * sdrplay_api_Bw_MHzT bwType; + * {@snippet lang=c : + * sdrplay_api_Bw_MHzT bwType * } */ - public static int bwType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg); + public static int bwType(MemorySegment struct) { + return struct.get(bwType$LAYOUT, bwType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Bw_MHzT bwType; + * {@snippet lang=c : + * sdrplay_api_Bw_MHzT bwType * } */ - public static void bwType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg, x); + public static void bwType(MemorySegment struct, int fieldValue) { + struct.set(bwType$LAYOUT, bwType$OFFSET, fieldValue); } - public static int bwType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void bwType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle ifType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ifType")); - public static VarHandle ifType$VH() { - return sdrplay_api_TunerParamsT.ifType$VH; + + /** + * 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 : - * sdrplay_api_If_kHzT ifType; + * {@snippet lang=c : + * sdrplay_api_LoModeT loMode * } */ - public static int ifType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg); + public static int loMode(MemorySegment struct) { + return struct.get(loMode$LAYOUT, loMode$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_If_kHzT ifType; + * {@snippet lang=c : + * sdrplay_api_LoModeT loMode * } */ - public static void ifType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg, x); + public static void loMode(MemorySegment struct, int fieldValue) { + struct.set(loMode$LAYOUT, loMode$OFFSET, fieldValue); } - public static int ifType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void ifType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle loMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("loMode")); - public static VarHandle loMode$VH() { - return sdrplay_api_TunerParamsT.loMode$VH; + + /** + * 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 : - * sdrplay_api_LoModeT loMode; + * {@snippet lang=c : + * sdrplay_api_RfFreqT rfFreq * } */ - public static int loMode$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg); + public static MemorySegment rfFreq(MemorySegment struct) { + return struct.asSlice(rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_LoModeT loMode; + * {@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 void loMode$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg, x); + public static final long dcOffsetTuner$offset() { + return dcOffsetTuner$OFFSET; } - public static int loMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg.asSlice(index*sizeof())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_DcOffsetTunerT dcOffsetTuner + * } + */ + public static MemorySegment dcOffsetTuner(MemorySegment struct) { + return struct.asSlice(dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); } - public static void loMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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()); } - public static MemorySegment gain$slice(MemorySegment seg) { - return seg.asSlice(12, 24); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static MemorySegment rfFreq$slice(MemorySegment seg) { - return seg.asSlice(40, 16); + + /** + * 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())); } - public static MemorySegment dcOffsetTuner$slice(MemorySegment seg) { - return seg.asSlice(56, 12); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index eb308331d..302b639a2 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,60 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_Uninit_t)(void* dev); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE) * } */ -public interface sdrplay_api_Uninit_t { +public class sdrplay_api_Uninit_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate); - static MemorySegment allocate(sdrplay_api_Uninit_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Uninit_t_UP$MH, fi, constants$5.sdrplay_api_Uninit_t$FUNC, scope); + sdrplay_api_Uninit_t() { + // Should not be called directly } - static sdrplay_api_Uninit_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate) -> { - try { - return (int)constants$5.sdrplay_api_Uninit_t_DOWN$MH.invokeExact(symbol, _currentSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment 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 index ef50298d0..bce38dadc 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,58 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_UnlockDeviceApi_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void) * } */ -public interface sdrplay_api_UnlockDeviceApi_t { +public class sdrplay_api_UnlockDeviceApi_t { - int apply(); - static MemorySegment allocate(sdrplay_api_UnlockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_UnlockDeviceApi_t_UP$MH, fi, constants$2.sdrplay_api_UnlockDeviceApi_t$FUNC, scope); + sdrplay_api_UnlockDeviceApi_t() { + // Should not be called directly } - static sdrplay_api_UnlockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_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 index 6c2f041a4..c3c4e3581 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_Update_t)(void* dev,enum tuner,enum reasonForUpdate,enum reasonForUpdateExt1); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE, sdrplay_api_TunerSelectT, sdrplay_api_ReasonForUpdateT, sdrplay_api_ReasonForUpdateExtension1T) * } */ -public interface sdrplay_api_Update_t { +public class sdrplay_api_Update_t { - int apply(java.lang.foreign.MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - static MemorySegment allocate(sdrplay_api_Update_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Update_t_UP$MH, fi, constants$5.sdrplay_api_Update_t$FUNC, scope); + sdrplay_api_Update_t() { + // Should not be called directly } - static sdrplay_api_Update_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _tuner, int _reasonForUpdate, int _reasonForUpdateExt1) -> { - try { - return (int)constants$5.sdrplay_api_Update_t_DOWN$MH.invokeExact(symbol, _dev, _tuner, _reasonForUpdate, _reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, int 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 index a5f87acad..dd6501a32 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,1656 +21,2695 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_07; +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.OfAddress; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -public class sdrplay_api_h { - - public static final OfByte C_CHAR = Constants$root.C_CHAR$LAYOUT; - public static final OfShort C_SHORT = Constants$root.C_SHORT$LAYOUT; - public static final OfInt C_INT = Constants$root.C_INT$LAYOUT; - public static final OfLong C_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfLong C_LONG_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfFloat C_FLOAT = Constants$root.C_FLOAT$LAYOUT; - public static final OfDouble C_DOUBLE = Constants$root.C_DOUBLE$LAYOUT; - public static final OfAddress C_POINTER = Constants$root.C_POINTER$LAYOUT; - /** - * {@snippet : +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) { + 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) + { + 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 (int)10L; + return RSPIA_NUM_LNA_STATES; } + private static final int RSPIA_NUM_LNA_STATES_AM = (int)7L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPIA_NUM_LNA_STATES_AM 7 * } */ public static int RSPIA_NUM_LNA_STATES_AM() { - return (int)7L; + return RSPIA_NUM_LNA_STATES_AM; } + private static final int RSPIA_NUM_LNA_STATES_LBAND = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPIA_NUM_LNA_STATES_LBAND 9 * } */ public static int RSPIA_NUM_LNA_STATES_LBAND() { - return (int)9L; + return RSPIA_NUM_LNA_STATES_LBAND; } + private static final int RSPII_NUM_LNA_STATES = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES 9 * } */ public static int RSPII_NUM_LNA_STATES() { - return (int)9L; + return RSPII_NUM_LNA_STATES; } + private static final int RSPII_NUM_LNA_STATES_AMPORT = (int)5L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES_AMPORT 5 * } */ public static int RSPII_NUM_LNA_STATES_AMPORT() { - return (int)5L; + return RSPII_NUM_LNA_STATES_AMPORT; } + private static final int RSPII_NUM_LNA_STATES_420MHZ = (int)6L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES_420MHZ 6 * } */ public static int RSPII_NUM_LNA_STATES_420MHZ() { - return (int)6L; + return RSPII_NUM_LNA_STATES_420MHZ; } + private static final int RSPDUO_NUM_LNA_STATES = (int)10L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES 10 * } */ public static int RSPDUO_NUM_LNA_STATES() { - return (int)10L; + return RSPDUO_NUM_LNA_STATES; } + private static final int RSPDUO_NUM_LNA_STATES_AMPORT = (int)5L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 * } */ public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return (int)5L; + return RSPDUO_NUM_LNA_STATES_AMPORT; } + private static final int RSPDUO_NUM_LNA_STATES_AM = (int)7L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_AM 7 * } */ public static int RSPDUO_NUM_LNA_STATES_AM() { - return (int)7L; + return RSPDUO_NUM_LNA_STATES_AM; } + private static final int RSPDUO_NUM_LNA_STATES_LBAND = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_LBAND 9 * } */ public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return (int)9L; + return RSPDUO_NUM_LNA_STATES_LBAND; } + private static final int RSPDX_NUM_LNA_STATES = (int)28L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES 28 * } */ public static int RSPDX_NUM_LNA_STATES() { - return (int)28L; + return RSPDX_NUM_LNA_STATES; } + private static final int RSPDX_NUM_LNA_STATES_AMPORT2_0_12 = (int)19L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 * } */ public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return (int)19L; + return RSPDX_NUM_LNA_STATES_AMPORT2_0_12; } + private static final int RSPDX_NUM_LNA_STATES_AMPORT2_12_60 = (int)20L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_60 20 * } */ public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_60() { - return (int)20L; + return RSPDX_NUM_LNA_STATES_AMPORT2_12_60; } + private static final int RSPDX_NUM_LNA_STATES_VHF_BAND3 = (int)27L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 * } */ public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return (int)27L; + return RSPDX_NUM_LNA_STATES_VHF_BAND3; } + private static final int RSPDX_NUM_LNA_STATES_420MHZ = (int)21L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_420MHZ 21 * } */ public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return (int)21L; + return RSPDX_NUM_LNA_STATES_420MHZ; } + private static final int RSPDX_NUM_LNA_STATES_LBAND = (int)19L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_LBAND 19 * } */ public static int RSPDX_NUM_LNA_STATES_LBAND() { - return (int)19L; + return RSPDX_NUM_LNA_STATES_LBAND; } + private static final int RSPDX_NUM_LNA_STATES_DX = (int)26L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_DX 26 * } */ public static int RSPDX_NUM_LNA_STATES_DX() { - return (int)26L; + return RSPDX_NUM_LNA_STATES_DX; } + private static final int sdrplay_api_Rsp2_ANTENNA_A = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_ANTENNA_A = 5 * } */ public static int sdrplay_api_Rsp2_ANTENNA_A() { - return (int)5L; + return sdrplay_api_Rsp2_ANTENNA_A; } + private static final int sdrplay_api_Rsp2_ANTENNA_B = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_ANTENNA_B = 6 * } */ public static int sdrplay_api_Rsp2_ANTENNA_B() { - return (int)6L; + return sdrplay_api_Rsp2_ANTENNA_B; } + private static final int sdrplay_api_Rsp2_AMPORT_1 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_AMPORT_1 = 1 * } */ public static int sdrplay_api_Rsp2_AMPORT_1() { - return (int)1L; + return sdrplay_api_Rsp2_AMPORT_1; } + private static final int sdrplay_api_Rsp2_AMPORT_2 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_AMPORT_2 = 0 * } */ public static int sdrplay_api_Rsp2_AMPORT_2() { - return (int)0L; + return sdrplay_api_Rsp2_AMPORT_2; } + private static final int sdrplay_api_RspDuoMode_Unknown = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Unknown = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Unknown = 0 * } */ public static int sdrplay_api_RspDuoMode_Unknown() { - return (int)0L; + return sdrplay_api_RspDuoMode_Unknown; } + private static final int sdrplay_api_RspDuoMode_Single_Tuner = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1 * } */ public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return (int)1L; + return sdrplay_api_RspDuoMode_Single_Tuner; } + private static final int sdrplay_api_RspDuoMode_Dual_Tuner = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2 * } */ public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return (int)2L; + return sdrplay_api_RspDuoMode_Dual_Tuner; } + private static final int sdrplay_api_RspDuoMode_Master = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Master = 4; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Master = 4 * } */ public static int sdrplay_api_RspDuoMode_Master() { - return (int)4L; + return sdrplay_api_RspDuoMode_Master; } + private static final int sdrplay_api_RspDuoMode_Slave = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Slave = 8; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Slave = 8 * } */ public static int sdrplay_api_RspDuoMode_Slave() { - return (int)8L; + return sdrplay_api_RspDuoMode_Slave; } + private static final int sdrplay_api_RspDuo_AMPORT_1 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuo_AMPORT_1 = 1 * } */ public static int sdrplay_api_RspDuo_AMPORT_1() { - return (int)1L; + return sdrplay_api_RspDuo_AMPORT_1; } + private static final int sdrplay_api_RspDuo_AMPORT_2 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuo_AMPORT_2 = 0 * } */ public static int sdrplay_api_RspDuo_AMPORT_2() { - return (int)0L; + return sdrplay_api_RspDuo_AMPORT_2; } + private static final int sdrplay_api_BW_Undefined = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_BW_Undefined = 0; + * {@snippet lang=c : + * enum .sdrplay_api_BW_Undefined = 0 * } */ public static int sdrplay_api_BW_Undefined() { - return (int)0L; + return sdrplay_api_BW_Undefined; } + private static final int sdrplay_api_BW_0_200 = (int)200L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_200 = 200; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_200 = 200 * } */ public static int sdrplay_api_BW_0_200() { - return (int)200L; + return sdrplay_api_BW_0_200; } + private static final int sdrplay_api_BW_0_300 = (int)300L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_300 = 300; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_300 = 300 * } */ public static int sdrplay_api_BW_0_300() { - return (int)300L; + return sdrplay_api_BW_0_300; } + private static final int sdrplay_api_BW_0_600 = (int)600L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_600 = 600; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_600 = 600 * } */ public static int sdrplay_api_BW_0_600() { - return (int)600L; + return sdrplay_api_BW_0_600; } + private static final int sdrplay_api_BW_1_536 = (int)1536L; /** - * {@snippet : - * enum .sdrplay_api_BW_1_536 = 1536; + * {@snippet lang=c : + * enum .sdrplay_api_BW_1_536 = 1536 * } */ public static int sdrplay_api_BW_1_536() { - return (int)1536L; + return sdrplay_api_BW_1_536; } + private static final int sdrplay_api_BW_5_000 = (int)5000L; /** - * {@snippet : - * enum .sdrplay_api_BW_5_000 = 5000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_5_000 = 5000 * } */ public static int sdrplay_api_BW_5_000() { - return (int)5000L; + return sdrplay_api_BW_5_000; } + private static final int sdrplay_api_BW_6_000 = (int)6000L; /** - * {@snippet : - * enum .sdrplay_api_BW_6_000 = 6000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_6_000 = 6000 * } */ public static int sdrplay_api_BW_6_000() { - return (int)6000L; + return sdrplay_api_BW_6_000; } + private static final int sdrplay_api_BW_7_000 = (int)7000L; /** - * {@snippet : - * enum .sdrplay_api_BW_7_000 = 7000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_7_000 = 7000 * } */ public static int sdrplay_api_BW_7_000() { - return (int)7000L; + return sdrplay_api_BW_7_000; } + private static final int sdrplay_api_BW_8_000 = (int)8000L; /** - * {@snippet : - * enum .sdrplay_api_BW_8_000 = 8000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_8_000 = 8000 * } */ public static int sdrplay_api_BW_8_000() { - return (int)8000L; + return sdrplay_api_BW_8_000; } + private static final int sdrplay_api_IF_Undefined = (int)-1L; /** - * {@snippet : - * enum .sdrplay_api_IF_Undefined = -1; + * {@snippet lang=c : + * enum .sdrplay_api_IF_Undefined = -1 * } */ public static int sdrplay_api_IF_Undefined() { - return (int)-1L; + return sdrplay_api_IF_Undefined; } + private static final int sdrplay_api_IF_Zero = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_IF_Zero = 0; + * {@snippet lang=c : + * enum .sdrplay_api_IF_Zero = 0 * } */ public static int sdrplay_api_IF_Zero() { - return (int)0L; + return sdrplay_api_IF_Zero; } + private static final int sdrplay_api_IF_0_450 = (int)450L; /** - * {@snippet : - * enum .sdrplay_api_IF_0_450 = 450; + * {@snippet lang=c : + * enum .sdrplay_api_IF_0_450 = 450 * } */ public static int sdrplay_api_IF_0_450() { - return (int)450L; + return sdrplay_api_IF_0_450; } + private static final int sdrplay_api_IF_1_620 = (int)1620L; /** - * {@snippet : - * enum .sdrplay_api_IF_1_620 = 1620; + * {@snippet lang=c : + * enum .sdrplay_api_IF_1_620 = 1620 * } */ public static int sdrplay_api_IF_1_620() { - return (int)1620L; + return sdrplay_api_IF_1_620; } + private static final int sdrplay_api_IF_2_048 = (int)2048L; /** - * {@snippet : - * enum .sdrplay_api_IF_2_048 = 2048; + * {@snippet lang=c : + * enum .sdrplay_api_IF_2_048 = 2048 * } */ public static int sdrplay_api_IF_2_048() { - return (int)2048L; + return sdrplay_api_IF_2_048; } + private static final int sdrplay_api_LO_Undefined = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_LO_Undefined = 0; + * {@snippet lang=c : + * enum .sdrplay_api_LO_Undefined = 0 * } */ public static int sdrplay_api_LO_Undefined() { - return (int)0L; + return sdrplay_api_LO_Undefined; } + private static final int sdrplay_api_LO_Auto = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_LO_Auto = 1; + * {@snippet lang=c : + * enum .sdrplay_api_LO_Auto = 1 * } */ public static int sdrplay_api_LO_Auto() { - return (int)1L; + return sdrplay_api_LO_Auto; } + private static final int sdrplay_api_LO_120MHz = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_LO_120MHz = 2; + * {@snippet lang=c : + * enum .sdrplay_api_LO_120MHz = 2 * } */ public static int sdrplay_api_LO_120MHz() { - return (int)2L; + return sdrplay_api_LO_120MHz; } + private static final int sdrplay_api_LO_144MHz = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_LO_144MHz = 3; + * {@snippet lang=c : + * enum .sdrplay_api_LO_144MHz = 3 * } */ public static int sdrplay_api_LO_144MHz() { - return (int)3L; + return sdrplay_api_LO_144MHz; } + private static final int sdrplay_api_LO_168MHz = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_LO_168MHz = 4; + * {@snippet lang=c : + * enum .sdrplay_api_LO_168MHz = 4 * } */ public static int sdrplay_api_LO_168MHz() { - return (int)4L; + return sdrplay_api_LO_168MHz; } + private static final int sdrplay_api_EXTENDED_MIN_GR = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0; + * {@snippet lang=c : + * enum .sdrplay_api_EXTENDED_MIN_GR = 0 * } */ public static int sdrplay_api_EXTENDED_MIN_GR() { - return (int)0L; + return sdrplay_api_EXTENDED_MIN_GR; } + private static final int sdrplay_api_NORMAL_MIN_GR = (int)20L; /** - * {@snippet : - * enum .sdrplay_api_NORMAL_MIN_GR = 20; + * {@snippet lang=c : + * enum .sdrplay_api_NORMAL_MIN_GR = 20 * } */ public static int sdrplay_api_NORMAL_MIN_GR() { - return (int)20L; + return sdrplay_api_NORMAL_MIN_GR; } + private static final int sdrplay_api_Tuner_Neither = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_Neither = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_Neither = 0 * } */ public static int sdrplay_api_Tuner_Neither() { - return (int)0L; + return sdrplay_api_Tuner_Neither; } + private static final int sdrplay_api_Tuner_A = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_A = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_A = 1 * } */ public static int sdrplay_api_Tuner_A() { - return (int)1L; + return sdrplay_api_Tuner_A; } + private static final int sdrplay_api_Tuner_B = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_B = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_B = 2 * } */ public static int sdrplay_api_Tuner_B() { - return (int)2L; + return sdrplay_api_Tuner_B; } + private static final int sdrplay_api_Tuner_Both = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_Both = 3; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_Both = 3 * } */ public static int sdrplay_api_Tuner_Both() { - return (int)3L; + return sdrplay_api_Tuner_Both; } + private static final int sdrplay_api_RspDx_ANTENNA_A = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_A = 0 * } */ public static int sdrplay_api_RspDx_ANTENNA_A() { - return (int)0L; + return sdrplay_api_RspDx_ANTENNA_A; } + private static final int sdrplay_api_RspDx_ANTENNA_B = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_B = 1 * } */ public static int sdrplay_api_RspDx_ANTENNA_B() { - return (int)1L; + return sdrplay_api_RspDx_ANTENNA_B; } + private static final int sdrplay_api_RspDx_ANTENNA_C = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_C = 2 * } */ public static int sdrplay_api_RspDx_ANTENNA_C() { - return (int)2L; + return sdrplay_api_RspDx_ANTENNA_C; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_0_200 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return (int)0L; + return sdrplay_api_RspDx_HDRMODE_BW_0_200; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_0_500 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return (int)1L; + return sdrplay_api_RspDx_HDRMODE_BW_0_500; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_1_200 = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return (int)2L; + return sdrplay_api_RspDx_HDRMODE_BW_1_200; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_1_700 = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return (int)3L; + return sdrplay_api_RspDx_HDRMODE_BW_1_700; } + private static final int sdrplay_api_ISOCH = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_ISOCH = 0; + * {@snippet lang=c : + * enum .sdrplay_api_ISOCH = 0 * } */ public static int sdrplay_api_ISOCH() { - return (int)0L; + return sdrplay_api_ISOCH; } + private static final int sdrplay_api_BULK = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_BULK = 1; + * {@snippet lang=c : + * enum .sdrplay_api_BULK = 1 * } */ public static int sdrplay_api_BULK() { - return (int)1L; + return sdrplay_api_BULK; } + private static final int sdrplay_api_AGC_DISABLE = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_AGC_DISABLE = 0; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_DISABLE = 0 * } */ public static int sdrplay_api_AGC_DISABLE() { - return (int)0L; + return sdrplay_api_AGC_DISABLE; } + private static final int sdrplay_api_AGC_100HZ = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_AGC_100HZ = 1; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_100HZ = 1 * } */ public static int sdrplay_api_AGC_100HZ() { - return (int)1L; + return sdrplay_api_AGC_100HZ; } + private static final int sdrplay_api_AGC_50HZ = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_AGC_50HZ = 2; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_50HZ = 2 * } */ public static int sdrplay_api_AGC_50HZ() { - return (int)2L; + return sdrplay_api_AGC_50HZ; } + private static final int sdrplay_api_AGC_5HZ = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_AGC_5HZ = 3; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_5HZ = 3 * } */ public static int sdrplay_api_AGC_5HZ() { - return (int)3L; + return sdrplay_api_AGC_5HZ; } + private static final int sdrplay_api_AGC_CTRL_EN = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_AGC_CTRL_EN = 4; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_CTRL_EN = 4 * } */ public static int sdrplay_api_AGC_CTRL_EN() { - return (int)4L; + return sdrplay_api_AGC_CTRL_EN; } + private static final int sdrplay_api_ADSB_DECIMATION = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_DECIMATION = 0; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_DECIMATION = 0 * } */ public static int sdrplay_api_ADSB_DECIMATION() { - return (int)0L; + return sdrplay_api_ADSB_DECIMATION; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return (int)1L; + return sdrplay_api_ADSB_NO_DECIMATION_LOWPASS; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return (int)2L; + return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return (int)3L; + return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ; } + private static final int sdrplay_api_Overload_Detected = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Overload_Detected = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Overload_Detected = 0 * } */ public static int sdrplay_api_Overload_Detected() { - return (int)0L; + return sdrplay_api_Overload_Detected; } + private static final int sdrplay_api_Overload_Corrected = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Overload_Corrected = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Overload_Corrected = 1 * } */ public static int sdrplay_api_Overload_Corrected() { - return (int)1L; + return sdrplay_api_Overload_Corrected; } + private static final int sdrplay_api_MasterInitialised = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_MasterInitialised = 0; + * {@snippet lang=c : + * enum .sdrplay_api_MasterInitialised = 0 * } */ public static int sdrplay_api_MasterInitialised() { - return (int)0L; + return sdrplay_api_MasterInitialised; } + private static final int sdrplay_api_SlaveAttached = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_SlaveAttached = 1; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveAttached = 1 * } */ public static int sdrplay_api_SlaveAttached() { - return (int)1L; + return sdrplay_api_SlaveAttached; } + private static final int sdrplay_api_SlaveDetached = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_SlaveDetached = 2; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveDetached = 2 * } */ public static int sdrplay_api_SlaveDetached() { - return (int)2L; + return sdrplay_api_SlaveDetached; } + private static final int sdrplay_api_SlaveInitialised = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_SlaveInitialised = 3; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveInitialised = 3 * } */ public static int sdrplay_api_SlaveInitialised() { - return (int)3L; + return sdrplay_api_SlaveInitialised; } + private static final int sdrplay_api_SlaveUninitialised = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_SlaveUninitialised = 4; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveUninitialised = 4 * } */ public static int sdrplay_api_SlaveUninitialised() { - return (int)4L; + return sdrplay_api_SlaveUninitialised; } + private static final int sdrplay_api_MasterDllDisappeared = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_MasterDllDisappeared = 5; + * {@snippet lang=c : + * enum .sdrplay_api_MasterDllDisappeared = 5 * } */ public static int sdrplay_api_MasterDllDisappeared() { - return (int)5L; + return sdrplay_api_MasterDllDisappeared; } + private static final int sdrplay_api_SlaveDllDisappeared = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_SlaveDllDisappeared = 6; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveDllDisappeared = 6 * } */ public static int sdrplay_api_SlaveDllDisappeared() { - return (int)6L; + return sdrplay_api_SlaveDllDisappeared; } + private static final int sdrplay_api_GainChange = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_GainChange = 0; + * {@snippet lang=c : + * enum .sdrplay_api_GainChange = 0 * } */ public static int sdrplay_api_GainChange() { - return (int)0L; + return sdrplay_api_GainChange; } + private static final int sdrplay_api_PowerOverloadChange = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_PowerOverloadChange = 1; + * {@snippet lang=c : + * enum .sdrplay_api_PowerOverloadChange = 1 * } */ public static int sdrplay_api_PowerOverloadChange() { - return (int)1L; + return sdrplay_api_PowerOverloadChange; } + private static final int sdrplay_api_DeviceRemoved = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_DeviceRemoved = 2; + * {@snippet lang=c : + * enum .sdrplay_api_DeviceRemoved = 2 * } */ public static int sdrplay_api_DeviceRemoved() { - return (int)2L; + return sdrplay_api_DeviceRemoved; } + private static final int sdrplay_api_RspDuoModeChange = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoModeChange = 3; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoModeChange = 3 * } */ public static int sdrplay_api_RspDuoModeChange() { - return (int)3L; + return sdrplay_api_RspDuoModeChange; } /** - * {@snippet : - * typedef void* HANDLE; + * {@snippet lang=c : + * typedef void *HANDLE * } */ - public static final OfAddress HANDLE = Constants$root.C_POINTER$LAYOUT; + public static final AddressLayout HANDLE = sdrplay_api_h.C_POINTER; + private static final int sdrplay_api_Success = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Success = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Success = 0 * } */ public static int sdrplay_api_Success() { - return (int)0L; + return sdrplay_api_Success; } + private static final int sdrplay_api_Fail = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Fail = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Fail = 1 * } */ public static int sdrplay_api_Fail() { - return (int)1L; + return sdrplay_api_Fail; } + private static final int sdrplay_api_InvalidParam = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_InvalidParam = 2; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidParam = 2 * } */ public static int sdrplay_api_InvalidParam() { - return (int)2L; + return sdrplay_api_InvalidParam; } + private static final int sdrplay_api_OutOfRange = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_OutOfRange = 3; + * {@snippet lang=c : + * enum .sdrplay_api_OutOfRange = 3 * } */ public static int sdrplay_api_OutOfRange() { - return (int)3L; + return sdrplay_api_OutOfRange; } + private static final int sdrplay_api_GainUpdateError = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_GainUpdateError = 4; + * {@snippet lang=c : + * enum .sdrplay_api_GainUpdateError = 4 * } */ public static int sdrplay_api_GainUpdateError() { - return (int)4L; + return sdrplay_api_GainUpdateError; } + private static final int sdrplay_api_RfUpdateError = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_RfUpdateError = 5; + * {@snippet lang=c : + * enum .sdrplay_api_RfUpdateError = 5 * } */ public static int sdrplay_api_RfUpdateError() { - return (int)5L; + return sdrplay_api_RfUpdateError; } + private static final int sdrplay_api_FsUpdateError = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_FsUpdateError = 6; + * {@snippet lang=c : + * enum .sdrplay_api_FsUpdateError = 6 * } */ public static int sdrplay_api_FsUpdateError() { - return (int)6L; + return sdrplay_api_FsUpdateError; } + private static final int sdrplay_api_HwError = (int)7L; /** - * {@snippet : - * enum .sdrplay_api_HwError = 7; + * {@snippet lang=c : + * enum .sdrplay_api_HwError = 7 * } */ public static int sdrplay_api_HwError() { - return (int)7L; + return sdrplay_api_HwError; } + private static final int sdrplay_api_AliasingError = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_AliasingError = 8; + * {@snippet lang=c : + * enum .sdrplay_api_AliasingError = 8 * } */ public static int sdrplay_api_AliasingError() { - return (int)8L; + return sdrplay_api_AliasingError; } + private static final int sdrplay_api_AlreadyInitialised = (int)9L; /** - * {@snippet : - * enum .sdrplay_api_AlreadyInitialised = 9; + * {@snippet lang=c : + * enum .sdrplay_api_AlreadyInitialised = 9 * } */ public static int sdrplay_api_AlreadyInitialised() { - return (int)9L; + return sdrplay_api_AlreadyInitialised; } + private static final int sdrplay_api_NotInitialised = (int)10L; /** - * {@snippet : - * enum .sdrplay_api_NotInitialised = 10; + * {@snippet lang=c : + * enum .sdrplay_api_NotInitialised = 10 * } */ public static int sdrplay_api_NotInitialised() { - return (int)10L; + return sdrplay_api_NotInitialised; } + private static final int sdrplay_api_NotEnabled = (int)11L; /** - * {@snippet : - * enum .sdrplay_api_NotEnabled = 11; + * {@snippet lang=c : + * enum .sdrplay_api_NotEnabled = 11 * } */ public static int sdrplay_api_NotEnabled() { - return (int)11L; + return sdrplay_api_NotEnabled; } + private static final int sdrplay_api_HwVerError = (int)12L; /** - * {@snippet : - * enum .sdrplay_api_HwVerError = 12; + * {@snippet lang=c : + * enum .sdrplay_api_HwVerError = 12 * } */ public static int sdrplay_api_HwVerError() { - return (int)12L; + return sdrplay_api_HwVerError; } + private static final int sdrplay_api_OutOfMemError = (int)13L; /** - * {@snippet : - * enum .sdrplay_api_OutOfMemError = 13; + * {@snippet lang=c : + * enum .sdrplay_api_OutOfMemError = 13 * } */ public static int sdrplay_api_OutOfMemError() { - return (int)13L; + return sdrplay_api_OutOfMemError; } + private static final int sdrplay_api_ServiceNotResponding = (int)14L; /** - * {@snippet : - * enum .sdrplay_api_ServiceNotResponding = 14; + * {@snippet lang=c : + * enum .sdrplay_api_ServiceNotResponding = 14 * } */ public static int sdrplay_api_ServiceNotResponding() { - return (int)14L; + return sdrplay_api_ServiceNotResponding; } + private static final int sdrplay_api_StartPending = (int)15L; /** - * {@snippet : - * enum .sdrplay_api_StartPending = 15; + * {@snippet lang=c : + * enum .sdrplay_api_StartPending = 15 * } */ public static int sdrplay_api_StartPending() { - return (int)15L; + return sdrplay_api_StartPending; } + private static final int sdrplay_api_StopPending = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_StopPending = 16; + * {@snippet lang=c : + * enum .sdrplay_api_StopPending = 16 * } */ public static int sdrplay_api_StopPending() { - return (int)16L; + return sdrplay_api_StopPending; } + private static final int sdrplay_api_InvalidMode = (int)17L; /** - * {@snippet : - * enum .sdrplay_api_InvalidMode = 17; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidMode = 17 * } */ public static int sdrplay_api_InvalidMode() { - return (int)17L; + return sdrplay_api_InvalidMode; } + private static final int sdrplay_api_FailedVerification1 = (int)18L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification1 = 18; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification1 = 18 * } */ public static int sdrplay_api_FailedVerification1() { - return (int)18L; + return sdrplay_api_FailedVerification1; } + private static final int sdrplay_api_FailedVerification2 = (int)19L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification2 = 19; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification2 = 19 * } */ public static int sdrplay_api_FailedVerification2() { - return (int)19L; + return sdrplay_api_FailedVerification2; } + private static final int sdrplay_api_FailedVerification3 = (int)20L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification3 = 20; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification3 = 20 * } */ public static int sdrplay_api_FailedVerification3() { - return (int)20L; + return sdrplay_api_FailedVerification3; } + private static final int sdrplay_api_FailedVerification4 = (int)21L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification4 = 21; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification4 = 21 * } */ public static int sdrplay_api_FailedVerification4() { - return (int)21L; + return sdrplay_api_FailedVerification4; } + private static final int sdrplay_api_FailedVerification5 = (int)22L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification5 = 22; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification5 = 22 * } */ public static int sdrplay_api_FailedVerification5() { - return (int)22L; + return sdrplay_api_FailedVerification5; } + private static final int sdrplay_api_FailedVerification6 = (int)23L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification6 = 23; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification6 = 23 * } */ public static int sdrplay_api_FailedVerification6() { - return (int)23L; + return sdrplay_api_FailedVerification6; } + private static final int sdrplay_api_InvalidServiceVersion = (int)24L; /** - * {@snippet : - * enum .sdrplay_api_InvalidServiceVersion = 24; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidServiceVersion = 24 * } */ public static int sdrplay_api_InvalidServiceVersion() { - return (int)24L; + return sdrplay_api_InvalidServiceVersion; } + private static final int sdrplay_api_Update_None = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Update_None = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Update_None = 0 * } */ public static int sdrplay_api_Update_None() { - return (int)0L; + return sdrplay_api_Update_None; } + private static final int sdrplay_api_Update_Dev_Fs = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Fs = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_Fs = 1 * } */ public static int sdrplay_api_Update_Dev_Fs() { - return (int)1L; + return sdrplay_api_Update_Dev_Fs; } + private static final int sdrplay_api_Update_Dev_Ppm = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Ppm = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_Ppm = 2 * } */ public static int sdrplay_api_Update_Dev_Ppm() { - return (int)2L; + return sdrplay_api_Update_Dev_Ppm; } + private static final int sdrplay_api_Update_Dev_SyncUpdate = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_SyncUpdate = 4 * } */ public static int sdrplay_api_Update_Dev_SyncUpdate() { - return (int)4L; + return sdrplay_api_Update_Dev_SyncUpdate; } + private static final int sdrplay_api_Update_Dev_ResetFlags = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_ResetFlags = 8 * } */ public static int sdrplay_api_Update_Dev_ResetFlags() { - return (int)8L; + return sdrplay_api_Update_Dev_ResetFlags; } + private static final int sdrplay_api_Update_Rsp1a_BiasTControl = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16 * } */ public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return (int)16L; + return sdrplay_api_Update_Rsp1a_BiasTControl; } + private static final int sdrplay_api_Update_Rsp1a_RfNotchControl = (int)32L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32 * } */ public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return (int)32L; + return sdrplay_api_Update_Rsp1a_RfNotchControl; } + private static final int sdrplay_api_Update_Rsp1a_RfDabNotchControl = (int)64L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64 * } */ public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return (int)64L; + return sdrplay_api_Update_Rsp1a_RfDabNotchControl; } + private static final int sdrplay_api_Update_Rsp2_BiasTControl = (int)128L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128 * } */ public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return (int)128L; + return sdrplay_api_Update_Rsp2_BiasTControl; } + private static final int sdrplay_api_Update_Rsp2_AmPortSelect = (int)256L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256 * } */ public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return (int)256L; + return sdrplay_api_Update_Rsp2_AmPortSelect; } + private static final int sdrplay_api_Update_Rsp2_AntennaControl = (int)512L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512 * } */ public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return (int)512L; + return sdrplay_api_Update_Rsp2_AntennaControl; } + private static final int sdrplay_api_Update_Rsp2_RfNotchControl = (int)1024L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024 * } */ public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return (int)1024L; + return sdrplay_api_Update_Rsp2_RfNotchControl; } + private static final int sdrplay_api_Update_Rsp2_ExtRefControl = (int)2048L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048 * } */ public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return (int)2048L; + return sdrplay_api_Update_Rsp2_ExtRefControl; } + private static final int sdrplay_api_Update_RspDuo_ExtRefControl = (int)4096L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096 * } */ public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return (int)4096L; + return sdrplay_api_Update_RspDuo_ExtRefControl; } + private static final int sdrplay_api_Update_Master_Spare_1 = (int)8192L; /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Master_Spare_1 = 8192 * } */ public static int sdrplay_api_Update_Master_Spare_1() { - return (int)8192L; + return sdrplay_api_Update_Master_Spare_1; } + private static final int sdrplay_api_Update_Master_Spare_2 = (int)16384L; /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Master_Spare_2 = 16384 * } */ public static int sdrplay_api_Update_Master_Spare_2() { - return (int)16384L; + return sdrplay_api_Update_Master_Spare_2; } + private static final int sdrplay_api_Update_Tuner_Gr = (int)32768L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Gr = 32768; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_Gr = 32768 * } */ public static int sdrplay_api_Update_Tuner_Gr() { - return (int)32768L; + return sdrplay_api_Update_Tuner_Gr; } + private static final int sdrplay_api_Update_Tuner_GrLimits = (int)65536L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_GrLimits = 65536 * } */ public static int sdrplay_api_Update_Tuner_GrLimits() { - return (int)65536L; + return sdrplay_api_Update_Tuner_GrLimits; } + private static final int sdrplay_api_Update_Tuner_Frf = (int)131072L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Frf = 131072; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_Frf = 131072 * } */ public static int sdrplay_api_Update_Tuner_Frf() { - return (int)131072L; + return sdrplay_api_Update_Tuner_Frf; } + private static final int sdrplay_api_Update_Tuner_BwType = (int)262144L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_BwType = 262144; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_BwType = 262144 * } */ public static int sdrplay_api_Update_Tuner_BwType() { - return (int)262144L; + return sdrplay_api_Update_Tuner_BwType; } + private static final int sdrplay_api_Update_Tuner_IfType = (int)524288L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_IfType = 524288; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_IfType = 524288 * } */ public static int sdrplay_api_Update_Tuner_IfType() { - return (int)524288L; + return sdrplay_api_Update_Tuner_IfType; } + private static final int sdrplay_api_Update_Tuner_DcOffset = (int)1048576L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576 * } */ public static int sdrplay_api_Update_Tuner_DcOffset() { - return (int)1048576L; + return sdrplay_api_Update_Tuner_DcOffset; } + private static final int sdrplay_api_Update_Tuner_LoMode = (int)2097152L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_LoMode = 2097152 * } */ public static int sdrplay_api_Update_Tuner_LoMode() { - return (int)2097152L; + return sdrplay_api_Update_Tuner_LoMode; } + private static final int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = (int)4194304L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304 * } */ public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return (int)4194304L; + return sdrplay_api_Update_Ctrl_DCoffsetIQimbalance; } + private static final int sdrplay_api_Update_Ctrl_Decimation = (int)8388608L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608 * } */ public static int sdrplay_api_Update_Ctrl_Decimation() { - return (int)8388608L; + return sdrplay_api_Update_Ctrl_Decimation; } + private static final int sdrplay_api_Update_Ctrl_Agc = (int)16777216L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_Agc = 16777216 * } */ public static int sdrplay_api_Update_Ctrl_Agc() { - return (int)16777216L; + return sdrplay_api_Update_Ctrl_Agc; } + private static final int sdrplay_api_Update_Ctrl_AdsbMode = (int)33554432L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432 * } */ public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return (int)33554432L; + return sdrplay_api_Update_Ctrl_AdsbMode; } + private static final int sdrplay_api_Update_Ctrl_OverloadMsgAck = (int)67108864L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864 * } */ public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return (int)67108864L; + return sdrplay_api_Update_Ctrl_OverloadMsgAck; } + private static final int sdrplay_api_Update_RspDuo_BiasTControl = (int)134217728L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728 * } */ public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return (int)134217728L; + return sdrplay_api_Update_RspDuo_BiasTControl; } + private static final int sdrplay_api_Update_RspDuo_AmPortSelect = (int)268435456L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456 * } */ public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return (int)268435456L; + return sdrplay_api_Update_RspDuo_AmPortSelect; } + private static final int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = (int)536870912L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912 * } */ public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return (int)536870912L; + return sdrplay_api_Update_RspDuo_Tuner1AmNotchControl; } + private static final int sdrplay_api_Update_RspDuo_RfNotchControl = (int)1073741824L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824 * } */ public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return (int)1073741824L; + return sdrplay_api_Update_RspDuo_RfNotchControl; } + private static final int sdrplay_api_Update_RspDuo_RfDabNotchControl = (int)-2147483648L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648 * } */ public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return (int)-2147483648L; + return sdrplay_api_Update_RspDuo_RfDabNotchControl; } + private static final int sdrplay_api_Update_Ext1_None = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ext1_None = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ext1_None = 0 * } */ public static int sdrplay_api_Update_Ext1_None() { - return (int)0L; + return sdrplay_api_Update_Ext1_None; } + private static final int sdrplay_api_Update_RspDx_HdrEnable = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_HdrEnable = 1 * } */ public static int sdrplay_api_Update_RspDx_HdrEnable() { - return (int)1L; + return sdrplay_api_Update_RspDx_HdrEnable; } + private static final int sdrplay_api_Update_RspDx_BiasTControl = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_BiasTControl = 2 * } */ public static int sdrplay_api_Update_RspDx_BiasTControl() { - return (int)2L; + return sdrplay_api_Update_RspDx_BiasTControl; } + private static final int sdrplay_api_Update_RspDx_AntennaControl = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_AntennaControl = 4 * } */ public static int sdrplay_api_Update_RspDx_AntennaControl() { - return (int)4L; + return sdrplay_api_Update_RspDx_AntennaControl; } + private static final int sdrplay_api_Update_RspDx_RfNotchControl = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8 * } */ public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return (int)8L; + return sdrplay_api_Update_RspDx_RfNotchControl; } + private static final int sdrplay_api_Update_RspDx_RfDabNotchControl = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16 * } */ public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return (int)16L; + return sdrplay_api_Update_RspDx_RfDabNotchControl; } + private static final int sdrplay_api_Update_RspDx_HdrBw = (int)32L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_HdrBw = 32 * } */ public static int sdrplay_api_Update_RspDx_HdrBw() { - return (int)32L; + return sdrplay_api_Update_RspDx_HdrBw; } + private static final int sdrplay_api_DbgLvl_Disable = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Disable = 0; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Disable = 0 * } */ public static int sdrplay_api_DbgLvl_Disable() { - return (int)0L; + return sdrplay_api_DbgLvl_Disable; } + private static final int sdrplay_api_DbgLvl_Verbose = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Verbose = 1; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Verbose = 1 * } */ public static int sdrplay_api_DbgLvl_Verbose() { - return (int)1L; + return sdrplay_api_DbgLvl_Verbose; } + private static final int sdrplay_api_DbgLvl_Warning = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Warning = 2; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Warning = 2 * } */ public static int sdrplay_api_DbgLvl_Warning() { - return (int)2L; + return sdrplay_api_DbgLvl_Warning; } + private static final int sdrplay_api_DbgLvl_Error = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Error = 3; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Error = 3 * } */ public static int sdrplay_api_DbgLvl_Error() { - return (int)3L; + return sdrplay_api_DbgLvl_Error; } + private static final int sdrplay_api_DbgLvl_Message = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Message = 4; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Message = 4 * } */ public static int sdrplay_api_DbgLvl_Message() { - return (int)4L; + 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; } - public static MethodHandle sdrplay_api_Open$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_Open$MH,"sdrplay_api_Open"); + + /** + * Address for: + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_Open() + * } + */ + public static MemorySegment sdrplay_api_Open$address() { + return sdrplay_api_Open.ADDR; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_Open(); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_Open() * } */ public static int sdrplay_api_Open() { - var mh$ = sdrplay_api_Open$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_Close$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_Close$MH,"sdrplay_api_Close"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_Close(); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_Close() * } */ public static int sdrplay_api_Close() { - var mh$ = sdrplay_api_Close$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_ApiVersion$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_ApiVersion$MH,"sdrplay_api_ApiVersion"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float* apiVer); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_ApiVersion(float *apiVer) * } */ public static int sdrplay_api_ApiVersion(MemorySegment apiVer) { - var mh$ = sdrplay_api_ApiVersion$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_LockDeviceApi$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_LockDeviceApi$MH,"sdrplay_api_LockDeviceApi"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi(); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_LockDeviceApi() * } */ public static int sdrplay_api_LockDeviceApi() { - var mh$ = sdrplay_api_LockDeviceApi$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_UnlockDeviceApi$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_UnlockDeviceApi$MH,"sdrplay_api_UnlockDeviceApi"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi() * } */ public static int sdrplay_api_UnlockDeviceApi() { - var mh$ = sdrplay_api_UnlockDeviceApi$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_GetDevices$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_GetDevices$MH,"sdrplay_api_GetDevices"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_GetDevices(sdrplay_api_DeviceT* devices, unsigned int* numDevs, unsigned int maxDevs); + * {@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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_SelectDevice$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_SelectDevice$MH,"sdrplay_api_SelectDevice"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT* device); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_ReleaseDevice$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_ReleaseDevice$MH,"sdrplay_api_ReleaseDevice"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT* device); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_GetErrorString$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_GetErrorString$MH,"sdrplay_api_GetErrorString"); + + 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; } + /** - * {@snippet : - * char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err); + * 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$MH(); + var mh$ = sdrplay_api_GetErrorString.HANDLE; try { - return (java.lang.foreign.MemorySegment)mh$.invokeExact(err); + if (TRACE_DOWNCALLS) { + traceDowncall("sdrplay_api_GetErrorString", err); + } + return (MemorySegment)mh$.invokeExact(err); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_GetLastError$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_GetLastError$MH,"sdrplay_api_GetLastError"); + + 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 : - * sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT* device); + * {@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$MH(); + var mh$ = sdrplay_api_GetLastError.HANDLE; try { - return (java.lang.foreign.MemorySegment)mh$.invokeExact(device); + if (TRACE_DOWNCALLS) { + traceDowncall("sdrplay_api_GetLastError", device); + } + return (MemorySegment)mh$.invokeExact(device); } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_DisableHeartbeat$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_DisableHeartbeat$MH,"sdrplay_api_DisableHeartbeat"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat() * } */ public static int sdrplay_api_DisableHeartbeat() { - var mh$ = sdrplay_api_DisableHeartbeat$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_DebugEnable$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_DebugEnable$MH,"sdrplay_api_DebugEnable"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_DebugEnable(HANDLE dev, sdrplay_api_DbgLvl_t enable); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_GetDeviceParams$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_GetDeviceParams$MH,"sdrplay_api_GetDeviceParams"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_GetDeviceParams(HANDLE dev, sdrplay_api_DeviceParamsT** deviceParams); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_Init$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_Init$MH,"sdrplay_api_Init"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_Init(HANDLE dev, sdrplay_api_CallbackFnsT* callbackFns, void* cbContext); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_Uninit$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_Uninit$MH,"sdrplay_api_Uninit"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev); + * {@snippet lang=c : + * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev) * } */ public static int sdrplay_api_Uninit(MemorySegment dev) { - var mh$ = sdrplay_api_Uninit$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_Update$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_Update$MH,"sdrplay_api_Update"); + + 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 : - * sdrplay_api_ErrT sdrplay_api_Update(HANDLE dev, sdrplay_api_TunerSelectT tuner, sdrplay_api_ReasonForUpdateT reasonForUpdate, sdrplay_api_ReasonForUpdateExtension1T reasonForUpdateExt1); + * {@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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_SwapRspDuoActiveTuner$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_SwapRspDuoActiveTuner$MH,"sdrplay_api_SwapRspDuoActiveTuner"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoActiveTuner(HANDLE dev, sdrplay_api_TunerSelectT* currentTuner, sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH,"sdrplay_api_SwapRspDuoDualTunerModeSampleRate"); + + 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; } + /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_SwapRspDuoDualTunerModeSampleRate(HANDLE dev, double* currentSampleRate); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } - public static MethodHandle sdrplay_api_SwapRspDuoMode$MH() { - return RuntimeHelper.requireNonNull(constants$10.sdrplay_api_SwapRspDuoMode$MH,"sdrplay_api_SwapRspDuoMode"); + + 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; } + /** - * {@snippet : - * 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); + * 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$MH(); + 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$); + throw new AssertionError("should not reach here", ex$); } } + private static final int MAX_BB_GR = (int)59L; /** - * {@snippet : + * {@snippet lang=c : * #define MAX_BB_GR 59 * } */ public static int MAX_BB_GR() { - return (int)59L; + return MAX_BB_GR; } + private static final float SDRPLAY_API_VERSION = 3.069999933242798f; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_API_VERSION 3.069999933242798 * } */ public static float SDRPLAY_API_VERSION() { - return 3.069999933242798f; + return SDRPLAY_API_VERSION; } + private static final int SDRPLAY_MAX_DEVICES = (int)16L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_DEVICES 16 * } */ public static int SDRPLAY_MAX_DEVICES() { - return (int)16L; + return SDRPLAY_MAX_DEVICES; } + private static final int SDRPLAY_MAX_TUNERS_PER_DEVICE = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 * } */ public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return (int)2L; + return SDRPLAY_MAX_TUNERS_PER_DEVICE; } + private static final int SDRPLAY_MAX_SER_NO_LEN = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_SER_NO_LEN 64 * } */ public static int SDRPLAY_MAX_SER_NO_LEN() { - return (int)64L; + return SDRPLAY_MAX_SER_NO_LEN; } + private static final int SDRPLAY_MAX_ROOT_NM_LEN = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_ROOT_NM_LEN 32 * } */ public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return (int)32L; + return SDRPLAY_MAX_ROOT_NM_LEN; } + private static final int SDRPLAY_RSP1_ID = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP1_ID 1 * } */ public static int SDRPLAY_RSP1_ID() { - return (int)1L; + return SDRPLAY_RSP1_ID; } + private static final int SDRPLAY_RSP1A_ID = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP1A_ID 255 * } */ public static int SDRPLAY_RSP1A_ID() { - return (int)255L; + return SDRPLAY_RSP1A_ID; } + private static final int SDRPLAY_RSP2_ID = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP2_ID 2 * } */ public static int SDRPLAY_RSP2_ID() { - return (int)2L; + return SDRPLAY_RSP2_ID; } + private static final int SDRPLAY_RSPduo_ID = (int)3L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSPduo_ID 3 * } */ public static int SDRPLAY_RSPduo_ID() { - return (int)3L; + return SDRPLAY_RSPduo_ID; } + private static final int SDRPLAY_RSPdx_ID = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSPdx_ID 4 * } */ public static int SDRPLAY_RSPdx_ID() { - return (int)4L; + return SDRPLAY_RSPdx_ID; } } - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/Constants$root.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/Constants$root.java deleted file mode 100644 index b0f33aa21..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/Constants$root.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_BOOLEAN; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_FLOAT; -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -import static java.lang.foreign.ValueLayout.JAVA_SHORT; -import static java.lang.foreign.ValueLayout.OfAddress; -import static java.lang.foreign.ValueLayout.OfBoolean; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -final class Constants$root { - - // Suppresses default constructor, ensuring non-instantiability. - private Constants$root() {} - static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; - static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; - static final OfShort C_SHORT$LAYOUT = JAVA_SHORT; - static final OfInt C_INT$LAYOUT = JAVA_INT; - static final OfLong C_LONG$LAYOUT = JAVA_LONG; - static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG; - static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT; - static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE; - static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64).asUnbounded(); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/RuntimeHelper.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/RuntimeHelper.java deleted file mode 100644 index 4bc8f4e9d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/RuntimeHelper.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -// Generated by jextract - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.Linker; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_LONG; - -final class RuntimeHelper { - - private static final Linker LINKER = Linker.nativeLinker(); - private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); - private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); - private static final SymbolLookup SYMBOL_LOOKUP; - private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; - - final static SegmentAllocator CONSTANT_ALLOCATOR = - (size, align) -> MemorySegment.allocateNative(size, align, SegmentScope.auto()); - - static { -// System.loadLibrary("libsdrplay_api"); - SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); - SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name)); - } - - // Suppresses default constructor, ensuring non-instantiability. - private RuntimeHelper() {} - - static T requireNonNull(T obj, String symbolName) { - if (obj == null) { - throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); - } - return obj; - } - - static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) { - return SYMBOL_LOOKUP.find(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize(), symbol.scope())).orElse(null); - } - - static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> LINKER.downcallHandle(addr, fdesc)). - orElse(null); - } - - static MethodHandle downcallHandle(FunctionDescriptor fdesc) { - return LINKER.downcallHandle(fdesc); - } - - static MethodHandle downcallHandleVariadic(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> VarargsInvoker.make(addr, fdesc)). - orElse(null); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MH_LOOKUP.findVirtual(fi, name, fdesc.toMethodType()); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, SegmentScope scope) { - try { - fiHandle = fiHandle.bindTo(z); - return LINKER.upcallStub(fiHandle, fdesc, scope); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, SegmentScope scope) { - return MemorySegment.ofAddress(addr.address(), numElements * layout.byteSize(), scope); - } - - // Internals only below this point - - private static final class VarargsInvoker { - private static final MethodHandle INVOKE_MH; - private final MemorySegment symbol; - private final FunctionDescriptor function; - - private VarargsInvoker(MemorySegment symbol, FunctionDescriptor function) { - this.symbol = symbol; - this.function = function; - } - - static { - try { - INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); - } catch (ReflectiveOperationException e) { - throw new RuntimeException(e); - } - } - - static MethodHandle make(MemorySegment symbol, FunctionDescriptor function) { - VarargsInvoker invoker = new VarargsInvoker(symbol, function); - MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1); - MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class); - for (MemoryLayout layout : function.argumentLayouts()) { - mtype = mtype.appendParameterTypes(carrier(layout, false)); - } - mtype = mtype.appendParameterTypes(Object[].class); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mtype = mtype.insertParameterTypes(0, SegmentAllocator.class); - } else { - handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); - } - return handle.asType(mtype); - } - - static Class carrier(MemoryLayout layout, boolean ret) { - if (layout instanceof ValueLayout valueLayout) { - return valueLayout.carrier(); - } else if (layout instanceof GroupLayout) { - return MemorySegment.class; - } else { - throw new AssertionError("Cannot get here!"); - } - } - - private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { - // one trailing Object[] - int nNamedArgs = function.argumentLayouts().size(); - assert(args.length == nNamedArgs + 1); - // The last argument is the array of vararg collector - Object[] unnamedArgs = (Object[]) args[args.length - 1]; - - int argsCount = nNamedArgs + unnamedArgs.length; - Class[] argTypes = new Class[argsCount]; - MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; - - int pos = 0; - for (pos = 0; pos < nNamedArgs; pos++) { - argLayouts[pos] = function.argumentLayouts().get(pos); - } - - assert pos == nNamedArgs; - for (Object o: unnamedArgs) { - argLayouts[pos] = variadicLayout(normalize(o.getClass())); - pos++; - } - assert pos == argsCount; - - FunctionDescriptor f = (function.returnLayout().isEmpty()) ? - FunctionDescriptor.ofVoid(argLayouts) : - FunctionDescriptor.of(function.returnLayout().get(), argLayouts); - MethodHandle mh = LINKER.downcallHandle(symbol, f); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mh = mh.bindTo(allocator); - } - // flatten argument list so that it can be passed to an asSpreader MH - Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; - System.arraycopy(args, 0, allArgs, 0, nNamedArgs); - System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); - - return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); - } - - private static Class unboxIfNeeded(Class clazz) { - if (clazz == Boolean.class) { - return boolean.class; - } else if (clazz == Void.class) { - return void.class; - } else if (clazz == Byte.class) { - return byte.class; - } else if (clazz == Character.class) { - return char.class; - } else if (clazz == Short.class) { - return short.class; - } else if (clazz == Integer.class) { - return int.class; - } else if (clazz == Long.class) { - return long.class; - } else if (clazz == Float.class) { - return float.class; - } else if (clazz == Double.class) { - return double.class; - } else { - return clazz; - } - } - - private Class promote(Class c) { - if (c == byte.class || c == char.class || c == short.class || c == int.class) { - return long.class; - } else if (c == float.class) { - return double.class; - } else { - return c; - } - } - - private Class normalize(Class c) { - c = unboxIfNeeded(c); - if (c.isPrimitive()) { - return promote(c); - } - if (c == MemorySegment.class) { - return MemorySegment.class; - } - throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); - } - - private MemoryLayout variadicLayout(Class c) { - if (c == long.class) { - return JAVA_LONG; - } else if (c == double.class) { - return JAVA_DOUBLE; - } else if (c == MemorySegment.class) { - return ADDRESS; - } else { - throw new IllegalArgumentException("Unhandled variadic argument class: " + c); - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$0.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$0.java deleted file mode 100644 index 55d951472..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$0.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$0 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$0() {} - static final FunctionDescriptor sdrplay_api_StreamCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_StreamCallback_t.class, "apply", constants$0.sdrplay_api_StreamCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_StreamCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_EventCallback_t.class, "apply", constants$0.sdrplay_api_EventCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_EventCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_EventCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Open_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Open_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Open_t.class, "apply", constants$0.sdrplay_api_Open_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Open_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_Open_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$1.java deleted file mode 100644 index ea36af1a8..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$1.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$1 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$1() {} - static final FunctionDescriptor sdrplay_api_Close_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Close_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Close_t.class, "apply", constants$1.sdrplay_api_Close_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Close_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_Close_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ApiVersion_t.class, "apply", constants$1.sdrplay_api_ApiVersion_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_ApiVersion_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_LockDeviceApi_t.class, "apply", constants$1.sdrplay_api_LockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_LockDeviceApi_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$2.java deleted file mode 100644 index bc5c0fb52..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$2.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$2 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$2() {} - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_UnlockDeviceApi_t.class, "apply", constants$2.sdrplay_api_UnlockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDevices_t.class, "apply", constants$2.sdrplay_api_GetDevices_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDevices_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_GetDevices_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SelectDevice_t.class, "apply", constants$2.sdrplay_api_SelectDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_SelectDevice_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$3.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$3.java deleted file mode 100644 index 873be6a65..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$3.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$3 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$3() {} - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ReleaseDevice_t.class, "apply", constants$3.sdrplay_api_ReleaseDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_ReleaseDevice_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetErrorString_t.class, "apply", constants$3.sdrplay_api_GetErrorString_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetErrorString_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetLastError_t.class, "apply", constants$3.sdrplay_api_GetLastError_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetLastError_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetLastError_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$4.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$4.java deleted file mode 100644 index 028a9bcda..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$4.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$4 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$4() {} - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DisableHeartbeat_t.class, "apply", constants$4.sdrplay_api_DisableHeartbeat_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DebugEnable_t.class, "apply", constants$4.sdrplay_api_DebugEnable_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DebugEnable_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDeviceParams_t.class, "apply", constants$4.sdrplay_api_GetDeviceParams_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_GetDeviceParams_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$5.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$5.java deleted file mode 100644 index aad648b39..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$5.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$5 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$5() {} - static final FunctionDescriptor sdrplay_api_Init_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Init_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Init_t.class, "apply", constants$5.sdrplay_api_Init_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Init_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Init_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Uninit_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Uninit_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Uninit_t.class, "apply", constants$5.sdrplay_api_Uninit_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Uninit_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Uninit_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Update_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Update_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Update_t.class, "apply", constants$5.sdrplay_api_Update_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Update_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Update_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$6.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$6.java deleted file mode 100644 index 3f1fee9a6..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_08/constants$6.java +++ /dev/null @@ -1,102 +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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; - -final class constants$6 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$6() {} - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoMode_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoMode_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC - ); -} - - 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 index 2d78e25cf..4ef296283 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,19 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; +import static java.lang.foreign.ValueLayout.OfShort; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_AgcControlT enable; * int setPoint_dBfs; @@ -38,225 +42,382 @@ * unsigned short decay_delay_ms; * unsigned short decay_threshold_dB; * int syncUpdate; - * }; + * } * } */ public class sdrplay_api_AgcT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_AgcT.$struct$LAYOUT; + sdrplay_api_AgcT() { + // Should not be called directly + } + + 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; } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_AgcT.enable$VH; + + private static final OfInt enable$LAYOUT = (OfInt)$LAYOUT.select(groupElement("enable")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable + * } + */ + public static final OfInt enable$layout() { + return enable$LAYOUT; + } + + private static final long enable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable + * } + */ + public static final long enable$offset() { + return enable$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable * } */ - public static int enable$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg); + public static int enable(MemorySegment struct) { + return struct.get(enable$LAYOUT, enable$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; + * {@snippet lang=c : + * sdrplay_api_AgcControlT enable * } */ - public static void enable$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.enable$VH.set(seg, x); - } - public static int enable$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg.asSlice(index*sizeof())); + public static void enable(MemorySegment struct, int fieldValue) { + struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); } - public static void enable$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.enable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle setPoint_dBfs$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("setPoint_dBfs")); - public static VarHandle setPoint_dBfs$VH() { - return sdrplay_api_AgcT.setPoint_dBfs$VH; + + private static final long setPoint_dBfs$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * int setPoint_dBfs + * } + */ + public static final long setPoint_dBfs$offset() { + return setPoint_dBfs$OFFSET; } + /** * Getter for field: - * {@snippet : - * int setPoint_dBfs; + * {@snippet lang=c : + * int setPoint_dBfs * } */ - public static int setPoint_dBfs$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg); + public static int setPoint_dBfs(MemorySegment struct) { + return struct.get(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET); } + /** * Setter for field: - * {@snippet : - * int setPoint_dBfs; + * {@snippet lang=c : + * int setPoint_dBfs * } */ - public static void setPoint_dBfs$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg, x); - } - public static int setPoint_dBfs$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg.asSlice(index*sizeof())); + public static void setPoint_dBfs(MemorySegment struct, int fieldValue) { + struct.set(setPoint_dBfs$LAYOUT, setPoint_dBfs$OFFSET, fieldValue); } - public static void setPoint_dBfs$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle attack_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attack_ms")); - public static VarHandle attack_ms$VH() { - return sdrplay_api_AgcT.attack_ms$VH; + + private static final long attack_ms$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short attack_ms + * } + */ + public static final long attack_ms$offset() { + return attack_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short attack_ms; + * {@snippet lang=c : + * unsigned short attack_ms * } */ - public static short attack_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg); + public static short attack_ms(MemorySegment struct) { + return struct.get(attack_ms$LAYOUT, attack_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short attack_ms; + * {@snippet lang=c : + * unsigned short attack_ms * } */ - public static void attack_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg, x); - } - public static short attack_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg.asSlice(index*sizeof())); + public static void attack_ms(MemorySegment struct, short fieldValue) { + struct.set(attack_ms$LAYOUT, attack_ms$OFFSET, fieldValue); } - public static void attack_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_ms")); - public static VarHandle decay_ms$VH() { - return sdrplay_api_AgcT.decay_ms$VH; + + private static final long decay_ms$OFFSET = 10; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_ms + * } + */ + public static final long decay_ms$offset() { + return decay_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_ms; + * {@snippet lang=c : + * unsigned short decay_ms * } */ - public static short decay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg); + public static short decay_ms(MemorySegment struct) { + return struct.get(decay_ms$LAYOUT, decay_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_ms; + * {@snippet lang=c : + * unsigned short decay_ms * } */ - public static void decay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg, x); - } - public static short decay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg.asSlice(index*sizeof())); + public static void decay_ms(MemorySegment struct, short fieldValue) { + struct.set(decay_ms$LAYOUT, decay_ms$OFFSET, fieldValue); } - public static void decay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_delay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_delay_ms")); - public static VarHandle decay_delay_ms$VH() { - return sdrplay_api_AgcT.decay_delay_ms$VH; + + private static final long decay_delay_ms$OFFSET = 12; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_delay_ms + * } + */ + public static final long decay_delay_ms$offset() { + return decay_delay_ms$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_delay_ms; + * {@snippet lang=c : + * unsigned short decay_delay_ms * } */ - public static short decay_delay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg); + public static short decay_delay_ms(MemorySegment struct) { + return struct.get(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_delay_ms; + * {@snippet lang=c : + * unsigned short decay_delay_ms * } */ - public static void decay_delay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg, x); + public static void decay_delay_ms(MemorySegment struct, short fieldValue) { + struct.set(decay_delay_ms$LAYOUT, decay_delay_ms$OFFSET, fieldValue); } - public static short decay_delay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_delay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decay_threshold_dB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_threshold_dB")); - public static VarHandle decay_threshold_dB$VH() { - return sdrplay_api_AgcT.decay_threshold_dB$VH; + + private static final long decay_threshold_dB$OFFSET = 14; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned short decay_threshold_dB + * } + */ + public static final long decay_threshold_dB$offset() { + return decay_threshold_dB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned short decay_threshold_dB; + * {@snippet lang=c : + * unsigned short decay_threshold_dB * } */ - public static short decay_threshold_dB$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg); + public static short decay_threshold_dB(MemorySegment struct) { + return struct.get(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned short decay_threshold_dB; + * {@snippet lang=c : + * unsigned short decay_threshold_dB * } */ - public static void decay_threshold_dB$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg, x); + public static void decay_threshold_dB(MemorySegment struct, short fieldValue) { + struct.set(decay_threshold_dB$LAYOUT, decay_threshold_dB$OFFSET, fieldValue); } - public static short decay_threshold_dB$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_threshold_dB$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_AgcT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * int syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * int syncUpdate; + * {@snippet lang=c : + * int syncUpdate * } */ - public static int syncUpdate$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg); + public static int syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * int syncUpdate; + * {@snippet lang=c : + * int syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, int fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static int syncUpdate$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void syncUpdate$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); + } + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, Arena arena, Consumer cleanup) { + return reinterpret(addr, 1, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 2512382e1..c2242733e 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_ApiVersion_t)(float* apiVer); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_ApiVersion_t)(float *) * } */ -public interface sdrplay_api_ApiVersion_t { +public class sdrplay_api_ApiVersion_t { - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_ApiVersion_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_ApiVersion_t_UP$MH, fi, constants$1.sdrplay_api_ApiVersion_t$FUNC, scope); + sdrplay_api_ApiVersion_t() { + // Should not be called directly } - static sdrplay_api_ApiVersion_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$1.sdrplay_api_ApiVersion_t_DOWN$MH.invokeExact(symbol, _dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment apiVer); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ApiVersion_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_ApiVersion_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment apiVer) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, apiVer); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 4e8ef243e..a9b9e2fb1 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,131 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_StreamCallback_t StreamACbFn; * sdrplay_api_StreamCallback_t StreamBCbFn; * sdrplay_api_EventCallback_t EventCbFn; - * }; + * } * } */ public class sdrplay_api_CallbackFnsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("StreamACbFn"), - Constants$root.C_POINTER$LAYOUT.withName("StreamBCbFn"), - Constants$root.C_POINTER$LAYOUT.withName("EventCbFn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_CallbackFnsT.$struct$LAYOUT; + sdrplay_api_CallbackFnsT() { + // Should not be called directly } - static final VarHandle StreamACbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamACbFn")); - public static VarHandle StreamACbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamACbFn$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_POINTER.withName("StreamACbFn"), + sdrplay_api_h.C_POINTER.withName("StreamBCbFn"), + sdrplay_api_h.C_POINTER.withName("EventCbFn") + ).withName("$anon$71:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final AddressLayout StreamACbFn$LAYOUT = (AddressLayout)$LAYOUT.select(groupElement("StreamACbFn")); + /** - * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn * } */ - public static MemorySegment StreamACbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg); + public static final AddressLayout StreamACbFn$layout() { + return StreamACbFn$LAYOUT; } + + private static final long StreamACbFn$OFFSET = 0; + /** - * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn * } */ - public static void StreamACbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg, x); + public static final long StreamACbFn$offset() { + return StreamACbFn$OFFSET; } - public static MemorySegment StreamACbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamACbFn + * } + */ + public static MemorySegment StreamACbFn(MemorySegment struct) { + return struct.get(StreamACbFn$LAYOUT, StreamACbFn$OFFSET); } - public static void StreamACbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static sdrplay_api_StreamCallback_t StreamACbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamACbFn$get(segment), scope); + + 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; } - static final VarHandle StreamBCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamBCbFn")); - public static VarHandle StreamBCbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamBCbFn$VH; + + private static final long StreamBCbFn$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn + * } + */ + public static final long StreamBCbFn$offset() { + return StreamBCbFn$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn * } */ - public static MemorySegment StreamBCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg); + public static MemorySegment StreamBCbFn(MemorySegment struct) { + return struct.get(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; + * {@snippet lang=c : + * sdrplay_api_StreamCallback_t StreamBCbFn * } */ - public static void StreamBCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg, x); + public static void StreamBCbFn(MemorySegment struct, MemorySegment fieldValue) { + struct.set(StreamBCbFn$LAYOUT, StreamBCbFn$OFFSET, fieldValue); } - public static MemorySegment StreamBCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg.asSlice(index*sizeof())); - } - public static void StreamBCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static sdrplay_api_StreamCallback_t StreamBCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamBCbFn$get(segment), scope); + + 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; } - static final VarHandle EventCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("EventCbFn")); - public static VarHandle EventCbFn$VH() { - return sdrplay_api_CallbackFnsT.EventCbFn$VH; + + private static final long EventCbFn$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn + * } + */ + public static final long EventCbFn$offset() { + return EventCbFn$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn * } */ - public static MemorySegment EventCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg); + public static MemorySegment EventCbFn(MemorySegment struct) { + return struct.get(EventCbFn$LAYOUT, EventCbFn$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; + * {@snippet lang=c : + * sdrplay_api_EventCallback_t EventCbFn * } */ - public static void EventCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg, x); + public static void EventCbFn(MemorySegment struct, MemorySegment fieldValue) { + struct.set(EventCbFn$LAYOUT, EventCbFn$OFFSET, fieldValue); + } + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static MemorySegment EventCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg.asSlice(index*sizeof())); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static void EventCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static sdrplay_api_EventCallback_t EventCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_EventCallback_t.ofAddress(EventCbFn$get(segment), scope); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 660e0c289..c90f94033 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Close_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Close_t)(void) * } */ -public interface sdrplay_api_Close_t { +public class sdrplay_api_Close_t { - int apply(); - static MemorySegment allocate(sdrplay_api_Close_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_Close_t_UP$MH, fi, constants$1.sdrplay_api_Close_t$FUNC, scope); + sdrplay_api_Close_t() { + // Should not be called directly } - static sdrplay_api_Close_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_Close_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Close_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Close_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 9485f9030..7f60a6a8e 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,93 +21,265 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_DcOffsetT dcOffset; * sdrplay_api_DecimationT decimation; * sdrplay_api_AgcT agc; * sdrplay_api_AdsbModeT adsbMode; - * }; + * } * } */ public class sdrplay_api_ControlParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ControlParamsT.$struct$LAYOUT; - } - public static MemorySegment dcOffset$slice(MemorySegment seg) { - return seg.asSlice(0, 2); - } - public static MemorySegment decimation$slice(MemorySegment seg) { - return seg.asSlice(2, 3); - } - public static MemorySegment agc$slice(MemorySegment seg) { - return seg.asSlice(8, 20); - } - static final VarHandle adsbMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("adsbMode")); - public static VarHandle adsbMode$VH() { - return sdrplay_api_ControlParamsT.adsbMode$VH; + 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 : - * sdrplay_api_AdsbModeT adsbMode; + * {@snippet lang=c : + * sdrplay_api_DcOffsetT dcOffset * } */ - public static int adsbMode$get(MemorySegment seg) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg); + public static MemorySegment dcOffset(MemorySegment struct) { + return struct.asSlice(dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_AdsbModeT adsbMode; + * {@snippet lang=c : + * sdrplay_api_DcOffsetT dcOffset * } */ - public static void adsbMode$set(MemorySegment seg, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg, x); + public static void dcOffset(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, dcOffset$OFFSET, dcOffset$LAYOUT.byteSize()); } - public static int adsbMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout decimation$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("decimation")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static final GroupLayout decimation$layout() { + return decimation$LAYOUT; } - public static void adsbMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg.asSlice(index*sizeof()), x); + + private static final long decimation$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static final long decimation$offset() { + return decimation$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_DecimationT decimation + * } + */ + public static MemorySegment decimation(MemorySegment struct) { + return struct.asSlice(decimation$OFFSET, decimation$LAYOUT.byteSize()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Setter for field: + * {@snippet lang=c : + * sdrplay_api_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()); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index b0c6cd089..49f555c1d 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,92 +21,172 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char DCenable; * unsigned char IQenable; - * }; + * } * } */ public class sdrplay_api_DcOffsetT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetT.$struct$LAYOUT; + sdrplay_api_DcOffsetT() { + // Should not be called directly + } + + 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; } - static final VarHandle DCenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("DCenable")); - public static VarHandle DCenable$VH() { - return sdrplay_api_DcOffsetT.DCenable$VH; + + private static final OfByte DCenable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("DCenable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char DCenable + * } + */ + public static final OfByte DCenable$layout() { + return DCenable$LAYOUT; } + + private static final long DCenable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char DCenable + * } + */ + public static final long DCenable$offset() { + return DCenable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char DCenable; + * {@snippet lang=c : + * unsigned char DCenable * } */ - public static byte DCenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg); + public static byte DCenable(MemorySegment struct) { + return struct.get(DCenable$LAYOUT, DCenable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char DCenable; + * {@snippet lang=c : + * unsigned char DCenable * } */ - public static void DCenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg, x); - } - public static byte DCenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg.asSlice(index*sizeof())); + public static void DCenable(MemorySegment struct, byte fieldValue) { + struct.set(DCenable$LAYOUT, DCenable$OFFSET, fieldValue); } - public static void DCenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle IQenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("IQenable")); - public static VarHandle IQenable$VH() { - return sdrplay_api_DcOffsetT.IQenable$VH; + + private static final long IQenable$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char IQenable + * } + */ + public static final long IQenable$offset() { + return IQenable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char IQenable; + * {@snippet lang=c : + * unsigned char IQenable * } */ - public static byte IQenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg); + public static byte IQenable(MemorySegment struct) { + return struct.get(IQenable$LAYOUT, IQenable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char IQenable; + * {@snippet lang=c : + * unsigned char IQenable * } */ - public static void IQenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg, x); + public static void IQenable(MemorySegment struct, byte fieldValue) { + struct.set(IQenable$LAYOUT, IQenable$OFFSET, fieldValue); } - public static byte IQenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void IQenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 6ab30f805..1178e9e39 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,153 +21,266 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char dcCal; * unsigned char speedUp; * int trackTime; * int refreshRateTime; - * }; + * } * } */ public class sdrplay_api_DcOffsetTunerT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetTunerT.$struct$LAYOUT; + sdrplay_api_DcOffsetTunerT() { + // Should not be called directly + } + + 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; } - static final VarHandle dcCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dcCal")); - public static VarHandle dcCal$VH() { - return sdrplay_api_DcOffsetTunerT.dcCal$VH; + + private static final long dcCal$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char dcCal + * } + */ + public static final long dcCal$offset() { + return dcCal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char dcCal; + * {@snippet lang=c : + * unsigned char dcCal * } */ - public static byte dcCal$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg); + public static byte dcCal(MemorySegment struct) { + return struct.get(dcCal$LAYOUT, dcCal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char dcCal; + * {@snippet lang=c : + * unsigned char dcCal * } */ - public static void dcCal$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg, x); + public static void dcCal(MemorySegment struct, byte fieldValue) { + struct.set(dcCal$LAYOUT, dcCal$OFFSET, fieldValue); } - public static byte dcCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg.asSlice(index*sizeof())); - } - public static void dcCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle speedUp$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("speedUp")); - public static VarHandle speedUp$VH() { - return sdrplay_api_DcOffsetTunerT.speedUp$VH; + + private static final long speedUp$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char speedUp + * } + */ + public static final long speedUp$offset() { + return speedUp$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char speedUp; + * {@snippet lang=c : + * unsigned char speedUp * } */ - public static byte speedUp$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg); + public static byte speedUp(MemorySegment struct) { + return struct.get(speedUp$LAYOUT, speedUp$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char speedUp; + * {@snippet lang=c : + * unsigned char speedUp * } */ - public static void speedUp$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg, x); + public static void speedUp(MemorySegment struct, byte fieldValue) { + struct.set(speedUp$LAYOUT, speedUp$OFFSET, fieldValue); } - public static byte speedUp$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg.asSlice(index*sizeof())); - } - public static void speedUp$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle trackTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("trackTime")); - public static VarHandle trackTime$VH() { - return sdrplay_api_DcOffsetTunerT.trackTime$VH; + + private static final long trackTime$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * int trackTime + * } + */ + public static final long trackTime$offset() { + return trackTime$OFFSET; } + /** * Getter for field: - * {@snippet : - * int trackTime; + * {@snippet lang=c : + * int trackTime * } */ - public static int trackTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg); + public static int trackTime(MemorySegment struct) { + return struct.get(trackTime$LAYOUT, trackTime$OFFSET); } + /** * Setter for field: - * {@snippet : - * int trackTime; + * {@snippet lang=c : + * int trackTime * } */ - public static void trackTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg, x); - } - public static int trackTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg.asSlice(index*sizeof())); + public static void trackTime(MemorySegment struct, int fieldValue) { + struct.set(trackTime$LAYOUT, trackTime$OFFSET, fieldValue); } - public static void trackTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle refreshRateTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("refreshRateTime")); - public static VarHandle refreshRateTime$VH() { - return sdrplay_api_DcOffsetTunerT.refreshRateTime$VH; + + private static final long refreshRateTime$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * int refreshRateTime + * } + */ + public static final long refreshRateTime$offset() { + return refreshRateTime$OFFSET; } + /** * Getter for field: - * {@snippet : - * int refreshRateTime; + * {@snippet lang=c : + * int refreshRateTime * } */ - public static int refreshRateTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg); + public static int refreshRateTime(MemorySegment struct) { + return struct.get(refreshRateTime$LAYOUT, refreshRateTime$OFFSET); } + /** * Setter for field: - * {@snippet : - * int refreshRateTime; + * {@snippet lang=c : + * int refreshRateTime * } */ - public static void refreshRateTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg, x); + public static void refreshRateTime(MemorySegment struct, int fieldValue) { + struct.set(refreshRateTime$LAYOUT, refreshRateTime$OFFSET, fieldValue); + } + + /** + * 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()); } - public static int refreshRateTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg.asSlice(index*sizeof())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static void refreshRateTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 0d75683c3..c59c5f00c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_DebugEnable_t)(void* dev,enum dbgLvl); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_DebugEnable_t)(HANDLE, sdrplay_api_DbgLvl_t) * } */ -public interface sdrplay_api_DebugEnable_t { +public class sdrplay_api_DebugEnable_t { - int apply(java.lang.foreign.MemorySegment dev, int dbgLvl); - static MemorySegment allocate(sdrplay_api_DebugEnable_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DebugEnable_t_UP$MH, fi, constants$4.sdrplay_api_DebugEnable_t$FUNC, scope); + sdrplay_api_DebugEnable_t() { + // Should not be called directly } - static sdrplay_api_DebugEnable_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _dbgLvl) -> { - try { - return (int)constants$4.sdrplay_api_DebugEnable_t_DOWN$MH.invokeExact(symbol, _dev, _dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, int dbgLvl); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DebugEnable_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_DebugEnable_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, int dbgLvl) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, dbgLvl); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index e58fca3c6..90262c730 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char enable; * unsigned char decimationFactor; * unsigned char wideBandSignal; - * }; + * } * } */ public class sdrplay_api_DecimationT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DecimationT.$struct$LAYOUT; + sdrplay_api_DecimationT() { + // Should not be called directly } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_DecimationT.enable$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("enable"), + sdrplay_api_h.C_CHAR.withName("decimationFactor"), + sdrplay_api_h.C_CHAR.withName("wideBandSignal") + ).withName("$anon$29:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfByte enable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("enable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char enable + * } + */ + public static final OfByte enable$layout() { + return enable$LAYOUT; + } + + private static final long enable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char enable + * } + */ + public static final long enable$offset() { + return enable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char enable; + * {@snippet lang=c : + * unsigned char enable * } */ - public static byte enable$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg); + public static byte enable(MemorySegment struct) { + return struct.get(enable$LAYOUT, enable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char enable; + * {@snippet lang=c : + * unsigned char enable * } */ - public static void enable$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg, x); + public static void enable(MemorySegment struct, byte fieldValue) { + struct.set(enable$LAYOUT, enable$OFFSET, fieldValue); } - public static byte enable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg.asSlice(index*sizeof())); - } - public static void enable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle decimationFactor$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decimationFactor")); - public static VarHandle decimationFactor$VH() { - return sdrplay_api_DecimationT.decimationFactor$VH; + + private static final long decimationFactor$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char decimationFactor + * } + */ + public static final long decimationFactor$offset() { + return decimationFactor$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char decimationFactor; + * {@snippet lang=c : + * unsigned char decimationFactor * } */ - public static byte decimationFactor$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg); + public static byte decimationFactor(MemorySegment struct) { + return struct.get(decimationFactor$LAYOUT, decimationFactor$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char decimationFactor; + * {@snippet lang=c : + * unsigned char decimationFactor * } */ - public static void decimationFactor$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg, x); - } - public static byte decimationFactor$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg.asSlice(index*sizeof())); + public static void decimationFactor(MemorySegment struct, byte fieldValue) { + struct.set(decimationFactor$LAYOUT, decimationFactor$OFFSET, fieldValue); } - public static void decimationFactor$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle wideBandSignal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("wideBandSignal")); - public static VarHandle wideBandSignal$VH() { - return sdrplay_api_DecimationT.wideBandSignal$VH; + + private static final long wideBandSignal$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char wideBandSignal + * } + */ + public static final long wideBandSignal$offset() { + return wideBandSignal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char wideBandSignal; + * {@snippet lang=c : + * unsigned char wideBandSignal * } */ - public static byte wideBandSignal$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg); + public static byte wideBandSignal(MemorySegment struct) { + return struct.get(wideBandSignal$LAYOUT, wideBandSignal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char wideBandSignal; + * {@snippet lang=c : + * unsigned char wideBandSignal * } */ - public static void wideBandSignal$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg, x); + public static void wideBandSignal(MemorySegment struct, byte fieldValue) { + struct.set(wideBandSignal$LAYOUT, wideBandSignal$OFFSET, fieldValue); } - public static byte wideBandSignal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void wideBandSignal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 8579b3767..3767288c1 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,19 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * double ppm; * sdrplay_api_FsFreqT fsFreq; @@ -41,166 +45,519 @@ * sdrplay_api_Rsp2ParamsT rsp2Params; * sdrplay_api_RspDuoParamsT rspDuoParams; * sdrplay_api_RspDxParamsT rspDxParams; - * }; + * } * } */ public class sdrplay_api_DevParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("ppm"), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ).withName("fsFreq"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ).withName("syncUpdate"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ).withName("resetFlags"), - MemoryLayout.paddingLayout(8), - Constants$root.C_INT$LAYOUT.withName("mode"), - Constants$root.C_INT$LAYOUT.withName("samplesPerPkt"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ).withName("rsp1aParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ).withName("rsp2Params"), - MemoryLayout.paddingLayout(8), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ).withName("rspDuoParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ).withName("rspDxParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DevParamsT.$struct$LAYOUT; - } - static final VarHandle ppm$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ppm")); - public static VarHandle ppm$VH() { - return sdrplay_api_DevParamsT.ppm$VH; + 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 : - * double ppm; + * {@snippet lang=c : + * double ppm * } */ - public static double ppm$get(MemorySegment seg) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg); + public static double ppm(MemorySegment struct) { + return struct.get(ppm$LAYOUT, ppm$OFFSET); } + /** * Setter for field: - * {@snippet : - * double ppm; + * {@snippet lang=c : + * double ppm * } */ - public static void ppm$set(MemorySegment seg, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg, x); + public static void ppm(MemorySegment struct, double fieldValue) { + struct.set(ppm$LAYOUT, ppm$OFFSET, fieldValue); } - public static double ppm$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout fsFreq$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("fsFreq")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_FsFreqT fsFreq + * } + */ + public static final GroupLayout fsFreq$layout() { + return fsFreq$LAYOUT; } - public static void ppm$set(MemorySegment seg, long index, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - public static MemorySegment fsFreq$slice(MemorySegment seg) { - return seg.asSlice(8, 16); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_FsFreqT fsFreq + * } + */ + public static MemorySegment fsFreq(MemorySegment struct) { + return struct.asSlice(fsFreq$OFFSET, fsFreq$LAYOUT.byteSize()); } - public static MemorySegment syncUpdate$slice(MemorySegment seg) { - return seg.asSlice(24, 8); + + /** + * 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()); } - public static MemorySegment resetFlags$slice(MemorySegment seg) { - return seg.asSlice(32, 3); + + 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; } - static final VarHandle mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("mode")); - public static VarHandle mode$VH() { - return sdrplay_api_DevParamsT.mode$VH; + + private static final long 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 : - * sdrplay_api_TransferModeT mode; + * {@snippet lang=c : + * sdrplay_api_SyncUpdateT syncUpdate * } */ - public static int mode$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg); + public static MemorySegment syncUpdate(MemorySegment struct) { + return struct.asSlice(syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_TransferModeT mode; + * {@snippet lang=c : + * sdrplay_api_SyncUpdateT syncUpdate * } */ - public static void mode$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, syncUpdate$OFFSET, syncUpdate$LAYOUT.byteSize()); } - public static int mode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg.asSlice(index*sizeof())); + + private static final GroupLayout resetFlags$LAYOUT = (GroupLayout)$LAYOUT.select(groupElement("resetFlags")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_ResetFlagsT resetFlags + * } + */ + public static final GroupLayout resetFlags$layout() { + return resetFlags$LAYOUT; + } + + 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()); } - public static void mode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle samplesPerPkt$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("samplesPerPkt")); - public static VarHandle samplesPerPkt$VH() { - return sdrplay_api_DevParamsT.samplesPerPkt$VH; + + private static final long 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 : - * unsigned int samplesPerPkt; + * {@snippet lang=c : + * sdrplay_api_TransferModeT mode * } */ - public static int samplesPerPkt$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg); + public static int mode(MemorySegment struct) { + return struct.get(mode$LAYOUT, mode$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int samplesPerPkt; + * {@snippet lang=c : + * sdrplay_api_TransferModeT mode * } */ - public static void samplesPerPkt$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg, x); + public static void mode(MemorySegment struct, int fieldValue) { + struct.set(mode$LAYOUT, mode$OFFSET, fieldValue); } - public static int samplesPerPkt$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void samplesPerPkt$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg.asSlice(index*sizeof()), x); + + private static final long samplesPerPkt$OFFSET = 40; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static final long samplesPerPkt$offset() { + return samplesPerPkt$OFFSET; } - public static MemorySegment rsp1aParams$slice(MemorySegment seg) { - return seg.asSlice(44, 2); + + /** + * Getter for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static int samplesPerPkt(MemorySegment struct) { + return struct.get(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET); } - public static MemorySegment rsp2Params$slice(MemorySegment seg) { - return seg.asSlice(46, 1); + + /** + * Setter for field: + * {@snippet lang=c : + * unsigned int samplesPerPkt + * } + */ + public static void samplesPerPkt(MemorySegment struct, int fieldValue) { + struct.set(samplesPerPkt$LAYOUT, samplesPerPkt$OFFSET, fieldValue); } - public static MemorySegment rspDuoParams$slice(MemorySegment seg) { - return seg.asSlice(48, 4); + + 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; } - public static MemorySegment rspDxParams$slice(MemorySegment seg) { - return seg.asSlice(52, 12); + + 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; } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_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); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index b5e09bd2c..6af72cd32 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * struct { - * sdrplay_api_DevParamsT* devParams; - * sdrplay_api_RxChannelParamsT* rxChannelA; - * sdrplay_api_RxChannelParamsT* rxChannelB; - * }; + * sdrplay_api_DevParamsT *devParams; + * sdrplay_api_RxChannelParamsT *rxChannelA; + * sdrplay_api_RxChannelParamsT *rxChannelB; + * } * } */ public class sdrplay_api_DeviceParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("devParams"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelA"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelB") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceParamsT.$struct$LAYOUT; + sdrplay_api_DeviceParamsT() { + // Should not be called directly } - static final VarHandle devParams$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("devParams")); - public static VarHandle devParams$VH() { - return sdrplay_api_DeviceParamsT.devParams$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_POINTER.withName("devParams"), + sdrplay_api_h.C_POINTER.withName("rxChannelA"), + sdrplay_api_h.C_POINTER.withName("rxChannelB") + ).withName("$anon$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 : - * sdrplay_api_DevParamsT* devParams; + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams * } */ - public static MemorySegment devParams$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg); + public static MemorySegment devParams(MemorySegment struct) { + return struct.get(devParams$LAYOUT, devParams$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_DevParamsT* devParams; + * {@snippet lang=c : + * sdrplay_api_DevParamsT *devParams * } */ - public static void devParams$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg, x); + public static void devParams(MemorySegment struct, MemorySegment fieldValue) { + struct.set(devParams$LAYOUT, devParams$OFFSET, fieldValue); } - public static MemorySegment devParams$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg.asSlice(index*sizeof())); - } - public static void devParams$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rxChannelA$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelA")); - public static VarHandle rxChannelA$VH() { - return sdrplay_api_DeviceParamsT.rxChannelA$VH; + + private static final long rxChannelA$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA + * } + */ + public static final long rxChannelA$offset() { + return rxChannelA$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA * } */ - public static MemorySegment rxChannelA$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg); + public static MemorySegment rxChannelA(MemorySegment struct) { + return struct.get(rxChannelA$LAYOUT, rxChannelA$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelA * } */ - public static void rxChannelA$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg, x); - } - public static MemorySegment rxChannelA$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg.asSlice(index*sizeof())); + public static void rxChannelA(MemorySegment struct, MemorySegment fieldValue) { + struct.set(rxChannelA$LAYOUT, rxChannelA$OFFSET, fieldValue); } - public static void rxChannelA$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rxChannelB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelB")); - public static VarHandle rxChannelB$VH() { - return sdrplay_api_DeviceParamsT.rxChannelB$VH; + + private static final long rxChannelB$OFFSET = 16; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB + * } + */ + public static final long rxChannelB$offset() { + return rxChannelB$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB * } */ - public static MemorySegment rxChannelB$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg); + public static MemorySegment rxChannelB(MemorySegment struct) { + return struct.get(rxChannelB$LAYOUT, rxChannelB$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; + * {@snippet lang=c : + * sdrplay_api_RxChannelParamsT *rxChannelB * } */ - public static void rxChannelB$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg, x); + public static void rxChannelB(MemorySegment struct, MemorySegment fieldValue) { + struct.set(rxChannelB$LAYOUT, rxChannelB$OFFSET, fieldValue); } - public static MemorySegment rxChannelB$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rxChannelB$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 8de869d1d..a9d88b68a 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,15 +21,24 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; +import java.lang.foreign.SequenceLayout; import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * char SerNo[64]; * unsigned char hwVer; @@ -38,202 +47,417 @@ * unsigned char valid; * double rspDuoSampleFreq; * HANDLE dev; - * }; + * } * } */ public class sdrplay_api_DeviceT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, Constants$root.C_CHAR$LAYOUT).withName("SerNo"), - Constants$root.C_CHAR$LAYOUT.withName("hwVer"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner"), - Constants$root.C_INT$LAYOUT.withName("rspDuoMode"), - Constants$root.C_CHAR$LAYOUT.withName("valid"), - MemoryLayout.paddingLayout(24), - Constants$root.C_DOUBLE$LAYOUT.withName("rspDuoSampleFreq"), - Constants$root.C_POINTER$LAYOUT.withName("dev") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceT.$struct$LAYOUT; + sdrplay_api_DeviceT() { + // Should not be called directly } - public static MemorySegment SerNo$slice(MemorySegment seg) { - return seg.asSlice(0, 64); + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(64, sdrplay_api_h.C_CHAR).withName("SerNo"), + sdrplay_api_h.C_CHAR.withName("hwVer"), + MemoryLayout.paddingLayout(3), + sdrplay_api_h.C_INT.withName("tuner"), + sdrplay_api_h.C_INT.withName("rspDuoMode"), + 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; } - static final VarHandle hwVer$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hwVer")); - public static VarHandle hwVer$VH() { - return sdrplay_api_DeviceT.hwVer$VH; + + private static final long SerNo$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static final long SerNo$offset() { + return SerNo$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char hwVer; + * {@snippet lang=c : + * char SerNo[64] * } */ - public static byte hwVer$get(MemorySegment seg) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg); + public static MemorySegment SerNo(MemorySegment struct) { + return struct.asSlice(SerNo$OFFSET, SerNo$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * unsigned char hwVer; + * {@snippet lang=c : + * char SerNo[64] * } */ - public static void hwVer$set(MemorySegment seg, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg, x); + public static void SerNo(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, SerNo$OFFSET, SerNo$LAYOUT.byteSize()); } - public static byte hwVer$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg.asSlice(index*sizeof())); + + private static long[] SerNo$DIMS = { 64 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static long[] SerNo$dimensions() { + return SerNo$DIMS; } - public static void hwVer$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg.asSlice(index*sizeof()), x); + private static final VarHandle SerNo$ELEM_HANDLE = SerNo$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static byte SerNo(MemorySegment struct, long index0) { + return (byte)SerNo$ELEM_HANDLE.get(struct, 0L, index0); } - static final VarHandle tuner$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner")); - public static VarHandle tuner$VH() { - return sdrplay_api_DeviceT.tuner$VH; + + /** + * Indexed setter for field: + * {@snippet lang=c : + * char SerNo[64] + * } + */ + public static void SerNo(MemorySegment struct, long index0, byte fieldValue) { + SerNo$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); } + + private static final OfByte hwVer$LAYOUT = (OfByte)$LAYOUT.select(groupElement("hwVer")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char hwVer + * } + */ + public static final OfByte hwVer$layout() { + return hwVer$LAYOUT; + } + + private static final long hwVer$OFFSET = 64; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char hwVer + * } + */ + public static final long hwVer$offset() { + return hwVer$OFFSET; + } + /** * Getter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; + * {@snippet lang=c : + * unsigned char hwVer * } */ - public static int tuner$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg); + public static byte hwVer(MemorySegment struct) { + return struct.get(hwVer$LAYOUT, hwVer$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; + * {@snippet lang=c : + * unsigned char hwVer * } */ - public static void tuner$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg, x); - } - public static int tuner$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg.asSlice(index*sizeof())); + public static void hwVer(MemorySegment struct, byte fieldValue) { + struct.set(hwVer$LAYOUT, hwVer$OFFSET, fieldValue); } - public static void tuner$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rspDuoMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoMode")); - public static VarHandle rspDuoMode$VH() { - return sdrplay_api_DeviceT.rspDuoMode$VH; + + private static final long tuner$OFFSET = 68; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner + * } + */ + public static final long tuner$offset() { + return tuner$OFFSET; } + /** * Getter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner * } */ - public static int rspDuoMode$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg); + public static int tuner(MemorySegment struct) { + return struct.get(tuner$LAYOUT, tuner$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; + * {@snippet lang=c : + * sdrplay_api_TunerSelectT tuner * } */ - public static void rspDuoMode$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg, x); + public static void tuner(MemorySegment struct, int fieldValue) { + struct.set(tuner$LAYOUT, tuner$OFFSET, fieldValue); } - public static int rspDuoMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg.asSlice(index*sizeof())); - } - public static void rspDuoMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle valid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("valid")); - public static VarHandle valid$VH() { - return sdrplay_api_DeviceT.valid$VH; + + private static final long rspDuoMode$OFFSET = 72; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode + * } + */ + public static final long rspDuoMode$offset() { + return rspDuoMode$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char valid; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode * } */ - public static byte valid$get(MemorySegment seg) { - return (byte)sdrplay_api_DeviceT.valid$VH.get(seg); + public static int rspDuoMode(MemorySegment struct) { + return struct.get(rspDuoMode$LAYOUT, rspDuoMode$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char valid; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeT rspDuoMode * } */ - public static void valid$set(MemorySegment seg, byte x) { - sdrplay_api_DeviceT.valid$VH.set(seg, x); - } - public static byte valid$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DeviceT.valid$VH.get(seg.asSlice(index*sizeof())); + public static void rspDuoMode(MemorySegment struct, int fieldValue) { + struct.set(rspDuoMode$LAYOUT, rspDuoMode$OFFSET, fieldValue); } - public static void valid$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DeviceT.valid$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rspDuoSampleFreq$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoSampleFreq")); - public static VarHandle rspDuoSampleFreq$VH() { - return sdrplay_api_DeviceT.rspDuoSampleFreq$VH; + + private static final long 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 : - * double rspDuoSampleFreq; + * {@snippet lang=c : + * unsigned char valid * } */ - public static double rspDuoSampleFreq$get(MemorySegment seg) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg); + public static byte valid(MemorySegment struct) { + return struct.get(valid$LAYOUT, valid$OFFSET); } + /** * Setter for field: - * {@snippet : - * double rspDuoSampleFreq; + * {@snippet lang=c : + * unsigned char valid * } */ - public static void rspDuoSampleFreq$set(MemorySegment seg, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg, x); + public static void valid(MemorySegment struct, byte fieldValue) { + struct.set(valid$LAYOUT, valid$OFFSET, fieldValue); } - public static double rspDuoSampleFreq$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg.asSlice(index*sizeof())); + + private static final OfDouble rspDuoSampleFreq$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rspDuoSampleFreq")); + + /** + * Layout for field: + * {@snippet lang=c : + * double rspDuoSampleFreq + * } + */ + public static final OfDouble rspDuoSampleFreq$layout() { + return rspDuoSampleFreq$LAYOUT; + } + + 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); } - public static void rspDuoSampleFreq$set(MemorySegment seg, long index, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle dev$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dev")); - public static VarHandle dev$VH() { - return sdrplay_api_DeviceT.dev$VH; + + private static final long dev$OFFSET = 88; + + /** + * Offset for field: + * {@snippet lang=c : + * HANDLE dev + * } + */ + public static final long dev$offset() { + return dev$OFFSET; } + /** * Getter for field: - * {@snippet : - * HANDLE dev; + * {@snippet lang=c : + * HANDLE dev * } */ - public static MemorySegment dev$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg); + public static MemorySegment dev(MemorySegment struct) { + return struct.get(dev$LAYOUT, dev$OFFSET); } + /** * Setter for field: - * {@snippet : - * HANDLE dev; + * {@snippet lang=c : + * HANDLE dev * } */ - public static void dev$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg, x); + public static void dev(MemorySegment struct, MemorySegment fieldValue) { + struct.set(dev$LAYOUT, dev$OFFSET, fieldValue); } - public static MemorySegment dev$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void dev$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index b4b49f5a2..099227604 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_DisableHeartbeat_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_DisableHeartbeat_t)(void) * } */ -public interface sdrplay_api_DisableHeartbeat_t { +public class sdrplay_api_DisableHeartbeat_t { - int apply(); - static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DisableHeartbeat_t_UP$MH, fi, constants$4.sdrplay_api_DisableHeartbeat_t$FUNC, scope); + sdrplay_api_DisableHeartbeat_t() { + // Should not be called directly } - static sdrplay_api_DisableHeartbeat_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_DisableHeartbeat_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 3717d2156..d9fdeaab8 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,77 +21,366 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; +import java.lang.foreign.SequenceLayout; import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.MemoryLayout.PathElement.sequenceElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * char file[256]; * char function[256]; * int line; * char message[1024]; - * }; + * } * } */ public class sdrplay_api_ErrorInfoT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("file"), - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("function"), - Constants$root.C_INT$LAYOUT.withName("line"), - MemoryLayout.sequenceLayout(1024, Constants$root.C_CHAR$LAYOUT).withName("message") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ErrorInfoT.$struct$LAYOUT; + sdrplay_api_ErrorInfoT() { + // Should not be called directly } - public static MemorySegment file$slice(MemorySegment seg) { - return seg.asSlice(0, 256); + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("file"), + MemoryLayout.sequenceLayout(256, sdrplay_api_h.C_CHAR).withName("function"), + sdrplay_api_h.C_INT.withName("line"), + MemoryLayout.sequenceLayout(1024, sdrplay_api_h.C_CHAR).withName("message") + ).withName("$anon$162:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } - public static MemorySegment function$slice(MemorySegment seg) { - return seg.asSlice(256, 256); + + private static final SequenceLayout file$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("file")); + + /** + * Layout for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static final SequenceLayout file$layout() { + return file$LAYOUT; } - static final VarHandle line$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("line")); - public static VarHandle line$VH() { - return sdrplay_api_ErrorInfoT.line$VH; + + private static final long file$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static final long file$offset() { + return file$OFFSET; } + /** * Getter for field: - * {@snippet : - * int line; + * {@snippet lang=c : + * char file[256] * } */ - public static int line$get(MemorySegment seg) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg); + public static MemorySegment file(MemorySegment struct) { + return struct.asSlice(file$OFFSET, file$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * int line; + * {@snippet lang=c : + * char file[256] * } */ - public static void line$set(MemorySegment seg, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg, x); + public static void file(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, file$OFFSET, file$LAYOUT.byteSize()); } - public static int line$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg.asSlice(index*sizeof())); + + private static long[] file$DIMS = { 256 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static long[] file$dimensions() { + return file$DIMS; } - public static void line$set(MemorySegment seg, long index, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg.asSlice(index*sizeof()), x); + private static final VarHandle file$ELEM_HANDLE = file$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static byte file(MemorySegment struct, long index0) { + return (byte)file$ELEM_HANDLE.get(struct, 0L, index0); } - public static MemorySegment message$slice(MemorySegment seg) { - return seg.asSlice(516, 1024); + + /** + * Indexed setter for field: + * {@snippet lang=c : + * char file[256] + * } + */ + public static void file(MemorySegment struct, long index0, byte fieldValue) { + file$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + private static final SequenceLayout function$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("function")); + + /** + * Layout for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static final SequenceLayout function$layout() { + return function$LAYOUT; + } + + private static final long function$OFFSET = 256; + + /** + * Offset for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static final long function$offset() { + return function$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static MemorySegment function(MemorySegment struct) { + return struct.asSlice(function$OFFSET, function$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static void function(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, function$OFFSET, function$LAYOUT.byteSize()); + } + + private static long[] function$DIMS = { 256 }; + + /** + * Dimensions for array field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static long[] function$dimensions() { + return function$DIMS; + } + private static final VarHandle function$ELEM_HANDLE = function$LAYOUT.varHandle(sequenceElement()); + + /** + * Indexed getter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static byte function(MemorySegment struct, long index0) { + return (byte)function$ELEM_HANDLE.get(struct, 0L, index0); + } + + /** + * Indexed setter for field: + * {@snippet lang=c : + * char function[256] + * } + */ + public static void function(MemorySegment struct, long index0, byte fieldValue) { + function$ELEM_HANDLE.set(struct, 0L, index0, fieldValue); + } + + private static final OfInt line$LAYOUT = (OfInt)$LAYOUT.select(groupElement("line")); + + /** + * Layout for field: + * {@snippet lang=c : + * int line + * } + */ + public static final OfInt line$layout() { + return line$LAYOUT; + } + + private static final long line$OFFSET = 512; + + /** + * Offset for field: + * {@snippet lang=c : + * int line + * } + */ + public static final long line$offset() { + return line$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * int line + * } + */ + public static int line(MemorySegment struct) { + return struct.get(line$LAYOUT, line$OFFSET); + } + + /** + * Setter for field: + * {@snippet lang=c : + * int line + * } + */ + public static void line(MemorySegment struct, int fieldValue) { + struct.set(line$LAYOUT, line$OFFSET, fieldValue); + } + + private static final SequenceLayout message$LAYOUT = (SequenceLayout)$LAYOUT.select(groupElement("message")); + + /** + * Layout for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static final SequenceLayout message$layout() { + return message$LAYOUT; + } + + private static final long message$OFFSET = 516; + + /** + * Offset for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static final long message$offset() { + return message$OFFSET; + } + + /** + * Getter for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static MemorySegment message(MemorySegment struct) { + return struct.asSlice(message$OFFSET, message$LAYOUT.byteSize()); + } + + /** + * Setter for field: + * {@snippet lang=c : + * char message[1024] + * } + */ + public static void message(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, message$OFFSET, message$LAYOUT.byteSize()); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index ced870c07..40f660561 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * void (*sdrplay_api_EventCallback_t)(enum eventId,enum tuner,union * params,void* cbContext); + * {@snippet lang=c : + * typedef void (*sdrplay_api_EventCallback_t)(sdrplay_api_EventT, sdrplay_api_TunerSelectT, sdrplay_api_EventParamsT *, void *) * } */ -public interface sdrplay_api_EventCallback_t { +public class sdrplay_api_EventCallback_t { - void apply(int eventId, int tuner, java.lang.foreign.MemorySegment params, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_EventCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_EventCallback_t_UP$MH, fi, constants$0.sdrplay_api_EventCallback_t$FUNC, scope); + sdrplay_api_EventCallback_t() { + // Should not be called directly } - static sdrplay_api_EventCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _eventId, int _tuner, java.lang.foreign.MemorySegment _params, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_EventCallback_t_DOWN$MH.invokeExact(symbol, _eventId, _tuner, _params, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(int eventId, int tuner, MemorySegment params, MemorySegment cbContext); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.ofVoid( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_EventCallback_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_EventCallback_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static void invoke(MemorySegment funcPtr,int eventId, int tuner, MemorySegment params, MemorySegment cbContext) { + try { + DOWN$MH.invokeExact(funcPtr, eventId, tuner, params, cbContext); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 2782c15a5..736706cb2 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,54 +21,217 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.UnionLayout; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; /** - * {@snippet : + * {@snippet lang=c : * union { * sdrplay_api_GainCbParamT gainParams; * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * }; + * } * } */ public class sdrplay_api_EventParamsT { - static final UnionLayout $union$LAYOUT = MemoryLayout.unionLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ).withName("gainParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ).withName("powerOverloadParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ).withName("rspDuoModeParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_EventParamsT.$union$LAYOUT; - } - public static MemorySegment gainParams$slice(MemorySegment seg) { - return seg.asSlice(0, 16); - } - public static MemorySegment powerOverloadParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static MemorySegment rspDuoModeParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index 7f71a65cd..3ef51f532 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,123 +21,220 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; /** - * {@snippet : + * {@snippet lang=c : * struct { * double fsHz; * unsigned char syncUpdate; * unsigned char reCal; - * }; + * } * } */ public class sdrplay_api_FsFreqT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_FsFreqT.$struct$LAYOUT; + sdrplay_api_FsFreqT() { + // Should not be called directly } - static final VarHandle fsHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsHz")); - public static VarHandle fsHz$VH() { - return sdrplay_api_FsFreqT.fsHz$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_DOUBLE.withName("fsHz"), + sdrplay_api_h.C_CHAR.withName("syncUpdate"), + sdrplay_api_h.C_CHAR.withName("reCal"), + MemoryLayout.paddingLayout(6) + ).withName("$anon$17:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfDouble fsHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("fsHz")); + + /** + * Layout for field: + * {@snippet lang=c : + * double fsHz + * } + */ + public static final OfDouble fsHz$layout() { + return fsHz$LAYOUT; + } + + private static final long fsHz$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * double fsHz + * } + */ + public static final long fsHz$offset() { + return fsHz$OFFSET; } + /** * Getter for field: - * {@snippet : - * double fsHz; + * {@snippet lang=c : + * double fsHz * } */ - public static double fsHz$get(MemorySegment seg) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg); + public static double fsHz(MemorySegment struct) { + return struct.get(fsHz$LAYOUT, fsHz$OFFSET); } + /** * Setter for field: - * {@snippet : - * double fsHz; + * {@snippet lang=c : + * double fsHz * } */ - public static void fsHz$set(MemorySegment seg, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg, x); + public static void fsHz(MemorySegment struct, double fieldValue) { + struct.set(fsHz$LAYOUT, fsHz$OFFSET, fieldValue); } - public static double fsHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_FsFreqT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg, x); - } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + public static void syncUpdate(MemorySegment struct, byte fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle reCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("reCal")); - public static VarHandle reCal$VH() { - return sdrplay_api_FsFreqT.reCal$VH; + + private static final long reCal$OFFSET = 9; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char reCal + * } + */ + public static final long reCal$offset() { + return reCal$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char reCal; + * {@snippet lang=c : + * unsigned char reCal * } */ - public static byte reCal$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg); + public static byte reCal(MemorySegment struct) { + return struct.get(reCal$LAYOUT, reCal$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char reCal; + * {@snippet lang=c : + * unsigned char reCal * } */ - public static void reCal$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg, x); + public static void reCal(MemorySegment struct, byte fieldValue) { + struct.set(reCal$LAYOUT, reCal$OFFSET, fieldValue); } - public static byte reCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void reCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index cfbf28bd2..b47e60642 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,219 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfDouble; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int gRdB; * unsigned int lnaGRdB; * double currGain; - * }; + * } * } */ public class sdrplay_api_GainCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainCbParamT.$struct$LAYOUT; + sdrplay_api_GainCbParamT() { + // Should not be called directly } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainCbParamT.gRdB$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_INT.withName("gRdB"), + sdrplay_api_h.C_INT.withName("lnaGRdB"), + sdrplay_api_h.C_DOUBLE.withName("currGain") + ).withName("$anon$31:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfInt gRdB$LAYOUT = (OfInt)$LAYOUT.select(groupElement("gRdB")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned int gRdB + * } + */ + public static final OfInt gRdB$layout() { + return gRdB$LAYOUT; + } + + private static final long gRdB$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int gRdB + * } + */ + public static final long gRdB$offset() { + return gRdB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned int gRdB; + * {@snippet lang=c : + * unsigned int gRdB * } */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg); + public static int gRdB(MemorySegment struct) { + return struct.get(gRdB$LAYOUT, gRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int gRdB; + * {@snippet lang=c : + * unsigned int gRdB * } */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg, x); + public static void gRdB(MemorySegment struct, int fieldValue) { + struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg.asSlice(index*sizeof())); - } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle lnaGRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("lnaGRdB")); - public static VarHandle lnaGRdB$VH() { - return sdrplay_api_GainCbParamT.lnaGRdB$VH; + + private static final long lnaGRdB$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned int lnaGRdB + * } + */ + public static final long lnaGRdB$offset() { + return lnaGRdB$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned int lnaGRdB; + * {@snippet lang=c : + * unsigned int lnaGRdB * } */ - public static int lnaGRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg); + public static int lnaGRdB(MemorySegment struct) { + return struct.get(lnaGRdB$LAYOUT, lnaGRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int lnaGRdB; + * {@snippet lang=c : + * unsigned int lnaGRdB * } */ - public static void lnaGRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg, x); - } - public static int lnaGRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg.asSlice(index*sizeof())); + public static void lnaGRdB(MemorySegment struct, int fieldValue) { + struct.set(lnaGRdB$LAYOUT, lnaGRdB$OFFSET, fieldValue); } - public static void lnaGRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle currGain$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("currGain")); - public static VarHandle currGain$VH() { - return sdrplay_api_GainCbParamT.currGain$VH; + + private static final long currGain$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * double currGain + * } + */ + public static final long currGain$offset() { + return currGain$OFFSET; } + /** * Getter for field: - * {@snippet : - * double currGain; + * {@snippet lang=c : + * double currGain * } */ - public static double currGain$get(MemorySegment seg) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg); + public static double currGain(MemorySegment struct) { + return struct.get(currGain$LAYOUT, currGain$OFFSET); } + /** * Setter for field: - * {@snippet : - * double currGain; + * {@snippet lang=c : + * double currGain * } */ - public static void currGain$set(MemorySegment seg, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg, x); + public static void currGain(MemorySegment struct, double fieldValue) { + struct.set(currGain$LAYOUT, currGain$OFFSET, fieldValue); } - public static double currGain$get(MemorySegment seg, long index) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void currGain$set(MemorySegment seg, long index, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 252dc2e73..233aa7d31 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,162 +21,312 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * int gRdB; * unsigned char LNAstate; * unsigned char syncUpdate; * sdrplay_api_MinGainReductionT minGr; * sdrplay_api_GainValuesT gainVals; - * }; + * } * } */ public class sdrplay_api_GainT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainT.$struct$LAYOUT; - } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainT.gRdB$VH; + 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 : - * int gRdB; + * {@snippet lang=c : + * int gRdB * } */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg); + public static int gRdB(MemorySegment struct) { + return struct.get(gRdB$LAYOUT, gRdB$OFFSET); } + /** * Setter for field: - * {@snippet : - * int gRdB; + * {@snippet lang=c : + * int gRdB * } */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg, x); - } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg.asSlice(index*sizeof())); + public static void gRdB(MemorySegment struct, int fieldValue) { + struct.set(gRdB$LAYOUT, gRdB$OFFSET, fieldValue); } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle LNAstate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("LNAstate")); - public static VarHandle LNAstate$VH() { - return sdrplay_api_GainT.LNAstate$VH; + + private static final long LNAstate$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char LNAstate + * } + */ + public static final long LNAstate$offset() { + return LNAstate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char LNAstate; + * {@snippet lang=c : + * unsigned char LNAstate * } */ - public static byte LNAstate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg); + public static byte LNAstate(MemorySegment struct) { + return struct.get(LNAstate$LAYOUT, LNAstate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char LNAstate; + * {@snippet lang=c : + * unsigned char LNAstate * } */ - public static void LNAstate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg, x); - } - public static byte LNAstate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg.asSlice(index*sizeof())); + public static void LNAstate(MemorySegment struct, byte fieldValue) { + struct.set(LNAstate$LAYOUT, LNAstate$OFFSET, fieldValue); } - public static void LNAstate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_GainT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 5; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static void syncUpdate(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 void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg, x); + public static final OfInt minGr$layout() { + return minGr$LAYOUT; } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + 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); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - static final VarHandle minGr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("minGr")); - public static VarHandle minGr$VH() { - return sdrplay_api_GainT.minGr$VH; + + private static final 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 : - * sdrplay_api_MinGainReductionT minGr; + * {@snippet lang=c : + * sdrplay_api_GainValuesT gainVals * } */ - public static int minGr$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg); + public static MemorySegment gainVals(MemorySegment struct) { + return struct.asSlice(gainVals$OFFSET, gainVals$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_MinGainReductionT minGr; + * {@snippet lang=c : + * sdrplay_api_GainValuesT gainVals * } */ - public static void minGr$set(MemorySegment seg, int x) { - sdrplay_api_GainT.minGr$VH.set(seg, x); + public static void gainVals(MemorySegment struct, MemorySegment fieldValue) { + MemorySegment.copy(fieldValue, 0L, struct, gainVals$OFFSET, gainVals$LAYOUT.byteSize()); } - public static int minGr$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void minGr$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.minGr$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); + } + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment gainVals$slice(MemorySegment seg) { - return seg.asSlice(12, 12); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index b5e10d6cd..0db1272c8 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfFloat; /** - * {@snippet : + * {@snippet lang=c : * struct { * float curr; * float max; * float min; - * }; + * } * } */ public class sdrplay_api_GainValuesT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainValuesT.$struct$LAYOUT; + sdrplay_api_GainValuesT() { + // Should not be called directly } - static final VarHandle curr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("curr")); - public static VarHandle curr$VH() { - return sdrplay_api_GainValuesT.curr$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_FLOAT.withName("curr"), + sdrplay_api_h.C_FLOAT.withName("max"), + sdrplay_api_h.C_FLOAT.withName("min") + ).withName("$anon$53:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfFloat curr$LAYOUT = (OfFloat)$LAYOUT.select(groupElement("curr")); + + /** + * Layout for field: + * {@snippet lang=c : + * float curr + * } + */ + public static final OfFloat curr$layout() { + return curr$LAYOUT; + } + + private static final long curr$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * float curr + * } + */ + public static final long curr$offset() { + return curr$OFFSET; } + /** * Getter for field: - * {@snippet : - * float curr; + * {@snippet lang=c : + * float curr * } */ - public static float curr$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg); + public static float curr(MemorySegment struct) { + return struct.get(curr$LAYOUT, curr$OFFSET); } + /** * Setter for field: - * {@snippet : - * float curr; + * {@snippet lang=c : + * float curr * } */ - public static void curr$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg, x); + public static void curr(MemorySegment struct, float fieldValue) { + struct.set(curr$LAYOUT, curr$OFFSET, fieldValue); } - public static float curr$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg.asSlice(index*sizeof())); - } - public static void curr$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle max$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("max")); - public static VarHandle max$VH() { - return sdrplay_api_GainValuesT.max$VH; + + private static final long max$OFFSET = 4; + + /** + * Offset for field: + * {@snippet lang=c : + * float max + * } + */ + public static final long max$offset() { + return max$OFFSET; } + /** * Getter for field: - * {@snippet : - * float max; + * {@snippet lang=c : + * float max * } */ - public static float max$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg); + public static float max(MemorySegment struct) { + return struct.get(max$LAYOUT, max$OFFSET); } + /** * Setter for field: - * {@snippet : - * float max; + * {@snippet lang=c : + * float max * } */ - public static void max$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg, x); - } - public static float max$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg.asSlice(index*sizeof())); + public static void max(MemorySegment struct, float fieldValue) { + struct.set(max$LAYOUT, max$OFFSET, fieldValue); } - public static void max$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle min$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("min")); - public static VarHandle min$VH() { - return sdrplay_api_GainValuesT.min$VH; + + private static final long min$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * float min + * } + */ + public static final long min$offset() { + return min$OFFSET; } + /** * Getter for field: - * {@snippet : - * float min; + * {@snippet lang=c : + * float min * } */ - public static float min$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg); + public static float min(MemorySegment struct) { + return struct.get(min$LAYOUT, min$OFFSET); } + /** * Setter for field: - * {@snippet : - * float min; + * {@snippet lang=c : + * float min * } */ - public static void min$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg, x); + public static void min(MemorySegment struct, float fieldValue) { + struct.set(min$LAYOUT, min$OFFSET, fieldValue); } - public static float min$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void min$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 31abe2ff8..27f2ec895 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_GetDeviceParams_t)(void* dev,struct ** deviceParams); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_GetDeviceParams_t)(HANDLE, sdrplay_api_DeviceParamsT **) * } */ -public interface sdrplay_api_GetDeviceParams_t { +public class sdrplay_api_GetDeviceParams_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment deviceParams); - static MemorySegment allocate(sdrplay_api_GetDeviceParams_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_GetDeviceParams_t_UP$MH, fi, constants$4.sdrplay_api_GetDeviceParams_t$FUNC, scope); + sdrplay_api_GetDeviceParams_t() { + // Should not be called directly } - static sdrplay_api_GetDeviceParams_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _deviceParams) -> { - try { - return (int)constants$4.sdrplay_api_GetDeviceParams_t_DOWN$MH.invokeExact(symbol, _dev, _deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment deviceParams); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDeviceParams_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetDeviceParams_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment deviceParams) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, deviceParams); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index b60265196..ca13f2206 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_GetDevices_t)(struct * devices,unsigned int* numDevs,unsigned int maxDevs); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_GetDevices_t)(sdrplay_api_DeviceT *, unsigned int *, unsigned int) * } */ -public interface sdrplay_api_GetDevices_t { +public class sdrplay_api_GetDevices_t { - int apply(java.lang.foreign.MemorySegment devices, java.lang.foreign.MemorySegment numDevs, int maxDevs); - static MemorySegment allocate(sdrplay_api_GetDevices_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_GetDevices_t_UP$MH, fi, constants$2.sdrplay_api_GetDevices_t$FUNC, scope); + sdrplay_api_GetDevices_t() { + // Should not be called directly } - static sdrplay_api_GetDevices_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _devices, java.lang.foreign.MemorySegment _numDevs, int _maxDevs) -> { - try { - return (int)constants$2.sdrplay_api_GetDevices_t_DOWN$MH.invokeExact(symbol, _devices, _numDevs, _maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment devices, MemorySegment numDevs, int maxDevs); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetDevices_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetDevices_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment devices, MemorySegment numDevs, int maxDevs) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, devices, numDevs, maxDevs); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index a59e1e0c4..052714f6c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * char* (*sdrplay_api_GetErrorString_t)(enum err); + * {@snippet lang=c : + * typedef const char *(*sdrplay_api_GetErrorString_t)(sdrplay_api_ErrT) * } */ -public interface sdrplay_api_GetErrorString_t { +public class sdrplay_api_GetErrorString_t { - java.lang.foreign.MemorySegment apply(int err); - static MemorySegment allocate(sdrplay_api_GetErrorString_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetErrorString_t_UP$MH, fi, constants$3.sdrplay_api_GetErrorString_t$FUNC, scope); + sdrplay_api_GetErrorString_t() { + // Should not be called directly } - static sdrplay_api_GetErrorString_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _err) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetErrorString_t_DOWN$MH.invokeExact(symbol, _err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + MemorySegment apply(int err); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_INT + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetErrorString_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetErrorString_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static MemorySegment invoke(MemorySegment funcPtr,int err) { + try { + return (MemorySegment) DOWN$MH.invokeExact(funcPtr, err); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 6ca3c03da..fe3c4c2bc 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * struct * (*sdrplay_api_GetLastError_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrorInfoT *(*sdrplay_api_GetLastError_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_GetLastError_t { +public class sdrplay_api_GetLastError_t { - java.lang.foreign.MemorySegment apply(java.lang.foreign.MemorySegment device); - static MemorySegment allocate(sdrplay_api_GetLastError_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetLastError_t_UP$MH, fi, constants$3.sdrplay_api_GetLastError_t$FUNC, scope); + sdrplay_api_GetLastError_t() { + // Should not be called directly } - static sdrplay_api_GetLastError_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _device) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetLastError_t_DOWN$MH.invokeExact(symbol, _device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + MemorySegment apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_GetLastError_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_GetLastError_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static MemorySegment invoke(MemorySegment funcPtr,MemorySegment device) { + try { + return (MemorySegment) DOWN$MH.invokeExact(funcPtr, device); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 930b6d42e..daf00830d 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,65 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Init_t)(void* dev,struct * callbackFns,void* cbContext); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Init_t)(HANDLE, sdrplay_api_CallbackFnsT *, void *) * } */ -public interface sdrplay_api_Init_t { +public class sdrplay_api_Init_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment callbackFns, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_Init_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Init_t_UP$MH, fi, constants$5.sdrplay_api_Init_t$FUNC, scope); + sdrplay_api_Init_t() { + // Should not be called directly } - static sdrplay_api_Init_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _callbackFns, java.lang.foreign.MemorySegment _cbContext) -> { - try { - return (int)constants$5.sdrplay_api_Init_t_DOWN$MH.invokeExact(symbol, _dev, _callbackFns, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Init_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Init_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment dev, MemorySegment callbackFns, MemorySegment cbContext) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, dev, callbackFns, cbContext); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index e17cced78..e1a7e512d 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_LockDeviceApi_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_LockDeviceApi_t)(void) * } */ -public interface sdrplay_api_LockDeviceApi_t { +public class sdrplay_api_LockDeviceApi_t { - int apply(); - static MemorySegment allocate(sdrplay_api_LockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_LockDeviceApi_t_UP$MH, fi, constants$1.sdrplay_api_LockDeviceApi_t$FUNC, scope); + sdrplay_api_LockDeviceApi_t() { + // Should not be called directly } - static sdrplay_api_LockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_LockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_LockDeviceApi_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_LockDeviceApi_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 7a69321e6..0e78a5568 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_Open_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Open_t)(void) * } */ -public interface sdrplay_api_Open_t { +public class sdrplay_api_Open_t { - int apply(); - static MemorySegment allocate(sdrplay_api_Open_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_Open_t_UP$MH, fi, constants$0.sdrplay_api_Open_t$FUNC, scope); + sdrplay_api_Open_t() { + // Should not be called directly } - static sdrplay_api_Open_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$0.sdrplay_api_Open_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_Open_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_Open_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr) { + try { + return (int) DOWN$MH.invokeExact(funcPtr); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 089b45acd..33e82fff5 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,126 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfInt; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * }; + * } * } */ public class sdrplay_api_PowerOverloadCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_PowerOverloadCbParamT.$struct$LAYOUT; + sdrplay_api_PowerOverloadCbParamT() { + // Should not be called directly } - static final VarHandle powerOverloadChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("powerOverloadChangeType")); - public static VarHandle powerOverloadChangeType$VH() { - return sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_INT.withName("powerOverloadChangeType") + ).withName("$anon$38:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfInt powerOverloadChangeType$LAYOUT = (OfInt)$LAYOUT.select(groupElement("powerOverloadChangeType")); + + /** + * Layout for field: + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType + * } + */ + public static final OfInt powerOverloadChangeType$layout() { + return powerOverloadChangeType$LAYOUT; + } + + private static final long powerOverloadChangeType$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType + * } + */ + public static final long powerOverloadChangeType$offset() { + return powerOverloadChangeType$OFFSET; + } + /** * Getter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType * } */ - public static int powerOverloadChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg); + public static int powerOverloadChangeType(MemorySegment struct) { + return struct.get(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; + * {@snippet lang=c : + * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType * } */ - public static void powerOverloadChangeType$set(MemorySegment seg, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg, x); + public static void powerOverloadChangeType(MemorySegment struct, int fieldValue) { + struct.set(powerOverloadChangeType$LAYOUT, powerOverloadChangeType$OFFSET, fieldValue); } - public static int powerOverloadChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void powerOverloadChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index e3b15377e..80ee1c061 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.foreign.Arena; +import java.lang.foreign.FunctionDescriptor; +import java.lang.foreign.Linker; import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.MethodHandle; /** - * {@snippet : - * enum (*sdrplay_api_ReleaseDevice_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_ReleaseDevice_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_ReleaseDevice_t { +public class sdrplay_api_ReleaseDevice_t { - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_ReleaseDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_ReleaseDevice_t_UP$MH, fi, constants$3.sdrplay_api_ReleaseDevice_t$FUNC, scope); + sdrplay_api_ReleaseDevice_t() { + // Should not be called directly } - static sdrplay_api_ReleaseDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$3.sdrplay_api_ReleaseDevice_t_DOWN$MH.invokeExact(symbol, _dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_ReleaseDevice_t.Function.class, "apply", $DESC); + + /** + * Allocates a new upcall stub, whose implementation is defined by {@code fi}. + * The lifetime of the returned segment is managed by {@code arena} + */ + public static MemorySegment allocate(sdrplay_api_ReleaseDevice_t.Function fi, Arena arena) { + return Linker.nativeLinker().upcallStub(UP$MH.bindTo(fi), $DESC, arena); + } + + private static final MethodHandle DOWN$MH = Linker.nativeLinker().downcallHandle($DESC); + + /** + * Invoke the upcall stub {@code funcPtr}, with given parameters + */ + public static int invoke(MemorySegment funcPtr,MemorySegment device) { + try { + return (int) DOWN$MH.invokeExact(funcPtr, device); + } catch (Throwable ex$) { + throw new AssertionError("should not reach here", ex$); + } + } +} 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 index 024c77e35..f9f9763e5 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,122 +21,218 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char resetGainUpdate; * unsigned char resetRfUpdate; * unsigned char resetFsUpdate; - * }; + * } * } */ public class sdrplay_api_ResetFlagsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ResetFlagsT.$struct$LAYOUT; + sdrplay_api_ResetFlagsT() { + // Should not be called directly } - static final VarHandle resetGainUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetGainUpdate")); - public static VarHandle resetGainUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetGainUpdate$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("resetGainUpdate"), + sdrplay_api_h.C_CHAR.withName("resetRfUpdate"), + sdrplay_api_h.C_CHAR.withName("resetFsUpdate") + ).withName("$anon$30:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; + } + + private static final OfByte resetGainUpdate$LAYOUT = (OfByte)$LAYOUT.select(groupElement("resetGainUpdate")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char resetGainUpdate + * } + */ + public static final OfByte resetGainUpdate$layout() { + return resetGainUpdate$LAYOUT; + } + + private static final long resetGainUpdate$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetGainUpdate + * } + */ + public static final long resetGainUpdate$offset() { + return resetGainUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetGainUpdate; + * {@snippet lang=c : + * unsigned char resetGainUpdate * } */ - public static byte resetGainUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg); + public static byte resetGainUpdate(MemorySegment struct) { + return struct.get(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetGainUpdate; + * {@snippet lang=c : + * unsigned char resetGainUpdate * } */ - public static void resetGainUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg, x); + public static void resetGainUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetGainUpdate$LAYOUT, resetGainUpdate$OFFSET, fieldValue); } - public static byte resetGainUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetGainUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle resetRfUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetRfUpdate")); - public static VarHandle resetRfUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetRfUpdate$VH; + + private static final long resetRfUpdate$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetRfUpdate + * } + */ + public static final long resetRfUpdate$offset() { + return resetRfUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetRfUpdate; + * {@snippet lang=c : + * unsigned char resetRfUpdate * } */ - public static byte resetRfUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg); + public static byte resetRfUpdate(MemorySegment struct) { + return struct.get(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetRfUpdate; + * {@snippet lang=c : + * unsigned char resetRfUpdate * } */ - public static void resetRfUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg, x); - } - public static byte resetRfUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg.asSlice(index*sizeof())); + public static void resetRfUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetRfUpdate$LAYOUT, resetRfUpdate$OFFSET, fieldValue); } - public static void resetRfUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle resetFsUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetFsUpdate")); - public static VarHandle resetFsUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetFsUpdate$VH; + + private static final long resetFsUpdate$OFFSET = 2; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char resetFsUpdate + * } + */ + public static final long resetFsUpdate$offset() { + return resetFsUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char resetFsUpdate; + * {@snippet lang=c : + * unsigned char resetFsUpdate * } */ - public static byte resetFsUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg); + public static byte resetFsUpdate(MemorySegment struct) { + return struct.get(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char resetFsUpdate; + * {@snippet lang=c : + * unsigned char resetFsUpdate * } */ - public static void resetFsUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg, x); + public static void resetFsUpdate(MemorySegment struct, byte fieldValue) { + struct.set(resetFsUpdate$LAYOUT, resetFsUpdate$OFFSET, fieldValue); } - public static byte resetFsUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void resetFsUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 4560e9c42..301c9fc85 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,93 +21,174 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; +import static java.lang.foreign.ValueLayout.OfDouble; /** - * {@snippet : + * {@snippet lang=c : * struct { * double rfHz; * unsigned char syncUpdate; - * }; + * } * } */ public class sdrplay_api_RfFreqT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RfFreqT.$struct$LAYOUT; + sdrplay_api_RfFreqT() { + // Should not be called directly + } + + 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; } - static final VarHandle rfHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfHz")); - public static VarHandle rfHz$VH() { - return sdrplay_api_RfFreqT.rfHz$VH; + + private static final OfDouble rfHz$LAYOUT = (OfDouble)$LAYOUT.select(groupElement("rfHz")); + + /** + * Layout for field: + * {@snippet lang=c : + * double rfHz + * } + */ + public static final OfDouble rfHz$layout() { + return rfHz$LAYOUT; } + + private static final long rfHz$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * double rfHz + * } + */ + public static final long rfHz$offset() { + return rfHz$OFFSET; + } + /** * Getter for field: - * {@snippet : - * double rfHz; + * {@snippet lang=c : + * double rfHz * } */ - public static double rfHz$get(MemorySegment seg) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg); + public static double rfHz(MemorySegment struct) { + return struct.get(rfHz$LAYOUT, rfHz$OFFSET); } + /** * Setter for field: - * {@snippet : - * double rfHz; + * {@snippet lang=c : + * double rfHz * } */ - public static void rfHz$set(MemorySegment seg, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg, x); - } - public static double rfHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg.asSlice(index*sizeof())); + public static void rfHz(MemorySegment struct, double fieldValue) { + struct.set(rfHz$LAYOUT, rfHz$OFFSET, fieldValue); } - public static void rfHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_RfFreqT.syncUpdate$VH; + + private static final long syncUpdate$OFFSET = 8; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char syncUpdate + * } + */ + public static final long syncUpdate$offset() { + return syncUpdate$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg); + public static byte syncUpdate(MemorySegment struct) { + return struct.get(syncUpdate$LAYOUT, syncUpdate$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char syncUpdate; + * {@snippet lang=c : + * unsigned char syncUpdate * } */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg, x); + public static void syncUpdate(MemorySegment struct, byte fieldValue) { + struct.set(syncUpdate$LAYOUT, syncUpdate$OFFSET, fieldValue); } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index f64a365ff..3176ade04 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,92 +21,172 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_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.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.util.function.Consumer; + +import static java.lang.foreign.MemoryLayout.PathElement.groupElement; +import static java.lang.foreign.ValueLayout.OfByte; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_Rsp1aParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aParamsT.$struct$LAYOUT; + sdrplay_api_Rsp1aParamsT() { + // Should not be called directly + } + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH; + + private static final OfByte rfNotchEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("rfNotchEnable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char rfNotchEnable + * } + */ + public static final OfByte rfNotchEnable$layout() { + return rfNotchEnable$LAYOUT; } + + private static final long rfNotchEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char rfNotchEnable + * } + */ + public static final long rfNotchEnable$offset() { + return rfNotchEnable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH; + + private static final long rfDabNotchEnable$OFFSET = 1; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char rfDabNotchEnable + * } + */ + public static final long rfDabNotchEnable$offset() { + return rfDabNotchEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 8b3da5f55..c1c55e678 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; - * }; + * } * } */ public class sdrplay_api_Rsp1aTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aTunerParamsT.$struct$LAYOUT; + sdrplay_api_Rsp1aTunerParamsT() { + // Should not be called directly } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("biasTEnable") + ).withName("$anon$17:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfByte biasTEnable$LAYOUT = (OfByte)$LAYOUT.select(groupElement("biasTEnable")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final OfByte biasTEnable$layout() { + return biasTEnable$LAYOUT; + } + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index f0d675489..d3bc00dd7 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char extRefOutputEn; - * }; + * } * } */ public class sdrplay_api_Rsp2ParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2ParamsT.$struct$LAYOUT; + sdrplay_api_Rsp2ParamsT() { + // Should not be called directly } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH; + + private static final GroupLayout $LAYOUT = MemoryLayout.structLayout( + sdrplay_api_h.C_CHAR.withName("extRefOutputEn") + ).withName("$anon$22:9"); + + /** + * The layout of this struct + */ + public static final GroupLayout layout() { + return $LAYOUT; } + + private static final OfByte extRefOutputEn$LAYOUT = (OfByte)$LAYOUT.select(groupElement("extRefOutputEn")); + + /** + * Layout for field: + * {@snippet lang=c : + * unsigned char extRefOutputEn + * } + */ + public static final OfByte extRefOutputEn$layout() { + return extRefOutputEn$LAYOUT; + } + + private static final long extRefOutputEn$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char extRefOutputEn + * } + */ + public static final long extRefOutputEn$offset() { + return extRefOutputEn$OFFSET; + } + /** * Getter for field: - * {@snippet : - * unsigned char extRefOutputEn; + * {@snippet lang=c : + * unsigned char extRefOutputEn * } */ - public static byte extRefOutputEn$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg); + public static byte extRefOutputEn(MemorySegment struct) { + return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char extRefOutputEn; + * {@snippet lang=c : + * unsigned char extRefOutputEn * } */ - public static void extRefOutputEn$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg, x); + public static void extRefOutputEn(MemorySegment struct, byte fieldValue) { + struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); } - public static byte extRefOutputEn$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void extRefOutputEn$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 69c8ea651..93b0cb329 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,154 +21,262 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; * sdrplay_api_Rsp2_AmPortSelectT amPortSel; * sdrplay_api_Rsp2_AntennaSelectT antennaSel; * unsigned char rfNotchEnable; - * }; + * } * } */ public class sdrplay_api_Rsp2TunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2TunerParamsT.$struct$LAYOUT; + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH; + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle amPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("amPortSel")); - public static VarHandle amPortSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.amPortSel$VH; + + 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 : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AmPortSelectT amPortSel * } */ - public static int amPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg); + public static int amPortSel(MemorySegment struct) { + return struct.get(amPortSel$LAYOUT, amPortSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AmPortSelectT amPortSel * } */ - public static void amPortSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg, x); + public static void amPortSel(MemorySegment struct, int fieldValue) { + struct.set(amPortSel$LAYOUT, amPortSel$OFFSET, fieldValue); } - public static int amPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void amPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.antennaSel$VH; + + 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 : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AntennaSelectT antennaSel * } */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg); + public static int antennaSel(MemorySegment struct) { + return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_Rsp2_AntennaSelectT antennaSel * } */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); + public static void antennaSel(MemorySegment struct, int fieldValue) { + struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg, x); + 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()); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 125d00a19..781ca76fe 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * }; + * } * } */ public class sdrplay_api_RspDuoModeCbParamT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoModeCbParamT.$struct$LAYOUT; + sdrplay_api_RspDuoModeCbParamT() { + // Should not be called directly } - static final VarHandle modeChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modeChangeType")); - public static VarHandle modeChangeType$VH() { - return sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH; + + 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 : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeCbEventIdT modeChangeType * } */ - public static int modeChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg); + public static int modeChangeType(MemorySegment struct) { + return struct.get(modeChangeType$LAYOUT, modeChangeType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; + * {@snippet lang=c : + * sdrplay_api_RspDuoModeCbEventIdT modeChangeType * } */ - public static void modeChangeType$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg, x); + public static void modeChangeType(MemorySegment struct, int fieldValue) { + struct.set(modeChangeType$LAYOUT, modeChangeType$OFFSET, fieldValue); } - public static int modeChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void modeChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 4b64c2509..774b8d502 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,62 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * int extRefOutputEn; - * }; + * } * } */ public class sdrplay_api_RspDuoParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoParamsT.$struct$LAYOUT; + sdrplay_api_RspDuoParamsT() { + // Should not be called directly } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_RspDuoParamsT.extRefOutputEn$VH; + + 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 : - * int extRefOutputEn; + * {@snippet lang=c : + * int extRefOutputEn * } */ - public static int extRefOutputEn$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg); + public static int extRefOutputEn(MemorySegment struct) { + return struct.get(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET); } + /** * Setter for field: - * {@snippet : - * int extRefOutputEn; + * {@snippet lang=c : + * int extRefOutputEn * } */ - public static void extRefOutputEn$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg, x); + public static void extRefOutputEn(MemorySegment struct, int fieldValue) { + struct.set(extRefOutputEn$LAYOUT, extRefOutputEn$OFFSET, fieldValue); } - public static int extRefOutputEn$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void extRefOutputEn$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 7f8e7a634..e72044de0 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,184 +21,308 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; +import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char biasTEnable; * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; * unsigned char tuner1AmNotchEnable; * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_RspDuoTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(8) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoTunerParamsT.$struct$LAYOUT; + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH; + + private static final long biasTEnable$OFFSET = 0; + + /** + * Offset for field: + * {@snippet lang=c : + * unsigned char biasTEnable + * } + */ + public static final long biasTEnable$offset() { + return biasTEnable$OFFSET; } + /** * Getter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle tuner1AmPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmPortSel")); - public static VarHandle tuner1AmPortSel$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH; + + 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 : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; + * {@snippet lang=c : + * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel * } */ - public static int tuner1AmPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg); + public static int tuner1AmPortSel(MemorySegment struct) { + return struct.get(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; + * {@snippet lang=c : + * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel * } */ - public static void tuner1AmPortSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg, x); + public static void tuner1AmPortSel(MemorySegment struct, int fieldValue) { + struct.set(tuner1AmPortSel$LAYOUT, tuner1AmPortSel$OFFSET, fieldValue); } - public static int tuner1AmPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner1AmPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle tuner1AmNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmNotchEnable")); - public static VarHandle tuner1AmNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH; + + 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 : - * unsigned char tuner1AmNotchEnable; + * {@snippet lang=c : + * unsigned char tuner1AmNotchEnable * } */ - public static byte tuner1AmNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg); + public static byte tuner1AmNotchEnable(MemorySegment struct) { + return struct.get(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char tuner1AmNotchEnable; + * {@snippet lang=c : + * unsigned char tuner1AmNotchEnable * } */ - public static void tuner1AmNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg, x); - } - public static byte tuner1AmNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg.asSlice(index*sizeof())); + public static void tuner1AmNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(tuner1AmNotchEnable$LAYOUT, tuner1AmNotchEnable$OFFSET, fieldValue); } - public static void tuner1AmNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg, x); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH; + + 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 : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 5745922f1..1c571b987 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,180 +21,308 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned char hdrEnable; * unsigned char biasTEnable; * sdrplay_api_RspDx_AntennaSelectT antennaSel; * unsigned char rfNotchEnable; * unsigned char rfDabNotchEnable; - * }; + * } * } */ public class sdrplay_api_RspDxParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxParamsT.$struct$LAYOUT; + 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; } - static final VarHandle hdrEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrEnable")); - public static VarHandle hdrEnable$VH() { - return sdrplay_api_RspDxParamsT.hdrEnable$VH; + + 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 : - * unsigned char hdrEnable; + * {@snippet lang=c : + * unsigned char hdrEnable * } */ - public static byte hdrEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg); + public static byte hdrEnable(MemorySegment struct) { + return struct.get(hdrEnable$LAYOUT, hdrEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char hdrEnable; + * {@snippet lang=c : + * unsigned char hdrEnable * } */ - public static void hdrEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg, x); - } - public static byte hdrEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg.asSlice(index*sizeof())); + public static void hdrEnable(MemorySegment struct, byte fieldValue) { + struct.set(hdrEnable$LAYOUT, hdrEnable$OFFSET, fieldValue); } - public static void hdrEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDxParamsT.biasTEnable$VH; + + 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 : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg); + public static byte biasTEnable(MemorySegment struct) { + return struct.get(biasTEnable$LAYOUT, biasTEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char biasTEnable; + * {@snippet lang=c : + * unsigned char biasTEnable * } */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg, x); + public static void biasTEnable(MemorySegment struct, byte fieldValue) { + struct.set(biasTEnable$LAYOUT, biasTEnable$OFFSET, fieldValue); } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_RspDxParamsT.antennaSel$VH; + + 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 : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_RspDx_AntennaSelectT antennaSel * } */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg); + public static int antennaSel(MemorySegment struct) { + return struct.get(antennaSel$LAYOUT, antennaSel$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; + * {@snippet lang=c : + * sdrplay_api_RspDx_AntennaSelectT antennaSel * } */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); + public static void antennaSel(MemorySegment struct, int fieldValue) { + struct.set(antennaSel$LAYOUT, antennaSel$OFFSET, fieldValue); } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfNotchEnable$VH; + + 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 : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg); + public static byte rfNotchEnable(MemorySegment struct) { + return struct.get(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; + * {@snippet lang=c : + * unsigned char rfNotchEnable * } */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg, x); + public static void rfNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfNotchEnable$LAYOUT, rfNotchEnable$OFFSET, fieldValue); } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH; + + 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 : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg); + public static byte rfDabNotchEnable(MemorySegment struct) { + return struct.get(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; + * {@snippet lang=c : + * unsigned char rfDabNotchEnable * } */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg, x); + public static void rfDabNotchEnable(MemorySegment struct, byte fieldValue) { + struct.set(rfDabNotchEnable$LAYOUT, rfDabNotchEnable$OFFSET, fieldValue); } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 3a4df9baf..f342f388c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,58 +21,122 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * }; + * } * } */ public class sdrplay_api_RspDxTunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxTunerParamsT.$struct$LAYOUT; + sdrplay_api_RspDxTunerParamsT() { + // Should not be called directly } - static final VarHandle hdrBw$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrBw")); - public static VarHandle hdrBw$VH() { - return sdrplay_api_RspDxTunerParamsT.hdrBw$VH; + + 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 : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; + * {@snippet lang=c : + * sdrplay_api_RspDx_HdrModeBwT hdrBw * } */ - public static int hdrBw$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg); + public static int hdrBw(MemorySegment struct) { + return struct.get(hdrBw$LAYOUT, hdrBw$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; + * {@snippet lang=c : + * sdrplay_api_RspDx_HdrModeBwT hdrBw * } */ - public static void hdrBw$set(MemorySegment seg, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg, x); + public static void hdrBw(MemorySegment struct, int fieldValue) { + struct.set(hdrBw$LAYOUT, hdrBw$OFFSET, fieldValue); } - public static int hdrBw$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); + } + + /** + * 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())); } - public static void hdrBw$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index a4a361d79..96becf399 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,9 +22,12 @@ 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 : + * {@snippet lang=c : * struct { * sdrplay_api_TunerParamsT tunerParams; * sdrplay_api_ControlParamsT ctrlParams; @@ -32,118 +35,339 @@ * sdrplay_api_Rsp2TunerParamsT rsp2TunerParams; * sdrplay_api_RspDuoTunerParamsT rspDuoTunerParams; * sdrplay_api_RspDxTunerParamsT rspDxTunerParams; - * }; + * } * } */ public class sdrplay_api_RxChannelParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ).withName("tunerParams"), - MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ).withName("ctrlParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ).withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ).withName("rsp2TunerParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(8) - ).withName("rspDuoTunerParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ).withName("rspDxTunerParams"), - MemoryLayout.paddingLayout(32) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RxChannelParamsT.$struct$LAYOUT; - } - public static MemorySegment tunerParams$slice(MemorySegment seg) { - return seg.asSlice(0, 72); - } - public static MemorySegment ctrlParams$slice(MemorySegment seg) { - return seg.asSlice(72, 32); - } - public static MemorySegment rsp1aTunerParams$slice(MemorySegment seg) { - return seg.asSlice(104, 1); - } - public static MemorySegment rsp2TunerParams$slice(MemorySegment seg) { - return seg.asSlice(108, 16); - } - public static MemorySegment rspDuoTunerParams$slice(MemorySegment seg) { - return seg.asSlice(124, 12); - } - public static MemorySegment rspDxTunerParams$slice(MemorySegment seg) { - return seg.asSlice(136, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + 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 index 35d3f1af3..1cf4652d6 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,60 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SelectDevice_t)(struct * device); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SelectDevice_t)(sdrplay_api_DeviceT *) * } */ -public interface sdrplay_api_SelectDevice_t { +public class sdrplay_api_SelectDevice_t { - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_SelectDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_SelectDevice_t_UP$MH, fi, constants$2.sdrplay_api_SelectDevice_t$FUNC, scope); + sdrplay_api_SelectDevice_t() { + // Should not be called directly } - static sdrplay_api_SelectDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$2.sdrplay_api_SelectDevice_t_DOWN$MH.invokeExact(symbol, _dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment device); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT, + sdrplay_api_h.C_POINTER + ); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_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 index dad01b438..6e49f8ffe 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,64 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * void (*sdrplay_api_StreamCallback_t)(short* xi,short* xq,struct * params,unsigned int numSamples,unsigned int reset,void* cbContext); + * {@snippet lang=c : + * typedef void (*sdrplay_api_StreamCallback_t)(short *, short *, sdrplay_api_StreamCbParamsT *, unsigned int, unsigned int, void *) * } */ -public interface sdrplay_api_StreamCallback_t { +public class sdrplay_api_StreamCallback_t { - void apply(java.lang.foreign.MemorySegment xi, java.lang.foreign.MemorySegment xq, java.lang.foreign.MemorySegment params, int numSamples, int reset, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_StreamCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_StreamCallback_t_UP$MH, fi, constants$0.sdrplay_api_StreamCallback_t$FUNC, scope); + sdrplay_api_StreamCallback_t() { + // Should not be called directly } - static sdrplay_api_StreamCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _xi, java.lang.foreign.MemorySegment _xq, java.lang.foreign.MemorySegment _params, int _numSamples, int _reset, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_StreamCallback_t_DOWN$MH.invokeExact(symbol, _xi, _xq, _params, _numSamples, _reset, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + void apply(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 index 13575852f..19d33d4f7 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,178 +21,306 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int firstSampleNum; * int grChanged; * int rfChanged; * int fsChanged; * unsigned int numSamples; - * }; + * } * } */ public class sdrplay_api_StreamCbParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("firstSampleNum"), - Constants$root.C_INT$LAYOUT.withName("grChanged"), - Constants$root.C_INT$LAYOUT.withName("rfChanged"), - Constants$root.C_INT$LAYOUT.withName("fsChanged"), - Constants$root.C_INT$LAYOUT.withName("numSamples") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_StreamCbParamsT.$struct$LAYOUT; + 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; } - static final VarHandle firstSampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("firstSampleNum")); - public static VarHandle firstSampleNum$VH() { - return sdrplay_api_StreamCbParamsT.firstSampleNum$VH; + + 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 : - * unsigned int firstSampleNum; + * {@snippet lang=c : + * unsigned int firstSampleNum * } */ - public static int firstSampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg); + public static int firstSampleNum(MemorySegment struct) { + return struct.get(firstSampleNum$LAYOUT, firstSampleNum$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int firstSampleNum; + * {@snippet lang=c : + * unsigned int firstSampleNum * } */ - public static void firstSampleNum$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg, x); - } - public static int firstSampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg.asSlice(index*sizeof())); + public static void firstSampleNum(MemorySegment struct, int fieldValue) { + struct.set(firstSampleNum$LAYOUT, firstSampleNum$OFFSET, fieldValue); } - public static void firstSampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle grChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("grChanged")); - public static VarHandle grChanged$VH() { - return sdrplay_api_StreamCbParamsT.grChanged$VH; + + 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 : - * int grChanged; + * {@snippet lang=c : + * int grChanged * } */ - public static int grChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg); + public static int grChanged(MemorySegment struct) { + return struct.get(grChanged$LAYOUT, grChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int grChanged; + * {@snippet lang=c : + * int grChanged * } */ - public static void grChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg, x); + public static void grChanged(MemorySegment struct, int fieldValue) { + struct.set(grChanged$LAYOUT, grChanged$OFFSET, fieldValue); } - public static int grChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void grChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle rfChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfChanged")); - public static VarHandle rfChanged$VH() { - return sdrplay_api_StreamCbParamsT.rfChanged$VH; + + 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 : - * int rfChanged; + * {@snippet lang=c : + * int rfChanged * } */ - public static int rfChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg); + public static int rfChanged(MemorySegment struct) { + return struct.get(rfChanged$LAYOUT, rfChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int rfChanged; + * {@snippet lang=c : + * int rfChanged * } */ - public static void rfChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg, x); - } - public static int rfChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg.asSlice(index*sizeof())); + public static void rfChanged(MemorySegment struct, int fieldValue) { + struct.set(rfChanged$LAYOUT, rfChanged$OFFSET, fieldValue); } - public static void rfChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle fsChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsChanged")); - public static VarHandle fsChanged$VH() { - return sdrplay_api_StreamCbParamsT.fsChanged$VH; + + 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 : - * int fsChanged; + * {@snippet lang=c : + * int fsChanged * } */ - public static int fsChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg); + public static int fsChanged(MemorySegment struct) { + return struct.get(fsChanged$LAYOUT, fsChanged$OFFSET); } + /** * Setter for field: - * {@snippet : - * int fsChanged; + * {@snippet lang=c : + * int fsChanged * } */ - public static void fsChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg, x); + public static void fsChanged(MemorySegment struct, int fieldValue) { + struct.set(fsChanged$LAYOUT, fsChanged$OFFSET, fieldValue); } - public static int fsChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle numSamples$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("numSamples")); - public static VarHandle numSamples$VH() { - return sdrplay_api_StreamCbParamsT.numSamples$VH; + + 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 : - * unsigned int numSamples; + * {@snippet lang=c : + * unsigned int numSamples * } */ - public static int numSamples$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg); + public static int numSamples(MemorySegment struct) { + return struct.get(numSamples$LAYOUT, numSamples$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int numSamples; + * {@snippet lang=c : + * unsigned int numSamples * } */ - public static void numSamples$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg, x); + public static void numSamples(MemorySegment struct, int fieldValue) { + struct.set(numSamples$LAYOUT, numSamples$OFFSET, fieldValue); } - public static int numSamples$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void numSamples$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index f0da28f4a..502597797 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,62 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoActiveTuner_t)(void* dev,enum * tuner,enum tuner1AmPortSel); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoActiveTuner_t)(HANDLE, sdrplay_api_TunerSelectT *, sdrplay_api_RspDuo_AmPortSelectT) * } */ -public interface sdrplay_api_SwapRspDuoActiveTuner_t { +public class sdrplay_api_SwapRspDuoActiveTuner_t { - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment tuner, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoActiveTuner_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoActiveTuner_t$FUNC, scope); + sdrplay_api_SwapRspDuoActiveTuner_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoActiveTuner_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _tuner, int _tuner1AmPortSel) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH.invokeExact(symbol, _dev, _tuner, _tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, MemorySegment 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 index 197d610f9..1334c8a25 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,61 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double* currentSampleRate,double newSampleRate); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double *, double) * } */ -public interface sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { +public class sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - int apply(java.lang.foreign.MemorySegment currentSampleRate, double newSampleRate); - static MemorySegment allocate(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC, scope); + sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate, double _newSampleRate) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH.invokeExact(symbol, _currentSampleRate, _newSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment 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 index 6867a345a..abec063cf 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,67 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoMode_t)(struct * currDevice,struct ** deviceParams,enum rspDuoMode,double sampleRate,enum tuner,enum bwType,enum ifType,enum tuner1AmPortSel); + * {@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 interface sdrplay_api_SwapRspDuoMode_t { +public class sdrplay_api_SwapRspDuoMode_t { - int apply(java.lang.foreign.MemorySegment currDevice, java.lang.foreign.MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoMode_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoMode_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoMode_t$FUNC, scope); + sdrplay_api_SwapRspDuoMode_t() { + // Should not be called directly } - static sdrplay_api_SwapRspDuoMode_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currDevice, java.lang.foreign.MemorySegment _deviceParams, int _rspDuoMode, double _sampleRate, int _tuner, int _bwType, int _ifType, int _tuner1AmPortSel) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoMode_t_DOWN$MH.invokeExact(symbol, _currDevice, _deviceParams, _rspDuoMode, _sampleRate, _tuner, _bwType, _ifType, _tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment 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 index ee4ecbff3..f1ebd762e 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,88 +21,168 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * unsigned int sampleNum; * unsigned int period; - * }; + * } * } */ public class sdrplay_api_SyncUpdateT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_SyncUpdateT.$struct$LAYOUT; + 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; } - static final VarHandle sampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("sampleNum")); - public static VarHandle sampleNum$VH() { - return sdrplay_api_SyncUpdateT.sampleNum$VH; + + 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 : - * unsigned int sampleNum; + * {@snippet lang=c : + * unsigned int sampleNum * } */ - public static int sampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg); + public static int sampleNum(MemorySegment struct) { + return struct.get(sampleNum$LAYOUT, sampleNum$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int sampleNum; + * {@snippet lang=c : + * unsigned int sampleNum * } */ - public static void sampleNum$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg, x); - } - public static int sampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg.asSlice(index*sizeof())); + public static void sampleNum(MemorySegment struct, int fieldValue) { + struct.set(sampleNum$LAYOUT, sampleNum$OFFSET, fieldValue); } - public static void sampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle period$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("period")); - public static VarHandle period$VH() { - return sdrplay_api_SyncUpdateT.period$VH; + + 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 : - * unsigned int period; + * {@snippet lang=c : + * unsigned int period * } */ - public static int period$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg); + public static int period(MemorySegment struct) { + return struct.get(period$LAYOUT, period$OFFSET); } + /** * Setter for field: - * {@snippet : - * unsigned int period; + * {@snippet lang=c : + * unsigned int period * } */ - public static void period$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg, x); + public static void period(MemorySegment struct, int fieldValue) { + struct.set(period$LAYOUT, period$OFFSET, fieldValue); } - public static int period$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg.asSlice(index*sizeof())); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static void period$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * The size (in bytes) of this struct + */ + public static long sizeof() { return layout().byteSize(); } + + /** + * Allocate a segment of size {@code layout().byteSize()} using {@code allocator} + */ + public static MemorySegment allocate(SegmentAllocator allocator) { + return allocator.allocate(layout()); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Allocate an array of size {@code elementCount} using {@code allocator}. + * The returned segment has size {@code elementCount * layout().byteSize()}. + */ + public static MemorySegment allocateArray(long elementCount, SegmentAllocator allocator) { + return allocator.allocate(MemoryLayout.sequenceLayout(elementCount, layout())); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} + /** + * 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 index 401ea6f6a..ae3627d4c 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,11 +21,14 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.invoke.VarHandle; import java.lang.foreign.*; +import java.util.function.*; + +import static java.lang.foreign.ValueLayout.*; +import static java.lang.foreign.MemoryLayout.PathElement.*; /** - * {@snippet : + * {@snippet lang=c : * struct { * sdrplay_api_Bw_MHzT bwType; * sdrplay_api_If_kHzT ifType; @@ -33,144 +36,339 @@ * sdrplay_api_GainT gain; * sdrplay_api_RfFreqT rfFreq; * sdrplay_api_DcOffsetTunerT dcOffsetTuner; - * }; + * } * } */ public class sdrplay_api_TunerParamsT { - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_TunerParamsT.$struct$LAYOUT; - } - static final VarHandle bwType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("bwType")); - public static VarHandle bwType$VH() { - return sdrplay_api_TunerParamsT.bwType$VH; + 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 : - * sdrplay_api_Bw_MHzT bwType; + * {@snippet lang=c : + * sdrplay_api_Bw_MHzT bwType * } */ - public static int bwType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg); + public static int bwType(MemorySegment struct) { + return struct.get(bwType$LAYOUT, bwType$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_Bw_MHzT bwType; + * {@snippet lang=c : + * sdrplay_api_Bw_MHzT bwType * } */ - public static void bwType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg, x); + public static void bwType(MemorySegment struct, int fieldValue) { + struct.set(bwType$LAYOUT, bwType$OFFSET, fieldValue); } - public static int bwType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void bwType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle ifType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ifType")); - public static VarHandle ifType$VH() { - return sdrplay_api_TunerParamsT.ifType$VH; + + /** + * 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 : - * sdrplay_api_If_kHzT ifType; + * {@snippet lang=c : + * sdrplay_api_LoModeT loMode * } */ - public static int ifType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg); + public static int loMode(MemorySegment struct) { + return struct.get(loMode$LAYOUT, loMode$OFFSET); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_If_kHzT ifType; + * {@snippet lang=c : + * sdrplay_api_LoModeT loMode * } */ - public static void ifType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg, x); + public static void loMode(MemorySegment struct, int fieldValue) { + struct.set(loMode$LAYOUT, loMode$OFFSET, fieldValue); } - public static int ifType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg.asSlice(index*sizeof())); + + 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; } - public static void ifType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg.asSlice(index*sizeof()), x); + + 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; } - static final VarHandle loMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("loMode")); - public static VarHandle loMode$VH() { - return sdrplay_api_TunerParamsT.loMode$VH; + + /** + * 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 : - * sdrplay_api_LoModeT loMode; + * {@snippet lang=c : + * sdrplay_api_RfFreqT rfFreq * } */ - public static int loMode$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg); + public static MemorySegment rfFreq(MemorySegment struct) { + return struct.asSlice(rfFreq$OFFSET, rfFreq$LAYOUT.byteSize()); } + /** * Setter for field: - * {@snippet : - * sdrplay_api_LoModeT loMode; + * {@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 void loMode$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg, x); + public static final long dcOffsetTuner$offset() { + return dcOffsetTuner$OFFSET; } - public static int loMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg.asSlice(index*sizeof())); + + /** + * Getter for field: + * {@snippet lang=c : + * sdrplay_api_DcOffsetTunerT dcOffsetTuner + * } + */ + public static MemorySegment dcOffsetTuner(MemorySegment struct) { + return struct.asSlice(dcOffsetTuner$OFFSET, dcOffsetTuner$LAYOUT.byteSize()); } - public static void loMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg.asSlice(index*sizeof()), x); + + /** + * 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()); } - public static MemorySegment gain$slice(MemorySegment seg) { - return seg.asSlice(12, 24); + + /** + * Obtains a slice of {@code arrayParam} which selects the array element at {@code index}. + * The returned segment has address {@code arrayParam.address() + index * layout().byteSize()} + */ + public static MemorySegment asSlice(MemorySegment array, long index) { + return array.asSlice(layout().byteSize() * index); } - public static MemorySegment rfFreq$slice(MemorySegment seg) { - return seg.asSlice(40, 16); + + /** + * 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())); } - public static MemorySegment dcOffsetTuner$slice(MemorySegment seg) { - return seg.asSlice(56, 12); + + /** + * 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); } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); + + /** + * Reinterprets {@code addr} using target {@code arena} and {@code cleanupAction} (if any). + * The returned segment has size {@code elementCount * layout().byteSize()} + */ + public static MemorySegment reinterpret(MemorySegment addr, long elementCount, Arena arena, Consumer cleanup) { + return addr.reinterpret(layout().byteSize() * elementCount, arena, cleanup); } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } } - 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 index 0a4507a0d..001e1e4a4 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,60 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_Uninit_t)(void* dev); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Uninit_t)(HANDLE) * } */ -public interface sdrplay_api_Uninit_t { +public class sdrplay_api_Uninit_t { - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_Uninit_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Uninit_t_UP$MH, fi, constants$5.sdrplay_api_Uninit_t$FUNC, scope); + sdrplay_api_Uninit_t() { + // Should not be called directly } - static sdrplay_api_Uninit_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$5.sdrplay_api_Uninit_t_DOWN$MH.invokeExact(symbol, _dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev); } -} + 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 index 7bd57da8a..aa8f7fe25 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,29 +21,58 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; +import java.lang.invoke.*; import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_UnlockDeviceApi_t)(); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_UnlockDeviceApi_t)(void) * } */ -public interface sdrplay_api_UnlockDeviceApi_t { +public class sdrplay_api_UnlockDeviceApi_t { - int apply(); - static MemorySegment allocate(sdrplay_api_UnlockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_UnlockDeviceApi_t_UP$MH, fi, constants$2.sdrplay_api_UnlockDeviceApi_t$FUNC, scope); + sdrplay_api_UnlockDeviceApi_t() { + // Should not be called directly } - static sdrplay_api_UnlockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(); } -} + private static final FunctionDescriptor $DESC = FunctionDescriptor.of( + sdrplay_api_h.C_INT); + + /** + * The descriptor of this function pointer + */ + public static FunctionDescriptor descriptor() { + return $DESC; + } + + private static final MethodHandle UP$MH = sdrplay_api_h.upcallHandle(sdrplay_api_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 index 9a074ffc8..0b6e24265 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,30 +21,63 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; +import java.lang.invoke.*; +import java.lang.foreign.*; /** - * {@snippet : - * enum (*sdrplay_api_Update_t)(void* dev,enum tuner,enum reasonForUpdate,enum reasonForUpdateExt1); + * {@snippet lang=c : + * typedef sdrplay_api_ErrT (*sdrplay_api_Update_t)(HANDLE, sdrplay_api_TunerSelectT, sdrplay_api_ReasonForUpdateT, sdrplay_api_ReasonForUpdateExtension1T) * } */ -public interface sdrplay_api_Update_t { +public class sdrplay_api_Update_t { - int apply(java.lang.foreign.MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - static MemorySegment allocate(sdrplay_api_Update_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Update_t_UP$MH, fi, constants$5.sdrplay_api_Update_t$FUNC, scope); + sdrplay_api_Update_t() { + // Should not be called directly } - static sdrplay_api_Update_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _tuner, int _reasonForUpdate, int _reasonForUpdateExt1) -> { - try { - return (int)constants$5.sdrplay_api_Update_t_DOWN$MH.invokeExact(symbol, _dev, _tuner, _reasonForUpdate, _reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; + + /** + * The function pointer signature, expressed as a functional interface + */ + public interface Function { + int apply(MemorySegment dev, int 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 index 71b72987c..a402c2ffb 100644 --- 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 @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,1349 +21,1584 @@ package io.github.dsheirer.source.tuner.sdrplay.api.v3_08; -import static java.lang.foreign.ValueLayout.OfAddress; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -public class sdrplay_api_h { +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; - public static final OfByte C_CHAR = Constants$root.C_CHAR$LAYOUT; - public static final OfShort C_SHORT = Constants$root.C_SHORT$LAYOUT; - public static final OfInt C_INT = Constants$root.C_INT$LAYOUT; - public static final OfLong C_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfLong C_LONG_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfFloat C_FLOAT = Constants$root.C_FLOAT$LAYOUT; - public static final OfDouble C_DOUBLE = Constants$root.C_DOUBLE$LAYOUT; - public static final OfAddress C_POINTER = Constants$root.C_POINTER$LAYOUT; - /** - * {@snippet : +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) { + 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) + { + 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 (int)10L; + return RSPIA_NUM_LNA_STATES; } + private static final int RSPIA_NUM_LNA_STATES_AM = (int)7L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPIA_NUM_LNA_STATES_AM 7 * } */ public static int RSPIA_NUM_LNA_STATES_AM() { - return (int)7L; + return RSPIA_NUM_LNA_STATES_AM; } + private static final int RSPIA_NUM_LNA_STATES_LBAND = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPIA_NUM_LNA_STATES_LBAND 9 * } */ public static int RSPIA_NUM_LNA_STATES_LBAND() { - return (int)9L; + return RSPIA_NUM_LNA_STATES_LBAND; } + private static final int RSPII_NUM_LNA_STATES = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES 9 * } */ public static int RSPII_NUM_LNA_STATES() { - return (int)9L; + return RSPII_NUM_LNA_STATES; } + private static final int RSPII_NUM_LNA_STATES_AMPORT = (int)5L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES_AMPORT 5 * } */ public static int RSPII_NUM_LNA_STATES_AMPORT() { - return (int)5L; + return RSPII_NUM_LNA_STATES_AMPORT; } + private static final int RSPII_NUM_LNA_STATES_420MHZ = (int)6L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPII_NUM_LNA_STATES_420MHZ 6 * } */ public static int RSPII_NUM_LNA_STATES_420MHZ() { - return (int)6L; + return RSPII_NUM_LNA_STATES_420MHZ; } + private static final int RSPDUO_NUM_LNA_STATES = (int)10L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES 10 * } */ public static int RSPDUO_NUM_LNA_STATES() { - return (int)10L; + return RSPDUO_NUM_LNA_STATES; } + private static final int RSPDUO_NUM_LNA_STATES_AMPORT = (int)5L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 * } */ public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return (int)5L; + return RSPDUO_NUM_LNA_STATES_AMPORT; } + private static final int RSPDUO_NUM_LNA_STATES_AM = (int)7L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_AM 7 * } */ public static int RSPDUO_NUM_LNA_STATES_AM() { - return (int)7L; + return RSPDUO_NUM_LNA_STATES_AM; } + private static final int RSPDUO_NUM_LNA_STATES_LBAND = (int)9L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDUO_NUM_LNA_STATES_LBAND 9 * } */ public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return (int)9L; + return RSPDUO_NUM_LNA_STATES_LBAND; } + private static final int RSPDX_NUM_LNA_STATES = (int)28L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES 28 * } */ public static int RSPDX_NUM_LNA_STATES() { - return (int)28L; + return RSPDX_NUM_LNA_STATES; } + private static final int RSPDX_NUM_LNA_STATES_AMPORT2_0_12 = (int)19L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 * } */ public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return (int)19L; + return RSPDX_NUM_LNA_STATES_AMPORT2_0_12; } + private static final int RSPDX_NUM_LNA_STATES_AMPORT2_12_60 = (int)20L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_60 20 * } */ public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_60() { - return (int)20L; + return RSPDX_NUM_LNA_STATES_AMPORT2_12_60; } + private static final int RSPDX_NUM_LNA_STATES_VHF_BAND3 = (int)27L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 * } */ public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return (int)27L; + return RSPDX_NUM_LNA_STATES_VHF_BAND3; } + private static final int RSPDX_NUM_LNA_STATES_420MHZ = (int)21L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_420MHZ 21 * } */ public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return (int)21L; + return RSPDX_NUM_LNA_STATES_420MHZ; } + private static final int RSPDX_NUM_LNA_STATES_LBAND = (int)19L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_LBAND 19 * } */ public static int RSPDX_NUM_LNA_STATES_LBAND() { - return (int)19L; + return RSPDX_NUM_LNA_STATES_LBAND; } + private static final int RSPDX_NUM_LNA_STATES_DX = (int)26L; /** - * {@snippet : + * {@snippet lang=c : * #define RSPDX_NUM_LNA_STATES_DX 26 * } */ public static int RSPDX_NUM_LNA_STATES_DX() { - return (int)26L; + return RSPDX_NUM_LNA_STATES_DX; } + private static final int sdrplay_api_Rsp2_ANTENNA_A = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_ANTENNA_A = 5 * } */ public static int sdrplay_api_Rsp2_ANTENNA_A() { - return (int)5L; + return sdrplay_api_Rsp2_ANTENNA_A; } + private static final int sdrplay_api_Rsp2_ANTENNA_B = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_ANTENNA_B = 6 * } */ public static int sdrplay_api_Rsp2_ANTENNA_B() { - return (int)6L; + return sdrplay_api_Rsp2_ANTENNA_B; } + private static final int sdrplay_api_Rsp2_AMPORT_1 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_AMPORT_1 = 1 * } */ public static int sdrplay_api_Rsp2_AMPORT_1() { - return (int)1L; + return sdrplay_api_Rsp2_AMPORT_1; } + private static final int sdrplay_api_Rsp2_AMPORT_2 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Rsp2_AMPORT_2 = 0 * } */ public static int sdrplay_api_Rsp2_AMPORT_2() { - return (int)0L; + return sdrplay_api_Rsp2_AMPORT_2; } + private static final int sdrplay_api_RspDuoMode_Unknown = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Unknown = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Unknown = 0 * } */ public static int sdrplay_api_RspDuoMode_Unknown() { - return (int)0L; + return sdrplay_api_RspDuoMode_Unknown; } + private static final int sdrplay_api_RspDuoMode_Single_Tuner = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1 * } */ public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return (int)1L; + return sdrplay_api_RspDuoMode_Single_Tuner; } + private static final int sdrplay_api_RspDuoMode_Dual_Tuner = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2 * } */ public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return (int)2L; + return sdrplay_api_RspDuoMode_Dual_Tuner; } + private static final int sdrplay_api_RspDuoMode_Master = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Master = 4; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Master = 4 * } */ public static int sdrplay_api_RspDuoMode_Master() { - return (int)4L; + return sdrplay_api_RspDuoMode_Master; } + private static final int sdrplay_api_RspDuoMode_Slave = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Slave = 8; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoMode_Slave = 8 * } */ public static int sdrplay_api_RspDuoMode_Slave() { - return (int)8L; + return sdrplay_api_RspDuoMode_Slave; } + private static final int sdrplay_api_RspDuo_AMPORT_1 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuo_AMPORT_1 = 1 * } */ public static int sdrplay_api_RspDuo_AMPORT_1() { - return (int)1L; + return sdrplay_api_RspDuo_AMPORT_1; } + private static final int sdrplay_api_RspDuo_AMPORT_2 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuo_AMPORT_2 = 0 * } */ public static int sdrplay_api_RspDuo_AMPORT_2() { - return (int)0L; + return sdrplay_api_RspDuo_AMPORT_2; } + private static final int sdrplay_api_BW_Undefined = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_BW_Undefined = 0; + * {@snippet lang=c : + * enum .sdrplay_api_BW_Undefined = 0 * } */ public static int sdrplay_api_BW_Undefined() { - return (int)0L; + return sdrplay_api_BW_Undefined; } + private static final int sdrplay_api_BW_0_200 = (int)200L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_200 = 200; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_200 = 200 * } */ public static int sdrplay_api_BW_0_200() { - return (int)200L; + return sdrplay_api_BW_0_200; } + private static final int sdrplay_api_BW_0_300 = (int)300L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_300 = 300; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_300 = 300 * } */ public static int sdrplay_api_BW_0_300() { - return (int)300L; + return sdrplay_api_BW_0_300; } + private static final int sdrplay_api_BW_0_600 = (int)600L; /** - * {@snippet : - * enum .sdrplay_api_BW_0_600 = 600; + * {@snippet lang=c : + * enum .sdrplay_api_BW_0_600 = 600 * } */ public static int sdrplay_api_BW_0_600() { - return (int)600L; + return sdrplay_api_BW_0_600; } + private static final int sdrplay_api_BW_1_536 = (int)1536L; /** - * {@snippet : - * enum .sdrplay_api_BW_1_536 = 1536; + * {@snippet lang=c : + * enum .sdrplay_api_BW_1_536 = 1536 * } */ public static int sdrplay_api_BW_1_536() { - return (int)1536L; + return sdrplay_api_BW_1_536; } + private static final int sdrplay_api_BW_5_000 = (int)5000L; /** - * {@snippet : - * enum .sdrplay_api_BW_5_000 = 5000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_5_000 = 5000 * } */ public static int sdrplay_api_BW_5_000() { - return (int)5000L; + return sdrplay_api_BW_5_000; } + private static final int sdrplay_api_BW_6_000 = (int)6000L; /** - * {@snippet : - * enum .sdrplay_api_BW_6_000 = 6000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_6_000 = 6000 * } */ public static int sdrplay_api_BW_6_000() { - return (int)6000L; + return sdrplay_api_BW_6_000; } + private static final int sdrplay_api_BW_7_000 = (int)7000L; /** - * {@snippet : - * enum .sdrplay_api_BW_7_000 = 7000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_7_000 = 7000 * } */ public static int sdrplay_api_BW_7_000() { - return (int)7000L; + return sdrplay_api_BW_7_000; } + private static final int sdrplay_api_BW_8_000 = (int)8000L; /** - * {@snippet : - * enum .sdrplay_api_BW_8_000 = 8000; + * {@snippet lang=c : + * enum .sdrplay_api_BW_8_000 = 8000 * } */ public static int sdrplay_api_BW_8_000() { - return (int)8000L; + return sdrplay_api_BW_8_000; } + private static final int sdrplay_api_IF_Undefined = (int)-1L; /** - * {@snippet : - * enum .sdrplay_api_IF_Undefined = -1; + * {@snippet lang=c : + * enum .sdrplay_api_IF_Undefined = -1 * } */ public static int sdrplay_api_IF_Undefined() { - return (int)-1L; + return sdrplay_api_IF_Undefined; } + private static final int sdrplay_api_IF_Zero = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_IF_Zero = 0; + * {@snippet lang=c : + * enum .sdrplay_api_IF_Zero = 0 * } */ public static int sdrplay_api_IF_Zero() { - return (int)0L; + return sdrplay_api_IF_Zero; } + private static final int sdrplay_api_IF_0_450 = (int)450L; /** - * {@snippet : - * enum .sdrplay_api_IF_0_450 = 450; + * {@snippet lang=c : + * enum .sdrplay_api_IF_0_450 = 450 * } */ public static int sdrplay_api_IF_0_450() { - return (int)450L; + return sdrplay_api_IF_0_450; } + private static final int sdrplay_api_IF_1_620 = (int)1620L; /** - * {@snippet : - * enum .sdrplay_api_IF_1_620 = 1620; + * {@snippet lang=c : + * enum .sdrplay_api_IF_1_620 = 1620 * } */ public static int sdrplay_api_IF_1_620() { - return (int)1620L; + return sdrplay_api_IF_1_620; } + private static final int sdrplay_api_IF_2_048 = (int)2048L; /** - * {@snippet : - * enum .sdrplay_api_IF_2_048 = 2048; + * {@snippet lang=c : + * enum .sdrplay_api_IF_2_048 = 2048 * } */ public static int sdrplay_api_IF_2_048() { - return (int)2048L; + return sdrplay_api_IF_2_048; } + private static final int sdrplay_api_LO_Undefined = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_LO_Undefined = 0; + * {@snippet lang=c : + * enum .sdrplay_api_LO_Undefined = 0 * } */ public static int sdrplay_api_LO_Undefined() { - return (int)0L; + return sdrplay_api_LO_Undefined; } + private static final int sdrplay_api_LO_Auto = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_LO_Auto = 1; + * {@snippet lang=c : + * enum .sdrplay_api_LO_Auto = 1 * } */ public static int sdrplay_api_LO_Auto() { - return (int)1L; + return sdrplay_api_LO_Auto; } + private static final int sdrplay_api_LO_120MHz = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_LO_120MHz = 2; + * {@snippet lang=c : + * enum .sdrplay_api_LO_120MHz = 2 * } */ public static int sdrplay_api_LO_120MHz() { - return (int)2L; + return sdrplay_api_LO_120MHz; } + private static final int sdrplay_api_LO_144MHz = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_LO_144MHz = 3; + * {@snippet lang=c : + * enum .sdrplay_api_LO_144MHz = 3 * } */ public static int sdrplay_api_LO_144MHz() { - return (int)3L; + return sdrplay_api_LO_144MHz; } + private static final int sdrplay_api_LO_168MHz = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_LO_168MHz = 4; + * {@snippet lang=c : + * enum .sdrplay_api_LO_168MHz = 4 * } */ public static int sdrplay_api_LO_168MHz() { - return (int)4L; + return sdrplay_api_LO_168MHz; } + private static final int sdrplay_api_EXTENDED_MIN_GR = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0; + * {@snippet lang=c : + * enum .sdrplay_api_EXTENDED_MIN_GR = 0 * } */ public static int sdrplay_api_EXTENDED_MIN_GR() { - return (int)0L; + return sdrplay_api_EXTENDED_MIN_GR; } + private static final int sdrplay_api_NORMAL_MIN_GR = (int)20L; /** - * {@snippet : - * enum .sdrplay_api_NORMAL_MIN_GR = 20; + * {@snippet lang=c : + * enum .sdrplay_api_NORMAL_MIN_GR = 20 * } */ public static int sdrplay_api_NORMAL_MIN_GR() { - return (int)20L; + return sdrplay_api_NORMAL_MIN_GR; } + private static final int sdrplay_api_Tuner_Neither = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_Neither = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_Neither = 0 * } */ public static int sdrplay_api_Tuner_Neither() { - return (int)0L; + return sdrplay_api_Tuner_Neither; } + private static final int sdrplay_api_Tuner_A = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_A = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_A = 1 * } */ public static int sdrplay_api_Tuner_A() { - return (int)1L; + return sdrplay_api_Tuner_A; } + private static final int sdrplay_api_Tuner_B = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_B = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_B = 2 * } */ public static int sdrplay_api_Tuner_B() { - return (int)2L; + return sdrplay_api_Tuner_B; } + private static final int sdrplay_api_Tuner_Both = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_Tuner_Both = 3; + * {@snippet lang=c : + * enum .sdrplay_api_Tuner_Both = 3 * } */ public static int sdrplay_api_Tuner_Both() { - return (int)3L; + return sdrplay_api_Tuner_Both; } + private static final int sdrplay_api_RspDx_ANTENNA_A = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_A = 0 * } */ public static int sdrplay_api_RspDx_ANTENNA_A() { - return (int)0L; + return sdrplay_api_RspDx_ANTENNA_A; } + private static final int sdrplay_api_RspDx_ANTENNA_B = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_B = 1 * } */ public static int sdrplay_api_RspDx_ANTENNA_B() { - return (int)1L; + return sdrplay_api_RspDx_ANTENNA_B; } + private static final int sdrplay_api_RspDx_ANTENNA_C = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_ANTENNA_C = 2 * } */ public static int sdrplay_api_RspDx_ANTENNA_C() { - return (int)2L; + return sdrplay_api_RspDx_ANTENNA_C; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_0_200 = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return (int)0L; + return sdrplay_api_RspDx_HDRMODE_BW_0_200; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_0_500 = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return (int)1L; + return sdrplay_api_RspDx_HDRMODE_BW_0_500; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_1_200 = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return (int)2L; + return sdrplay_api_RspDx_HDRMODE_BW_1_200; } + private static final int sdrplay_api_RspDx_HDRMODE_BW_1_700 = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3; + * {@snippet lang=c : + * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3 * } */ public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return (int)3L; + return sdrplay_api_RspDx_HDRMODE_BW_1_700; } + private static final int sdrplay_api_ISOCH = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_ISOCH = 0; + * {@snippet lang=c : + * enum .sdrplay_api_ISOCH = 0 * } */ public static int sdrplay_api_ISOCH() { - return (int)0L; + return sdrplay_api_ISOCH; } + private static final int sdrplay_api_BULK = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_BULK = 1; + * {@snippet lang=c : + * enum .sdrplay_api_BULK = 1 * } */ public static int sdrplay_api_BULK() { - return (int)1L; + return sdrplay_api_BULK; } + private static final int sdrplay_api_AGC_DISABLE = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_AGC_DISABLE = 0; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_DISABLE = 0 * } */ public static int sdrplay_api_AGC_DISABLE() { - return (int)0L; + return sdrplay_api_AGC_DISABLE; } + private static final int sdrplay_api_AGC_100HZ = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_AGC_100HZ = 1; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_100HZ = 1 * } */ public static int sdrplay_api_AGC_100HZ() { - return (int)1L; + return sdrplay_api_AGC_100HZ; } + private static final int sdrplay_api_AGC_50HZ = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_AGC_50HZ = 2; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_50HZ = 2 * } */ public static int sdrplay_api_AGC_50HZ() { - return (int)2L; + return sdrplay_api_AGC_50HZ; } + private static final int sdrplay_api_AGC_5HZ = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_AGC_5HZ = 3; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_5HZ = 3 * } */ public static int sdrplay_api_AGC_5HZ() { - return (int)3L; + return sdrplay_api_AGC_5HZ; } + private static final int sdrplay_api_AGC_CTRL_EN = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_AGC_CTRL_EN = 4; + * {@snippet lang=c : + * enum .sdrplay_api_AGC_CTRL_EN = 4 * } */ public static int sdrplay_api_AGC_CTRL_EN() { - return (int)4L; + return sdrplay_api_AGC_CTRL_EN; } + private static final int sdrplay_api_ADSB_DECIMATION = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_DECIMATION = 0; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_DECIMATION = 0 * } */ public static int sdrplay_api_ADSB_DECIMATION() { - return (int)0L; + return sdrplay_api_ADSB_DECIMATION; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return (int)1L; + return sdrplay_api_ADSB_NO_DECIMATION_LOWPASS; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return (int)2L; + return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ; } + private static final int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3; + * {@snippet lang=c : + * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3 * } */ public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return (int)3L; + return sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ; } + private static final int sdrplay_api_Overload_Detected = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Overload_Detected = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Overload_Detected = 0 * } */ public static int sdrplay_api_Overload_Detected() { - return (int)0L; + return sdrplay_api_Overload_Detected; } + private static final int sdrplay_api_Overload_Corrected = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Overload_Corrected = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Overload_Corrected = 1 * } */ public static int sdrplay_api_Overload_Corrected() { - return (int)1L; + return sdrplay_api_Overload_Corrected; } + private static final int sdrplay_api_MasterInitialised = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_MasterInitialised = 0; + * {@snippet lang=c : + * enum .sdrplay_api_MasterInitialised = 0 * } */ public static int sdrplay_api_MasterInitialised() { - return (int)0L; + return sdrplay_api_MasterInitialised; } + private static final int sdrplay_api_SlaveAttached = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_SlaveAttached = 1; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveAttached = 1 * } */ public static int sdrplay_api_SlaveAttached() { - return (int)1L; + return sdrplay_api_SlaveAttached; } + private static final int sdrplay_api_SlaveDetached = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_SlaveDetached = 2; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveDetached = 2 * } */ public static int sdrplay_api_SlaveDetached() { - return (int)2L; + return sdrplay_api_SlaveDetached; } + private static final int sdrplay_api_SlaveInitialised = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_SlaveInitialised = 3; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveInitialised = 3 * } */ public static int sdrplay_api_SlaveInitialised() { - return (int)3L; + return sdrplay_api_SlaveInitialised; } + private static final int sdrplay_api_SlaveUninitialised = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_SlaveUninitialised = 4; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveUninitialised = 4 * } */ public static int sdrplay_api_SlaveUninitialised() { - return (int)4L; + return sdrplay_api_SlaveUninitialised; } + private static final int sdrplay_api_MasterDllDisappeared = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_MasterDllDisappeared = 5; + * {@snippet lang=c : + * enum .sdrplay_api_MasterDllDisappeared = 5 * } */ public static int sdrplay_api_MasterDllDisappeared() { - return (int)5L; + return sdrplay_api_MasterDllDisappeared; } + private static final int sdrplay_api_SlaveDllDisappeared = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_SlaveDllDisappeared = 6; + * {@snippet lang=c : + * enum .sdrplay_api_SlaveDllDisappeared = 6 * } */ public static int sdrplay_api_SlaveDllDisappeared() { - return (int)6L; + return sdrplay_api_SlaveDllDisappeared; } + private static final int sdrplay_api_GainChange = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_GainChange = 0; + * {@snippet lang=c : + * enum .sdrplay_api_GainChange = 0 * } */ public static int sdrplay_api_GainChange() { - return (int)0L; + return sdrplay_api_GainChange; } + private static final int sdrplay_api_PowerOverloadChange = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_PowerOverloadChange = 1; + * {@snippet lang=c : + * enum .sdrplay_api_PowerOverloadChange = 1 * } */ public static int sdrplay_api_PowerOverloadChange() { - return (int)1L; + return sdrplay_api_PowerOverloadChange; } + private static final int sdrplay_api_DeviceRemoved = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_DeviceRemoved = 2; + * {@snippet lang=c : + * enum .sdrplay_api_DeviceRemoved = 2 * } */ public static int sdrplay_api_DeviceRemoved() { - return (int)2L; + return sdrplay_api_DeviceRemoved; } + private static final int sdrplay_api_RspDuoModeChange = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_RspDuoModeChange = 3; + * {@snippet lang=c : + * enum .sdrplay_api_RspDuoModeChange = 3 * } */ public static int sdrplay_api_RspDuoModeChange() { - return (int)3L; + return sdrplay_api_RspDuoModeChange; } /** - * {@snippet : - * typedef void* HANDLE; + * {@snippet lang=c : + * typedef void *HANDLE * } */ - public static final OfAddress HANDLE = Constants$root.C_POINTER$LAYOUT; + public static final AddressLayout HANDLE = sdrplay_api_h.C_POINTER; + private static final int sdrplay_api_Success = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Success = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Success = 0 * } */ public static int sdrplay_api_Success() { - return (int)0L; + return sdrplay_api_Success; } + private static final int sdrplay_api_Fail = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Fail = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Fail = 1 * } */ public static int sdrplay_api_Fail() { - return (int)1L; + return sdrplay_api_Fail; } + private static final int sdrplay_api_InvalidParam = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_InvalidParam = 2; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidParam = 2 * } */ public static int sdrplay_api_InvalidParam() { - return (int)2L; + return sdrplay_api_InvalidParam; } + private static final int sdrplay_api_OutOfRange = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_OutOfRange = 3; + * {@snippet lang=c : + * enum .sdrplay_api_OutOfRange = 3 * } */ public static int sdrplay_api_OutOfRange() { - return (int)3L; + return sdrplay_api_OutOfRange; } + private static final int sdrplay_api_GainUpdateError = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_GainUpdateError = 4; + * {@snippet lang=c : + * enum .sdrplay_api_GainUpdateError = 4 * } */ public static int sdrplay_api_GainUpdateError() { - return (int)4L; + return sdrplay_api_GainUpdateError; } + private static final int sdrplay_api_RfUpdateError = (int)5L; /** - * {@snippet : - * enum .sdrplay_api_RfUpdateError = 5; + * {@snippet lang=c : + * enum .sdrplay_api_RfUpdateError = 5 * } */ public static int sdrplay_api_RfUpdateError() { - return (int)5L; + return sdrplay_api_RfUpdateError; } + private static final int sdrplay_api_FsUpdateError = (int)6L; /** - * {@snippet : - * enum .sdrplay_api_FsUpdateError = 6; + * {@snippet lang=c : + * enum .sdrplay_api_FsUpdateError = 6 * } */ public static int sdrplay_api_FsUpdateError() { - return (int)6L; + return sdrplay_api_FsUpdateError; } + private static final int sdrplay_api_HwError = (int)7L; /** - * {@snippet : - * enum .sdrplay_api_HwError = 7; + * {@snippet lang=c : + * enum .sdrplay_api_HwError = 7 * } */ public static int sdrplay_api_HwError() { - return (int)7L; + return sdrplay_api_HwError; } + private static final int sdrplay_api_AliasingError = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_AliasingError = 8; + * {@snippet lang=c : + * enum .sdrplay_api_AliasingError = 8 * } */ public static int sdrplay_api_AliasingError() { - return (int)8L; + return sdrplay_api_AliasingError; } + private static final int sdrplay_api_AlreadyInitialised = (int)9L; /** - * {@snippet : - * enum .sdrplay_api_AlreadyInitialised = 9; + * {@snippet lang=c : + * enum .sdrplay_api_AlreadyInitialised = 9 * } */ public static int sdrplay_api_AlreadyInitialised() { - return (int)9L; + return sdrplay_api_AlreadyInitialised; } + private static final int sdrplay_api_NotInitialised = (int)10L; /** - * {@snippet : - * enum .sdrplay_api_NotInitialised = 10; + * {@snippet lang=c : + * enum .sdrplay_api_NotInitialised = 10 * } */ public static int sdrplay_api_NotInitialised() { - return (int)10L; + return sdrplay_api_NotInitialised; } + private static final int sdrplay_api_NotEnabled = (int)11L; /** - * {@snippet : - * enum .sdrplay_api_NotEnabled = 11; + * {@snippet lang=c : + * enum .sdrplay_api_NotEnabled = 11 * } */ public static int sdrplay_api_NotEnabled() { - return (int)11L; + return sdrplay_api_NotEnabled; } + private static final int sdrplay_api_HwVerError = (int)12L; /** - * {@snippet : - * enum .sdrplay_api_HwVerError = 12; + * {@snippet lang=c : + * enum .sdrplay_api_HwVerError = 12 * } */ public static int sdrplay_api_HwVerError() { - return (int)12L; + return sdrplay_api_HwVerError; } + private static final int sdrplay_api_OutOfMemError = (int)13L; /** - * {@snippet : - * enum .sdrplay_api_OutOfMemError = 13; + * {@snippet lang=c : + * enum .sdrplay_api_OutOfMemError = 13 * } */ public static int sdrplay_api_OutOfMemError() { - return (int)13L; + return sdrplay_api_OutOfMemError; } + private static final int sdrplay_api_ServiceNotResponding = (int)14L; /** - * {@snippet : - * enum .sdrplay_api_ServiceNotResponding = 14; + * {@snippet lang=c : + * enum .sdrplay_api_ServiceNotResponding = 14 * } */ public static int sdrplay_api_ServiceNotResponding() { - return (int)14L; + return sdrplay_api_ServiceNotResponding; } + private static final int sdrplay_api_StartPending = (int)15L; /** - * {@snippet : - * enum .sdrplay_api_StartPending = 15; + * {@snippet lang=c : + * enum .sdrplay_api_StartPending = 15 * } */ public static int sdrplay_api_StartPending() { - return (int)15L; + return sdrplay_api_StartPending; } + private static final int sdrplay_api_StopPending = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_StopPending = 16; + * {@snippet lang=c : + * enum .sdrplay_api_StopPending = 16 * } */ public static int sdrplay_api_StopPending() { - return (int)16L; + return sdrplay_api_StopPending; } + private static final int sdrplay_api_InvalidMode = (int)17L; /** - * {@snippet : - * enum .sdrplay_api_InvalidMode = 17; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidMode = 17 * } */ public static int sdrplay_api_InvalidMode() { - return (int)17L; + return sdrplay_api_InvalidMode; } + private static final int sdrplay_api_FailedVerification1 = (int)18L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification1 = 18; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification1 = 18 * } */ public static int sdrplay_api_FailedVerification1() { - return (int)18L; + return sdrplay_api_FailedVerification1; } + private static final int sdrplay_api_FailedVerification2 = (int)19L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification2 = 19; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification2 = 19 * } */ public static int sdrplay_api_FailedVerification2() { - return (int)19L; + return sdrplay_api_FailedVerification2; } + private static final int sdrplay_api_FailedVerification3 = (int)20L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification3 = 20; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification3 = 20 * } */ public static int sdrplay_api_FailedVerification3() { - return (int)20L; + return sdrplay_api_FailedVerification3; } + private static final int sdrplay_api_FailedVerification4 = (int)21L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification4 = 21; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification4 = 21 * } */ public static int sdrplay_api_FailedVerification4() { - return (int)21L; + return sdrplay_api_FailedVerification4; } + private static final int sdrplay_api_FailedVerification5 = (int)22L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification5 = 22; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification5 = 22 * } */ public static int sdrplay_api_FailedVerification5() { - return (int)22L; + return sdrplay_api_FailedVerification5; } + private static final int sdrplay_api_FailedVerification6 = (int)23L; /** - * {@snippet : - * enum .sdrplay_api_FailedVerification6 = 23; + * {@snippet lang=c : + * enum .sdrplay_api_FailedVerification6 = 23 * } */ public static int sdrplay_api_FailedVerification6() { - return (int)23L; + return sdrplay_api_FailedVerification6; } + private static final int sdrplay_api_InvalidServiceVersion = (int)24L; /** - * {@snippet : - * enum .sdrplay_api_InvalidServiceVersion = 24; + * {@snippet lang=c : + * enum .sdrplay_api_InvalidServiceVersion = 24 * } */ public static int sdrplay_api_InvalidServiceVersion() { - return (int)24L; + return sdrplay_api_InvalidServiceVersion; } + private static final int sdrplay_api_Update_None = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Update_None = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Update_None = 0 * } */ public static int sdrplay_api_Update_None() { - return (int)0L; + return sdrplay_api_Update_None; } + private static final int sdrplay_api_Update_Dev_Fs = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Fs = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_Fs = 1 * } */ public static int sdrplay_api_Update_Dev_Fs() { - return (int)1L; + return sdrplay_api_Update_Dev_Fs; } + private static final int sdrplay_api_Update_Dev_Ppm = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Ppm = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_Ppm = 2 * } */ public static int sdrplay_api_Update_Dev_Ppm() { - return (int)2L; + return sdrplay_api_Update_Dev_Ppm; } + private static final int sdrplay_api_Update_Dev_SyncUpdate = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_SyncUpdate = 4 * } */ public static int sdrplay_api_Update_Dev_SyncUpdate() { - return (int)4L; + return sdrplay_api_Update_Dev_SyncUpdate; } + private static final int sdrplay_api_Update_Dev_ResetFlags = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Dev_ResetFlags = 8 * } */ public static int sdrplay_api_Update_Dev_ResetFlags() { - return (int)8L; + return sdrplay_api_Update_Dev_ResetFlags; } + private static final int sdrplay_api_Update_Rsp1a_BiasTControl = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16 * } */ public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return (int)16L; + return sdrplay_api_Update_Rsp1a_BiasTControl; } + private static final int sdrplay_api_Update_Rsp1a_RfNotchControl = (int)32L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32 * } */ public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return (int)32L; + return sdrplay_api_Update_Rsp1a_RfNotchControl; } + private static final int sdrplay_api_Update_Rsp1a_RfDabNotchControl = (int)64L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64 * } */ public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return (int)64L; + return sdrplay_api_Update_Rsp1a_RfDabNotchControl; } + private static final int sdrplay_api_Update_Rsp2_BiasTControl = (int)128L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128 * } */ public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return (int)128L; + return sdrplay_api_Update_Rsp2_BiasTControl; } + private static final int sdrplay_api_Update_Rsp2_AmPortSelect = (int)256L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256 * } */ public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return (int)256L; + return sdrplay_api_Update_Rsp2_AmPortSelect; } + private static final int sdrplay_api_Update_Rsp2_AntennaControl = (int)512L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512 * } */ public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return (int)512L; + return sdrplay_api_Update_Rsp2_AntennaControl; } + private static final int sdrplay_api_Update_Rsp2_RfNotchControl = (int)1024L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024 * } */ public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return (int)1024L; + return sdrplay_api_Update_Rsp2_RfNotchControl; } + private static final int sdrplay_api_Update_Rsp2_ExtRefControl = (int)2048L; /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048 * } */ public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return (int)2048L; + return sdrplay_api_Update_Rsp2_ExtRefControl; } + private static final int sdrplay_api_Update_RspDuo_ExtRefControl = (int)4096L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096 * } */ public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return (int)4096L; + return sdrplay_api_Update_RspDuo_ExtRefControl; } + private static final int sdrplay_api_Update_Master_Spare_1 = (int)8192L; /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Master_Spare_1 = 8192 * } */ public static int sdrplay_api_Update_Master_Spare_1() { - return (int)8192L; + return sdrplay_api_Update_Master_Spare_1; } + private static final int sdrplay_api_Update_Master_Spare_2 = (int)16384L; /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Master_Spare_2 = 16384 * } */ public static int sdrplay_api_Update_Master_Spare_2() { - return (int)16384L; + return sdrplay_api_Update_Master_Spare_2; } + private static final int sdrplay_api_Update_Tuner_Gr = (int)32768L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Gr = 32768; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_Gr = 32768 * } */ public static int sdrplay_api_Update_Tuner_Gr() { - return (int)32768L; + return sdrplay_api_Update_Tuner_Gr; } + private static final int sdrplay_api_Update_Tuner_GrLimits = (int)65536L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_GrLimits = 65536 * } */ public static int sdrplay_api_Update_Tuner_GrLimits() { - return (int)65536L; + return sdrplay_api_Update_Tuner_GrLimits; } + private static final int sdrplay_api_Update_Tuner_Frf = (int)131072L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Frf = 131072; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_Frf = 131072 * } */ public static int sdrplay_api_Update_Tuner_Frf() { - return (int)131072L; + return sdrplay_api_Update_Tuner_Frf; } + private static final int sdrplay_api_Update_Tuner_BwType = (int)262144L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_BwType = 262144; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_BwType = 262144 * } */ public static int sdrplay_api_Update_Tuner_BwType() { - return (int)262144L; + return sdrplay_api_Update_Tuner_BwType; } + private static final int sdrplay_api_Update_Tuner_IfType = (int)524288L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_IfType = 524288; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_IfType = 524288 * } */ public static int sdrplay_api_Update_Tuner_IfType() { - return (int)524288L; + return sdrplay_api_Update_Tuner_IfType; } + private static final int sdrplay_api_Update_Tuner_DcOffset = (int)1048576L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576 * } */ public static int sdrplay_api_Update_Tuner_DcOffset() { - return (int)1048576L; + return sdrplay_api_Update_Tuner_DcOffset; } + private static final int sdrplay_api_Update_Tuner_LoMode = (int)2097152L; /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Tuner_LoMode = 2097152 * } */ public static int sdrplay_api_Update_Tuner_LoMode() { - return (int)2097152L; + return sdrplay_api_Update_Tuner_LoMode; } + private static final int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = (int)4194304L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304 * } */ public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return (int)4194304L; + return sdrplay_api_Update_Ctrl_DCoffsetIQimbalance; } + private static final int sdrplay_api_Update_Ctrl_Decimation = (int)8388608L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608 * } */ public static int sdrplay_api_Update_Ctrl_Decimation() { - return (int)8388608L; + return sdrplay_api_Update_Ctrl_Decimation; } + private static final int sdrplay_api_Update_Ctrl_Agc = (int)16777216L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_Agc = 16777216 * } */ public static int sdrplay_api_Update_Ctrl_Agc() { - return (int)16777216L; + return sdrplay_api_Update_Ctrl_Agc; } + private static final int sdrplay_api_Update_Ctrl_AdsbMode = (int)33554432L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432 * } */ public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return (int)33554432L; + return sdrplay_api_Update_Ctrl_AdsbMode; } + private static final int sdrplay_api_Update_Ctrl_OverloadMsgAck = (int)67108864L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864 * } */ public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return (int)67108864L; + return sdrplay_api_Update_Ctrl_OverloadMsgAck; } + private static final int sdrplay_api_Update_RspDuo_BiasTControl = (int)134217728L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728 * } */ public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return (int)134217728L; + return sdrplay_api_Update_RspDuo_BiasTControl; } + private static final int sdrplay_api_Update_RspDuo_AmPortSelect = (int)268435456L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456 * } */ public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return (int)268435456L; + return sdrplay_api_Update_RspDuo_AmPortSelect; } + private static final int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = (int)536870912L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912 * } */ public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return (int)536870912L; + return sdrplay_api_Update_RspDuo_Tuner1AmNotchControl; } + private static final int sdrplay_api_Update_RspDuo_RfNotchControl = (int)1073741824L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824 * } */ public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return (int)1073741824L; + return sdrplay_api_Update_RspDuo_RfNotchControl; } + private static final int sdrplay_api_Update_RspDuo_RfDabNotchControl = (int)-2147483648L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648 * } */ public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return (int)-2147483648L; + return sdrplay_api_Update_RspDuo_RfDabNotchControl; } + private static final int sdrplay_api_Update_Ext1_None = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_Update_Ext1_None = 0; + * {@snippet lang=c : + * enum .sdrplay_api_Update_Ext1_None = 0 * } */ public static int sdrplay_api_Update_Ext1_None() { - return (int)0L; + return sdrplay_api_Update_Ext1_None; } + private static final int sdrplay_api_Update_RspDx_HdrEnable = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_HdrEnable = 1 * } */ public static int sdrplay_api_Update_RspDx_HdrEnable() { - return (int)1L; + return sdrplay_api_Update_RspDx_HdrEnable; } + private static final int sdrplay_api_Update_RspDx_BiasTControl = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_BiasTControl = 2 * } */ public static int sdrplay_api_Update_RspDx_BiasTControl() { - return (int)2L; + return sdrplay_api_Update_RspDx_BiasTControl; } + private static final int sdrplay_api_Update_RspDx_AntennaControl = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_AntennaControl = 4 * } */ public static int sdrplay_api_Update_RspDx_AntennaControl() { - return (int)4L; + return sdrplay_api_Update_RspDx_AntennaControl; } + private static final int sdrplay_api_Update_RspDx_RfNotchControl = (int)8L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8 * } */ public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return (int)8L; + return sdrplay_api_Update_RspDx_RfNotchControl; } + private static final int sdrplay_api_Update_RspDx_RfDabNotchControl = (int)16L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16 * } */ public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return (int)16L; + return sdrplay_api_Update_RspDx_RfDabNotchControl; } + private static final int sdrplay_api_Update_RspDx_HdrBw = (int)32L; /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32; + * {@snippet lang=c : + * enum .sdrplay_api_Update_RspDx_HdrBw = 32 * } */ public static int sdrplay_api_Update_RspDx_HdrBw() { - return (int)32L; + return sdrplay_api_Update_RspDx_HdrBw; } + private static final int sdrplay_api_DbgLvl_Disable = (int)0L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Disable = 0; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Disable = 0 * } */ public static int sdrplay_api_DbgLvl_Disable() { - return (int)0L; + return sdrplay_api_DbgLvl_Disable; } + private static final int sdrplay_api_DbgLvl_Verbose = (int)1L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Verbose = 1; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Verbose = 1 * } */ public static int sdrplay_api_DbgLvl_Verbose() { - return (int)1L; + return sdrplay_api_DbgLvl_Verbose; } + private static final int sdrplay_api_DbgLvl_Warning = (int)2L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Warning = 2; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Warning = 2 * } */ public static int sdrplay_api_DbgLvl_Warning() { - return (int)2L; + return sdrplay_api_DbgLvl_Warning; } + private static final int sdrplay_api_DbgLvl_Error = (int)3L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Error = 3; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Error = 3 * } */ public static int sdrplay_api_DbgLvl_Error() { - return (int)3L; + return sdrplay_api_DbgLvl_Error; } + private static final int sdrplay_api_DbgLvl_Message = (int)4L; /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Message = 4; + * {@snippet lang=c : + * enum .sdrplay_api_DbgLvl_Message = 4 * } */ public static int sdrplay_api_DbgLvl_Message() { - return (int)4L; + return sdrplay_api_DbgLvl_Message; } + private static final int MAX_BB_GR = (int)59L; /** - * {@snippet : + * {@snippet lang=c : * #define MAX_BB_GR 59 * } */ public static int MAX_BB_GR() { - return (int)59L; + return MAX_BB_GR; } + private static final float SDRPLAY_API_VERSION = 3.0799999237060547f; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_API_VERSION 3.0799999237060547 * } */ public static float SDRPLAY_API_VERSION() { - return 3.0799999237060547f; + return SDRPLAY_API_VERSION; } + private static final int SDRPLAY_MAX_DEVICES = (int)16L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_DEVICES 16 * } */ public static int SDRPLAY_MAX_DEVICES() { - return (int)16L; + return SDRPLAY_MAX_DEVICES; } + private static final int SDRPLAY_MAX_TUNERS_PER_DEVICE = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 * } */ public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return (int)2L; + return SDRPLAY_MAX_TUNERS_PER_DEVICE; } + private static final int SDRPLAY_MAX_SER_NO_LEN = (int)64L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_SER_NO_LEN 64 * } */ public static int SDRPLAY_MAX_SER_NO_LEN() { - return (int)64L; + return SDRPLAY_MAX_SER_NO_LEN; } + private static final int SDRPLAY_MAX_ROOT_NM_LEN = (int)32L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_MAX_ROOT_NM_LEN 32 * } */ public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return (int)32L; + return SDRPLAY_MAX_ROOT_NM_LEN; } + private static final int SDRPLAY_RSP1_ID = (int)1L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP1_ID 1 * } */ public static int SDRPLAY_RSP1_ID() { - return (int)1L; + return SDRPLAY_RSP1_ID; } + private static final int SDRPLAY_RSP1A_ID = (int)255L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP1A_ID 255 * } */ public static int SDRPLAY_RSP1A_ID() { - return (int)255L; + return SDRPLAY_RSP1A_ID; } + private static final int SDRPLAY_RSP2_ID = (int)2L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSP2_ID 2 * } */ public static int SDRPLAY_RSP2_ID() { - return (int)2L; + return SDRPLAY_RSP2_ID; } + private static final int SDRPLAY_RSPduo_ID = (int)3L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSPduo_ID 3 * } */ public static int SDRPLAY_RSPduo_ID() { - return (int)3L; + return SDRPLAY_RSPduo_ID; } + private static final int SDRPLAY_RSPdx_ID = (int)4L; /** - * {@snippet : + * {@snippet lang=c : * #define SDRPLAY_RSPdx_ID 4 * } */ public static int SDRPLAY_RSPdx_ID() { - return (int)4L; + return SDRPLAY_RSPdx_ID; } } - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/Constants$root.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/Constants$root.java deleted file mode 100644 index 951fd2794..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/Constants$root.java +++ /dev/null @@ -1,55 +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_14; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_BOOLEAN; -import static java.lang.foreign.ValueLayout.JAVA_BYTE; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_FLOAT; -import static java.lang.foreign.ValueLayout.JAVA_INT; -import static java.lang.foreign.ValueLayout.JAVA_LONG; -import static java.lang.foreign.ValueLayout.JAVA_SHORT; -import static java.lang.foreign.ValueLayout.OfAddress; -import static java.lang.foreign.ValueLayout.OfBoolean; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -final class Constants$root { - - // Suppresses default constructor, ensuring non-instantiability. - private Constants$root() {} - static final OfBoolean C_BOOL$LAYOUT = JAVA_BOOLEAN; - static final OfByte C_CHAR$LAYOUT = JAVA_BYTE; - static final OfShort C_SHORT$LAYOUT = JAVA_SHORT; - static final OfInt C_INT$LAYOUT = JAVA_INT; - static final OfLong C_LONG$LAYOUT = JAVA_LONG; - static final OfLong C_LONG_LONG$LAYOUT = JAVA_LONG; - static final OfFloat C_FLOAT$LAYOUT = JAVA_FLOAT; - static final OfDouble C_DOUBLE$LAYOUT = JAVA_DOUBLE; - static final OfAddress C_POINTER$LAYOUT = ADDRESS.withBitAlignment(64).asUnbounded(); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/RuntimeHelper.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/RuntimeHelper.java deleted file mode 100644 index 372469d8b..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/RuntimeHelper.java +++ /dev/null @@ -1,253 +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.v3_14; -// Generated by jextract - -import java.lang.foreign.FunctionDescriptor; -import java.lang.foreign.GroupLayout; -import java.lang.foreign.Linker; -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.SymbolLookup; -import java.lang.foreign.ValueLayout; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodType; - -import static java.lang.foreign.ValueLayout.ADDRESS; -import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; -import static java.lang.foreign.ValueLayout.JAVA_LONG; - -final class RuntimeHelper { - - private static final Linker LINKER = Linker.nativeLinker(); - private static final ClassLoader LOADER = RuntimeHelper.class.getClassLoader(); - private static final MethodHandles.Lookup MH_LOOKUP = MethodHandles.lookup(); - private static final SymbolLookup SYMBOL_LOOKUP; - private static final SegmentAllocator THROWING_ALLOCATOR = (x, y) -> { throw new AssertionError("should not reach here"); }; - - final static SegmentAllocator CONSTANT_ALLOCATOR = - (size, align) -> MemorySegment.allocateNative(size, align, SegmentScope.auto()); - - static { - System.loadLibrary("libsdrplay_api"); - SymbolLookup loaderLookup = SymbolLookup.loaderLookup(); - SYMBOL_LOOKUP = name -> loaderLookup.find(name).or(() -> LINKER.defaultLookup().find(name)); - } - - // Suppresses default constructor, ensuring non-instantiability. - private RuntimeHelper() {} - - static T requireNonNull(T obj, String symbolName) { - if (obj == null) { - throw new UnsatisfiedLinkError("unresolved symbol: " + symbolName); - } - return obj; - } - - static MemorySegment lookupGlobalVariable(String name, MemoryLayout layout) { - return SYMBOL_LOOKUP.find(name).map(symbol -> MemorySegment.ofAddress(symbol.address(), layout.byteSize(), symbol.scope())).orElse(null); - } - - static MethodHandle downcallHandle(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> LINKER.downcallHandle(addr, fdesc)). - orElse(null); - } - - static MethodHandle downcallHandle(FunctionDescriptor fdesc) { - return LINKER.downcallHandle(fdesc); - } - - static MethodHandle downcallHandleVariadic(String name, FunctionDescriptor fdesc) { - return SYMBOL_LOOKUP.find(name). - map(addr -> VarargsInvoker.make(addr, fdesc)). - orElse(null); - } - - static MethodHandle upcallHandle(Class fi, String name, FunctionDescriptor fdesc) { - try { - return MH_LOOKUP.findVirtual(fi, name, fdesc.toMethodType()); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment upcallStub(MethodHandle fiHandle, Z z, FunctionDescriptor fdesc, SegmentScope scope) { - try { - fiHandle = fiHandle.bindTo(z); - return LINKER.upcallStub(fiHandle, fdesc, scope); - } catch (Throwable ex) { - throw new AssertionError(ex); - } - } - - static MemorySegment asArray(MemorySegment addr, MemoryLayout layout, int numElements, SegmentScope scope) { - return MemorySegment.ofAddress(addr.address(), numElements * layout.byteSize(), scope); - } - - // Internals only below this point - - private static final class VarargsInvoker { - private static final MethodHandle INVOKE_MH; - private final MemorySegment symbol; - private final FunctionDescriptor function; - - private VarargsInvoker(MemorySegment symbol, FunctionDescriptor function) { - this.symbol = symbol; - this.function = function; - } - - static { - try { - INVOKE_MH = MethodHandles.lookup().findVirtual(VarargsInvoker.class, "invoke", MethodType.methodType(Object.class, SegmentAllocator.class, Object[].class)); - } catch (ReflectiveOperationException e) { - throw new RuntimeException(e); - } - } - - static MethodHandle make(MemorySegment symbol, FunctionDescriptor function) { - VarargsInvoker invoker = new VarargsInvoker(symbol, function); - MethodHandle handle = INVOKE_MH.bindTo(invoker).asCollector(Object[].class, function.argumentLayouts().size() + 1); - MethodType mtype = MethodType.methodType(function.returnLayout().isPresent() ? carrier(function.returnLayout().get(), true) : void.class); - for (MemoryLayout layout : function.argumentLayouts()) { - mtype = mtype.appendParameterTypes(carrier(layout, false)); - } - mtype = mtype.appendParameterTypes(Object[].class); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mtype = mtype.insertParameterTypes(0, SegmentAllocator.class); - } else { - handle = MethodHandles.insertArguments(handle, 0, THROWING_ALLOCATOR); - } - return handle.asType(mtype); - } - - static Class carrier(MemoryLayout layout, boolean ret) { - if (layout instanceof ValueLayout valueLayout) { - return valueLayout.carrier(); - } else if (layout instanceof GroupLayout) { - return MemorySegment.class; - } else { - throw new AssertionError("Cannot get here!"); - } - } - - private Object invoke(SegmentAllocator allocator, Object[] args) throws Throwable { - // one trailing Object[] - int nNamedArgs = function.argumentLayouts().size(); - assert(args.length == nNamedArgs + 1); - // The last argument is the array of vararg collector - Object[] unnamedArgs = (Object[]) args[args.length - 1]; - - int argsCount = nNamedArgs + unnamedArgs.length; - Class[] argTypes = new Class[argsCount]; - MemoryLayout[] argLayouts = new MemoryLayout[nNamedArgs + unnamedArgs.length]; - - int pos = 0; - for (pos = 0; pos < nNamedArgs; pos++) { - argLayouts[pos] = function.argumentLayouts().get(pos); - } - - assert pos == nNamedArgs; - for (Object o: unnamedArgs) { - argLayouts[pos] = variadicLayout(normalize(o.getClass())); - pos++; - } - assert pos == argsCount; - - FunctionDescriptor f = (function.returnLayout().isEmpty()) ? - FunctionDescriptor.ofVoid(argLayouts) : - FunctionDescriptor.of(function.returnLayout().get(), argLayouts); - MethodHandle mh = LINKER.downcallHandle(symbol, f); - boolean needsAllocator = function.returnLayout().isPresent() && - function.returnLayout().get() instanceof GroupLayout; - if (needsAllocator) { - mh = mh.bindTo(allocator); - } - // flatten argument list so that it can be passed to an asSpreader MH - Object[] allArgs = new Object[nNamedArgs + unnamedArgs.length]; - System.arraycopy(args, 0, allArgs, 0, nNamedArgs); - System.arraycopy(unnamedArgs, 0, allArgs, nNamedArgs, unnamedArgs.length); - - return mh.asSpreader(Object[].class, argsCount).invoke(allArgs); - } - - private static Class unboxIfNeeded(Class clazz) { - if (clazz == Boolean.class) { - return boolean.class; - } else if (clazz == Void.class) { - return void.class; - } else if (clazz == Byte.class) { - return byte.class; - } else if (clazz == Character.class) { - return char.class; - } else if (clazz == Short.class) { - return short.class; - } else if (clazz == Integer.class) { - return int.class; - } else if (clazz == Long.class) { - return long.class; - } else if (clazz == Float.class) { - return float.class; - } else if (clazz == Double.class) { - return double.class; - } else { - return clazz; - } - } - - private Class promote(Class c) { - if (c == byte.class || c == char.class || c == short.class || c == int.class) { - return long.class; - } else if (c == float.class) { - return double.class; - } else { - return c; - } - } - - private Class normalize(Class c) { - c = unboxIfNeeded(c); - if (c.isPrimitive()) { - return promote(c); - } - if (c == MemorySegment.class) { - return MemorySegment.class; - } - throw new IllegalArgumentException("Invalid type for ABI: " + c.getTypeName()); - } - - private MemoryLayout variadicLayout(Class c) { - if (c == long.class) { - return JAVA_LONG; - } else if (c == double.class) { - return JAVA_DOUBLE; - } else if (c == MemorySegment.class) { - return ADDRESS; - } else { - throw new IllegalArgumentException("Unhandled variadic argument class: " + c); - } - } - } -} diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$0.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$0.java deleted file mode 100644 index ec7c744c4..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$0.java +++ /dev/null @@ -1,89 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$0 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$0() {} - static final FunctionDescriptor sdrplay_api_StreamCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_StreamCallback_t.class, "apply", constants$0.sdrplay_api_StreamCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_StreamCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_StreamCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_StreamCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_EventCallback_t_UP$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_EventCallback_t.class, "apply", constants$0.sdrplay_api_EventCallback_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_EventCallback_t_DOWN$FUNC = FunctionDescriptor.ofVoid( - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_EventCallback_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_EventCallback_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Open_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Open_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Open_t.class, "apply", constants$0.sdrplay_api_Open_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Open_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$0.sdrplay_api_Open_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$1.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$1.java deleted file mode 100644 index 28a64774e..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$1.java +++ /dev/null @@ -1,59 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$1 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$1() {} - static final FunctionDescriptor sdrplay_api_Close_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_Close_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Close_t.class, "apply", constants$1.sdrplay_api_Close_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Close_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_Close_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ApiVersion_t.class, "apply", constants$1.sdrplay_api_ApiVersion_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ApiVersion_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_ApiVersion_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_LockDeviceApi_t.class, "apply", constants$1.sdrplay_api_LockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_LockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$1.sdrplay_api_LockDeviceApi_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$10.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$10.java deleted file mode 100644 index 38dd2f993..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$10.java +++ /dev/null @@ -1,74 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$10 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$10() {} - static final FunctionDescriptor sdrplay_api_Update$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Update", - constants$10.sdrplay_api_Update$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoActiveTuner", - constants$10.sdrplay_api_SwapRspDuoActiveTuner$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoDualTunerModeSampleRate", - constants$10.sdrplay_api_SwapRspDuoDualTunerModeSampleRate$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SwapRspDuoMode", - constants$10.sdrplay_api_SwapRspDuoMode$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$2.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$2.java deleted file mode 100644 index 1d176f828..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$2.java +++ /dev/null @@ -1,71 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$2 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$2() {} - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_UnlockDeviceApi_t.class, "apply", constants$2.sdrplay_api_UnlockDeviceApi_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDevices_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDevices_t.class, "apply", constants$2.sdrplay_api_GetDevices_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDevices_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_GetDevices_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SelectDevice_t.class, "apply", constants$2.sdrplay_api_SelectDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SelectDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$2.sdrplay_api_SelectDevice_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$3.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$3.java deleted file mode 100644 index 027b0e547..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$3.java +++ /dev/null @@ -1,71 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$3 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$3() {} - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_ReleaseDevice_t.class, "apply", constants$3.sdrplay_api_ReleaseDevice_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_ReleaseDevice_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_ReleaseDevice_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetErrorString_t.class, "apply", constants$3.sdrplay_api_GetErrorString_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetErrorString_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetErrorString_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetLastError_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetLastError_t.class, "apply", constants$3.sdrplay_api_GetLastError_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetLastError_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$3.sdrplay_api_GetLastError_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$4.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$4.java deleted file mode 100644 index 6dcc14577..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$4.java +++ /dev/null @@ -1,74 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$4 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$4() {} - static final FunctionDescriptor sdrplay_api_GetLastErrorByType_t$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetLastErrorByType_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastErrorByType_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetLastErrorByType_t.class, "apply", constants$4.sdrplay_api_GetLastErrorByType_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetLastErrorByType_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastErrorByType_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_GetLastErrorByType_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DisableHeartbeat_t.class, "apply", constants$4.sdrplay_api_DisableHeartbeat_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_DebugEnable_t.class, "apply", constants$4.sdrplay_api_DebugEnable_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_DebugEnable_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$4.sdrplay_api_DebugEnable_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$5.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$5.java deleted file mode 100644 index 864b83ee7..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$5.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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$5 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$5() {} - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_GetDeviceParams_t.class, "apply", constants$5.sdrplay_api_GetDeviceParams_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_GetDeviceParams_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_GetDeviceParams_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Init_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Init_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Init_t.class, "apply", constants$5.sdrplay_api_Init_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Init_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Init_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Uninit_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Uninit_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Uninit_t.class, "apply", constants$5.sdrplay_api_Uninit_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Uninit_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$5.sdrplay_api_Uninit_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$6.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$6.java deleted file mode 100644 index c6284396c..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$6.java +++ /dev/null @@ -1,89 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$6 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$6() {} - static final FunctionDescriptor sdrplay_api_Update_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_Update_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_Update_t.class, "apply", constants$6.sdrplay_api_Update_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_Update_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_Update_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_Update_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoActiveTuner_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.class, "apply", constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$7.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$7.java deleted file mode 100644 index a417b443d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$7.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$7 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$7() {} - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_UP$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_UP$MH = RuntimeHelper.upcallHandle(sdrplay_api_SwapRspDuoMode_t.class, "apply", constants$7.sdrplay_api_SwapRspDuoMode_t_UP$FUNC); - static final FunctionDescriptor sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_DOUBLE$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_SwapRspDuoMode_t_DOWN$MH = RuntimeHelper.downcallHandle( - constants$7.sdrplay_api_SwapRspDuoMode_t_DOWN$FUNC - ); - static final FunctionDescriptor sdrplay_api_Open$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Open$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Open", - constants$7.sdrplay_api_Open$FUNC - ); - static final FunctionDescriptor sdrplay_api_Close$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_Close$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Close", - constants$7.sdrplay_api_Close$FUNC - ); - static final FunctionDescriptor sdrplay_api_ApiVersion$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ApiVersion$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_ApiVersion", - constants$7.sdrplay_api_ApiVersion$FUNC - ); - static final FunctionDescriptor sdrplay_api_LockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_LockDeviceApi$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_LockDeviceApi", - constants$7.sdrplay_api_LockDeviceApi$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$8.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$8.java deleted file mode 100644 index f8276865c..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$8.java +++ /dev/null @@ -1,74 +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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$8 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$8() {} - static final FunctionDescriptor sdrplay_api_UnlockDeviceApi$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_UnlockDeviceApi$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_UnlockDeviceApi", - constants$8.sdrplay_api_UnlockDeviceApi$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDevices$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDevices$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetDevices", - constants$8.sdrplay_api_GetDevices$FUNC - ); - static final FunctionDescriptor sdrplay_api_SelectDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_SelectDevice$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_SelectDevice", - constants$8.sdrplay_api_SelectDevice$FUNC - ); - static final FunctionDescriptor sdrplay_api_ReleaseDevice$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_ReleaseDevice$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_ReleaseDevice", - constants$8.sdrplay_api_ReleaseDevice$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetErrorString$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_GetErrorString$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetErrorString", - constants$8.sdrplay_api_GetErrorString$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetLastError$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastError$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetLastError", - constants$8.sdrplay_api_GetLastError$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$9.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$9.java deleted file mode 100644 index 0e06ee168..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/constants$9.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_14; - -import java.lang.foreign.FunctionDescriptor; -import java.lang.invoke.MethodHandle; -final class constants$9 { - - // Suppresses default constructor, ensuring non-instantiability. - private constants$9() {} - static final FunctionDescriptor sdrplay_api_GetLastErrorByType$FUNC = FunctionDescriptor.of(Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetLastErrorByType$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetLastErrorByType", - constants$9.sdrplay_api_GetLastErrorByType$FUNC - ); - static final FunctionDescriptor sdrplay_api_DisableHeartbeat$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT); - static final MethodHandle sdrplay_api_DisableHeartbeat$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_DisableHeartbeat", - constants$9.sdrplay_api_DisableHeartbeat$FUNC - ); - static final FunctionDescriptor sdrplay_api_DebugEnable$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_INT$LAYOUT - ); - static final MethodHandle sdrplay_api_DebugEnable$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_DebugEnable", - constants$9.sdrplay_api_DebugEnable$FUNC - ); - static final FunctionDescriptor sdrplay_api_GetDeviceParams$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_GetDeviceParams$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_GetDeviceParams", - constants$9.sdrplay_api_GetDeviceParams$FUNC - ); - static final FunctionDescriptor sdrplay_api_Init$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Init$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Init", - constants$9.sdrplay_api_Init$FUNC - ); - static final FunctionDescriptor sdrplay_api_Uninit$FUNC = FunctionDescriptor.of(Constants$root.C_INT$LAYOUT, - Constants$root.C_POINTER$LAYOUT - ); - static final MethodHandle sdrplay_api_Uninit$MH = RuntimeHelper.downcallHandle( - "sdrplay_api_Uninit", - constants$9.sdrplay_api_Uninit$FUNC - ); -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_AgcT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_AgcT.java deleted file mode 100644 index 578c022b1..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_AgcT.java +++ /dev/null @@ -1,261 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_AgcT.$struct$LAYOUT; - } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_AgcT.enable$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; - * } - */ - public static int enable$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_AgcControlT enable; - * } - */ - public static void enable$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.enable$VH.set(seg, x); - } - public static int enable$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.enable$VH.get(seg.asSlice(index*sizeof())); - } - public static void enable$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.enable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle setPoint_dBfs$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("setPoint_dBfs")); - public static VarHandle setPoint_dBfs$VH() { - return sdrplay_api_AgcT.setPoint_dBfs$VH; - } - /** - * Getter for field: - * {@snippet : - * int setPoint_dBfs; - * } - */ - public static int setPoint_dBfs$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int setPoint_dBfs; - * } - */ - public static void setPoint_dBfs$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg, x); - } - public static int setPoint_dBfs$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.setPoint_dBfs$VH.get(seg.asSlice(index*sizeof())); - } - public static void setPoint_dBfs$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.setPoint_dBfs$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle attack_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("attack_ms")); - public static VarHandle attack_ms$VH() { - return sdrplay_api_AgcT.attack_ms$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned short attack_ms; - * } - */ - public static short attack_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned short attack_ms; - * } - */ - public static void attack_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg, x); - } - public static short attack_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.attack_ms$VH.get(seg.asSlice(index*sizeof())); - } - public static void attack_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.attack_ms$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle decay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_ms")); - public static VarHandle decay_ms$VH() { - return sdrplay_api_AgcT.decay_ms$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned short decay_ms; - * } - */ - public static short decay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned short decay_ms; - * } - */ - public static void decay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg, x); - } - public static short decay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_ms$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_ms$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle decay_delay_ms$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_delay_ms")); - public static VarHandle decay_delay_ms$VH() { - return sdrplay_api_AgcT.decay_delay_ms$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned short decay_delay_ms; - * } - */ - public static short decay_delay_ms$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned short decay_delay_ms; - * } - */ - public static void decay_delay_ms$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg, x); - } - public static short decay_delay_ms$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_delay_ms$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_delay_ms$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_delay_ms$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle decay_threshold_dB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decay_threshold_dB")); - public static VarHandle decay_threshold_dB$VH() { - return sdrplay_api_AgcT.decay_threshold_dB$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned short decay_threshold_dB; - * } - */ - public static short decay_threshold_dB$get(MemorySegment seg) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned short decay_threshold_dB; - * } - */ - public static void decay_threshold_dB$set(MemorySegment seg, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg, x); - } - public static short decay_threshold_dB$get(MemorySegment seg, long index) { - return (short)sdrplay_api_AgcT.decay_threshold_dB$VH.get(seg.asSlice(index*sizeof())); - } - public static void decay_threshold_dB$set(MemorySegment seg, long index, short x) { - sdrplay_api_AgcT.decay_threshold_dB$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_AgcT.syncUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * int syncUpdate; - * } - */ - public static int syncUpdate$get(MemorySegment seg) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int syncUpdate; - * } - */ - public static void syncUpdate$set(MemorySegment seg, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg, x); - } - public static int syncUpdate$get(MemorySegment seg, long index) { - return (int)sdrplay_api_AgcT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void syncUpdate$set(MemorySegment seg, long index, int x) { - sdrplay_api_AgcT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ApiVersion_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ApiVersion_t.java deleted file mode 100644 index d6826d9f8..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ApiVersion_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_ApiVersion_t)(float* apiVer); - * } - */ -public interface sdrplay_api_ApiVersion_t { - - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_ApiVersion_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_ApiVersion_t_UP$MH, fi, constants$1.sdrplay_api_ApiVersion_t$FUNC, scope); - } - static sdrplay_api_ApiVersion_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$1.sdrplay_api_ApiVersion_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_CallbackFnsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_CallbackFnsT.java deleted file mode 100644 index 0fe598804..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_CallbackFnsT.java +++ /dev/null @@ -1,150 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_StreamCallback_t StreamACbFn; - * sdrplay_api_StreamCallback_t StreamBCbFn; - * sdrplay_api_EventCallback_t EventCbFn; - * }; - * } - */ -public class sdrplay_api_CallbackFnsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("StreamACbFn"), - Constants$root.C_POINTER$LAYOUT.withName("StreamBCbFn"), - Constants$root.C_POINTER$LAYOUT.withName("EventCbFn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_CallbackFnsT.$struct$LAYOUT; - } - static final VarHandle StreamACbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamACbFn")); - public static VarHandle StreamACbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamACbFn$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; - * } - */ - public static MemorySegment StreamACbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamACbFn; - * } - */ - public static void StreamACbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg, x); - } - public static MemorySegment StreamACbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamACbFn$VH.get(seg.asSlice(index*sizeof())); - } - public static void StreamACbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamACbFn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static sdrplay_api_StreamCallback_t StreamACbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamACbFn$get(segment), scope); - } - static final VarHandle StreamBCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("StreamBCbFn")); - public static VarHandle StreamBCbFn$VH() { - return sdrplay_api_CallbackFnsT.StreamBCbFn$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; - * } - */ - public static MemorySegment StreamBCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_StreamCallback_t StreamBCbFn; - * } - */ - public static void StreamBCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg, x); - } - public static MemorySegment StreamBCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.StreamBCbFn$VH.get(seg.asSlice(index*sizeof())); - } - public static void StreamBCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.StreamBCbFn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static sdrplay_api_StreamCallback_t StreamBCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_StreamCallback_t.ofAddress(StreamBCbFn$get(segment), scope); - } - static final VarHandle EventCbFn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("EventCbFn")); - public static VarHandle EventCbFn$VH() { - return sdrplay_api_CallbackFnsT.EventCbFn$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; - * } - */ - public static MemorySegment EventCbFn$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_EventCallback_t EventCbFn; - * } - */ - public static void EventCbFn$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg, x); - } - public static MemorySegment EventCbFn$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_CallbackFnsT.EventCbFn$VH.get(seg.asSlice(index*sizeof())); - } - public static void EventCbFn$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_CallbackFnsT.EventCbFn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static sdrplay_api_EventCallback_t EventCbFn(MemorySegment segment, SegmentScope scope) { - return sdrplay_api_EventCallback_t.ofAddress(EventCbFn$get(segment), scope); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Close_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Close_t.java deleted file mode 100644 index bfbd9325e..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Close_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_Close_t)(); - * } - */ -public interface sdrplay_api_Close_t { - - int apply(); - static MemorySegment allocate(sdrplay_api_Close_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_Close_t_UP$MH, fi, constants$1.sdrplay_api_Close_t$FUNC, scope); - } - static sdrplay_api_Close_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_Close_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ControlParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ControlParamsT.java deleted file mode 100644 index 65270d917..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ControlParamsT.java +++ /dev/null @@ -1,112 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_DcOffsetT dcOffset; - * sdrplay_api_DecimationT decimation; - * sdrplay_api_AgcT agc; - * sdrplay_api_AdsbModeT adsbMode; - * }; - * } - */ -public class sdrplay_api_ControlParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ControlParamsT.$struct$LAYOUT; - } - public static MemorySegment dcOffset$slice(MemorySegment seg) { - return seg.asSlice(0, 2); - } - public static MemorySegment decimation$slice(MemorySegment seg) { - return seg.asSlice(2, 3); - } - public static MemorySegment agc$slice(MemorySegment seg) { - return seg.asSlice(8, 20); - } - static final VarHandle adsbMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("adsbMode")); - public static VarHandle adsbMode$VH() { - return sdrplay_api_ControlParamsT.adsbMode$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_AdsbModeT adsbMode; - * } - */ - public static int adsbMode$get(MemorySegment seg) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_AdsbModeT adsbMode; - * } - */ - public static void adsbMode$set(MemorySegment seg, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg, x); - } - public static int adsbMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ControlParamsT.adsbMode$VH.get(seg.asSlice(index*sizeof())); - } - public static void adsbMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_ControlParamsT.adsbMode$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetT.java deleted file mode 100644 index e13586807..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetT.java +++ /dev/null @@ -1,111 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char DCenable; - * unsigned char IQenable; - * }; - * } - */ -public class sdrplay_api_DcOffsetT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetT.$struct$LAYOUT; - } - static final VarHandle DCenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("DCenable")); - public static VarHandle DCenable$VH() { - return sdrplay_api_DcOffsetT.DCenable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char DCenable; - * } - */ - public static byte DCenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char DCenable; - * } - */ - public static void DCenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg, x); - } - public static byte DCenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.DCenable$VH.get(seg.asSlice(index*sizeof())); - } - public static void DCenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.DCenable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle IQenable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("IQenable")); - public static VarHandle IQenable$VH() { - return sdrplay_api_DcOffsetT.IQenable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char IQenable; - * } - */ - public static byte IQenable$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char IQenable; - * } - */ - public static void IQenable$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg, x); - } - public static byte IQenable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetT.IQenable$VH.get(seg.asSlice(index*sizeof())); - } - public static void IQenable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetT.IQenable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetTunerT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetTunerT.java deleted file mode 100644 index 8cdcdbfbc..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DcOffsetTunerT.java +++ /dev/null @@ -1,172 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char dcCal; - * unsigned char speedUp; - * int trackTime; - * int refreshRateTime; - * }; - * } - */ -public class sdrplay_api_DcOffsetTunerT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DcOffsetTunerT.$struct$LAYOUT; - } - static final VarHandle dcCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dcCal")); - public static VarHandle dcCal$VH() { - return sdrplay_api_DcOffsetTunerT.dcCal$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char dcCal; - * } - */ - public static byte dcCal$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char dcCal; - * } - */ - public static void dcCal$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg, x); - } - public static byte dcCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.dcCal$VH.get(seg.asSlice(index*sizeof())); - } - public static void dcCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.dcCal$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle speedUp$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("speedUp")); - public static VarHandle speedUp$VH() { - return sdrplay_api_DcOffsetTunerT.speedUp$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char speedUp; - * } - */ - public static byte speedUp$get(MemorySegment seg) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char speedUp; - * } - */ - public static void speedUp$set(MemorySegment seg, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg, x); - } - public static byte speedUp$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DcOffsetTunerT.speedUp$VH.get(seg.asSlice(index*sizeof())); - } - public static void speedUp$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DcOffsetTunerT.speedUp$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle trackTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("trackTime")); - public static VarHandle trackTime$VH() { - return sdrplay_api_DcOffsetTunerT.trackTime$VH; - } - /** - * Getter for field: - * {@snippet : - * int trackTime; - * } - */ - public static int trackTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int trackTime; - * } - */ - public static void trackTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg, x); - } - public static int trackTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.trackTime$VH.get(seg.asSlice(index*sizeof())); - } - public static void trackTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.trackTime$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle refreshRateTime$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("refreshRateTime")); - public static VarHandle refreshRateTime$VH() { - return sdrplay_api_DcOffsetTunerT.refreshRateTime$VH; - } - /** - * Getter for field: - * {@snippet : - * int refreshRateTime; - * } - */ - public static int refreshRateTime$get(MemorySegment seg) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int refreshRateTime; - * } - */ - public static void refreshRateTime$set(MemorySegment seg, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg, x); - } - public static int refreshRateTime$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.get(seg.asSlice(index*sizeof())); - } - public static void refreshRateTime$set(MemorySegment seg, long index, int x) { - sdrplay_api_DcOffsetTunerT.refreshRateTime$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DebugEnable_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DebugEnable_t.java deleted file mode 100644 index 6109874ee..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DebugEnable_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_DebugEnable_t)(void* dev,enum dbgLvl); - * } - */ -public interface sdrplay_api_DebugEnable_t { - - int apply(java.lang.foreign.MemorySegment dev, int dbgLvl); - static MemorySegment allocate(sdrplay_api_DebugEnable_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DebugEnable_t_UP$MH, fi, constants$4.sdrplay_api_DebugEnable_t$FUNC, scope); - } - static sdrplay_api_DebugEnable_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _dbgLvl) -> { - try { - return (int)constants$4.sdrplay_api_DebugEnable_t_DOWN$MH.invokeExact(symbol, _dev, _dbgLvl); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DecimationT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DecimationT.java deleted file mode 100644 index 77bba6525..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DecimationT.java +++ /dev/null @@ -1,141 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char enable; - * unsigned char decimationFactor; - * unsigned char wideBandSignal; - * }; - * } - */ -public class sdrplay_api_DecimationT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DecimationT.$struct$LAYOUT; - } - static final VarHandle enable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("enable")); - public static VarHandle enable$VH() { - return sdrplay_api_DecimationT.enable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char enable; - * } - */ - public static byte enable$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char enable; - * } - */ - public static void enable$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg, x); - } - public static byte enable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.enable$VH.get(seg.asSlice(index*sizeof())); - } - public static void enable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.enable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle decimationFactor$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("decimationFactor")); - public static VarHandle decimationFactor$VH() { - return sdrplay_api_DecimationT.decimationFactor$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char decimationFactor; - * } - */ - public static byte decimationFactor$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char decimationFactor; - * } - */ - public static void decimationFactor$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg, x); - } - public static byte decimationFactor$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.decimationFactor$VH.get(seg.asSlice(index*sizeof())); - } - public static void decimationFactor$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.decimationFactor$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle wideBandSignal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("wideBandSignal")); - public static VarHandle wideBandSignal$VH() { - return sdrplay_api_DecimationT.wideBandSignal$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char wideBandSignal; - * } - */ - public static byte wideBandSignal$get(MemorySegment seg) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char wideBandSignal; - * } - */ - public static void wideBandSignal$set(MemorySegment seg, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg, x); - } - public static byte wideBandSignal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DecimationT.wideBandSignal$VH.get(seg.asSlice(index*sizeof())); - } - public static void wideBandSignal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DecimationT.wideBandSignal$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DevParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DevParamsT.java deleted file mode 100644 index c8daa8a75..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DevParamsT.java +++ /dev/null @@ -1,205 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("ppm"), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ).withName("fsFreq"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ).withName("syncUpdate"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ).withName("resetFlags"), - MemoryLayout.paddingLayout(8), - Constants$root.C_INT$LAYOUT.withName("mode"), - Constants$root.C_INT$LAYOUT.withName("samplesPerPkt"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ).withName("rsp1aParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ).withName("rsp2Params"), - MemoryLayout.paddingLayout(8), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ).withName("rspDuoParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ).withName("rspDxParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DevParamsT.$struct$LAYOUT; - } - static final VarHandle ppm$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ppm")); - public static VarHandle ppm$VH() { - return sdrplay_api_DevParamsT.ppm$VH; - } - /** - * Getter for field: - * {@snippet : - * double ppm; - * } - */ - public static double ppm$get(MemorySegment seg) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * double ppm; - * } - */ - public static void ppm$set(MemorySegment seg, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg, x); - } - public static double ppm$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DevParamsT.ppm$VH.get(seg.asSlice(index*sizeof())); - } - public static void ppm$set(MemorySegment seg, long index, double x) { - sdrplay_api_DevParamsT.ppm$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment fsFreq$slice(MemorySegment seg) { - return seg.asSlice(8, 16); - } - public static MemorySegment syncUpdate$slice(MemorySegment seg) { - return seg.asSlice(24, 8); - } - public static MemorySegment resetFlags$slice(MemorySegment seg) { - return seg.asSlice(32, 3); - } - static final VarHandle mode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("mode")); - public static VarHandle mode$VH() { - return sdrplay_api_DevParamsT.mode$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_TransferModeT mode; - * } - */ - public static int mode$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_TransferModeT mode; - * } - */ - public static void mode$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg, x); - } - public static int mode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.mode$VH.get(seg.asSlice(index*sizeof())); - } - public static void mode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.mode$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle samplesPerPkt$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("samplesPerPkt")); - public static VarHandle samplesPerPkt$VH() { - return sdrplay_api_DevParamsT.samplesPerPkt$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int samplesPerPkt; - * } - */ - public static int samplesPerPkt$get(MemorySegment seg) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int samplesPerPkt; - * } - */ - public static void samplesPerPkt$set(MemorySegment seg, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg, x); - } - public static int samplesPerPkt$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DevParamsT.samplesPerPkt$VH.get(seg.asSlice(index*sizeof())); - } - public static void samplesPerPkt$set(MemorySegment seg, long index, int x) { - sdrplay_api_DevParamsT.samplesPerPkt$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment rsp1aParams$slice(MemorySegment seg) { - return seg.asSlice(44, 2); - } - public static MemorySegment rsp2Params$slice(MemorySegment seg) { - return seg.asSlice(46, 1); - } - public static MemorySegment rspDuoParams$slice(MemorySegment seg) { - return seg.asSlice(48, 4); - } - public static MemorySegment rspDxParams$slice(MemorySegment seg) { - return seg.asSlice(52, 12); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceParamsT.java deleted file mode 100644 index c94eab93e..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceParamsT.java +++ /dev/null @@ -1,141 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_DevParamsT* devParams; - * sdrplay_api_RxChannelParamsT* rxChannelA; - * sdrplay_api_RxChannelParamsT* rxChannelB; - * }; - * } - */ -public class sdrplay_api_DeviceParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_POINTER$LAYOUT.withName("devParams"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelA"), - Constants$root.C_POINTER$LAYOUT.withName("rxChannelB") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceParamsT.$struct$LAYOUT; - } - static final VarHandle devParams$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("devParams")); - public static VarHandle devParams$VH() { - return sdrplay_api_DeviceParamsT.devParams$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_DevParamsT* devParams; - * } - */ - public static MemorySegment devParams$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_DevParamsT* devParams; - * } - */ - public static void devParams$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg, x); - } - public static MemorySegment devParams$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.devParams$VH.get(seg.asSlice(index*sizeof())); - } - public static void devParams$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.devParams$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rxChannelA$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelA")); - public static VarHandle rxChannelA$VH() { - return sdrplay_api_DeviceParamsT.rxChannelA$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; - * } - */ - public static MemorySegment rxChannelA$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelA; - * } - */ - public static void rxChannelA$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg, x); - } - public static MemorySegment rxChannelA$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelA$VH.get(seg.asSlice(index*sizeof())); - } - public static void rxChannelA$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelA$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rxChannelB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rxChannelB")); - public static VarHandle rxChannelB$VH() { - return sdrplay_api_DeviceParamsT.rxChannelB$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; - * } - */ - public static MemorySegment rxChannelB$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RxChannelParamsT* rxChannelB; - * } - */ - public static void rxChannelB$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg, x); - } - public static MemorySegment rxChannelB$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceParamsT.rxChannelB$VH.get(seg.asSlice(index*sizeof())); - } - public static void rxChannelB$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceParamsT.rxChannelB$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceT.java deleted file mode 100644 index 3edbb9a02..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DeviceT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(64, Constants$root.C_CHAR$LAYOUT).withName("SerNo"), - Constants$root.C_CHAR$LAYOUT.withName("hwVer"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner"), - Constants$root.C_INT$LAYOUT.withName("rspDuoMode"), - Constants$root.C_CHAR$LAYOUT.withName("valid"), - MemoryLayout.paddingLayout(24), - Constants$root.C_DOUBLE$LAYOUT.withName("rspDuoSampleFreq"), - Constants$root.C_POINTER$LAYOUT.withName("dev") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_DeviceT.$struct$LAYOUT; - } - public static MemorySegment SerNo$slice(MemorySegment seg) { - return seg.asSlice(0, 64); - } - static final VarHandle hwVer$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hwVer")); - public static VarHandle hwVer$VH() { - return sdrplay_api_DeviceT.hwVer$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char hwVer; - * } - */ - public static byte hwVer$get(MemorySegment seg) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char hwVer; - * } - */ - public static void hwVer$set(MemorySegment seg, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg, x); - } - public static byte hwVer$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DeviceT.hwVer$VH.get(seg.asSlice(index*sizeof())); - } - public static void hwVer$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DeviceT.hwVer$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle tuner$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner")); - public static VarHandle tuner$VH() { - return sdrplay_api_DeviceT.tuner$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; - * } - */ - public static int tuner$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_TunerSelectT tuner; - * } - */ - public static void tuner$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg, x); - } - public static int tuner$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.tuner$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.tuner$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rspDuoMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoMode")); - public static VarHandle rspDuoMode$VH() { - return sdrplay_api_DeviceT.rspDuoMode$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; - * } - */ - public static int rspDuoMode$get(MemorySegment seg) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeT rspDuoMode; - * } - */ - public static void rspDuoMode$set(MemorySegment seg, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg, x); - } - public static int rspDuoMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_DeviceT.rspDuoMode$VH.get(seg.asSlice(index*sizeof())); - } - public static void rspDuoMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_DeviceT.rspDuoMode$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle valid$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("valid")); - public static VarHandle valid$VH() { - return sdrplay_api_DeviceT.valid$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char valid; - * } - */ - public static byte valid$get(MemorySegment seg) { - return (byte)sdrplay_api_DeviceT.valid$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char valid; - * } - */ - public static void valid$set(MemorySegment seg, byte x) { - sdrplay_api_DeviceT.valid$VH.set(seg, x); - } - public static byte valid$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_DeviceT.valid$VH.get(seg.asSlice(index*sizeof())); - } - public static void valid$set(MemorySegment seg, long index, byte x) { - sdrplay_api_DeviceT.valid$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rspDuoSampleFreq$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rspDuoSampleFreq")); - public static VarHandle rspDuoSampleFreq$VH() { - return sdrplay_api_DeviceT.rspDuoSampleFreq$VH; - } - /** - * Getter for field: - * {@snippet : - * double rspDuoSampleFreq; - * } - */ - public static double rspDuoSampleFreq$get(MemorySegment seg) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * double rspDuoSampleFreq; - * } - */ - public static void rspDuoSampleFreq$set(MemorySegment seg, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg, x); - } - public static double rspDuoSampleFreq$get(MemorySegment seg, long index) { - return (double)sdrplay_api_DeviceT.rspDuoSampleFreq$VH.get(seg.asSlice(index*sizeof())); - } - public static void rspDuoSampleFreq$set(MemorySegment seg, long index, double x) { - sdrplay_api_DeviceT.rspDuoSampleFreq$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle dev$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("dev")); - public static VarHandle dev$VH() { - return sdrplay_api_DeviceT.dev$VH; - } - /** - * Getter for field: - * {@snippet : - * HANDLE dev; - * } - */ - public static MemorySegment dev$get(MemorySegment seg) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * HANDLE dev; - * } - */ - public static void dev$set(MemorySegment seg, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg, x); - } - public static MemorySegment dev$get(MemorySegment seg, long index) { - return (java.lang.foreign.MemorySegment)sdrplay_api_DeviceT.dev$VH.get(seg.asSlice(index*sizeof())); - } - public static void dev$set(MemorySegment seg, long index, MemorySegment x) { - sdrplay_api_DeviceT.dev$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DisableHeartbeat_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DisableHeartbeat_t.java deleted file mode 100644 index 5e8d760bf..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_DisableHeartbeat_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_DisableHeartbeat_t)(); - * } - */ -public interface sdrplay_api_DisableHeartbeat_t { - - int apply(); - static MemorySegment allocate(sdrplay_api_DisableHeartbeat_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_DisableHeartbeat_t_UP$MH, fi, constants$4.sdrplay_api_DisableHeartbeat_t$FUNC, scope); - } - static sdrplay_api_DisableHeartbeat_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$4.sdrplay_api_DisableHeartbeat_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ErrorInfoT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ErrorInfoT.java deleted file mode 100644 index 39945b39d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ErrorInfoT.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * char file[256]; - * char function[256]; - * int line; - * char message[1024]; - * }; - * } - */ -public class sdrplay_api_ErrorInfoT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("file"), - MemoryLayout.sequenceLayout(256, Constants$root.C_CHAR$LAYOUT).withName("function"), - Constants$root.C_INT$LAYOUT.withName("line"), - MemoryLayout.sequenceLayout(1024, Constants$root.C_CHAR$LAYOUT).withName("message") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ErrorInfoT.$struct$LAYOUT; - } - public static MemorySegment file$slice(MemorySegment seg) { - return seg.asSlice(0, 256); - } - public static MemorySegment function$slice(MemorySegment seg) { - return seg.asSlice(256, 256); - } - static final VarHandle line$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("line")); - public static VarHandle line$VH() { - return sdrplay_api_ErrorInfoT.line$VH; - } - /** - * Getter for field: - * {@snippet : - * int line; - * } - */ - public static int line$get(MemorySegment seg) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int line; - * } - */ - public static void line$set(MemorySegment seg, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg, x); - } - public static int line$get(MemorySegment seg, long index) { - return (int)sdrplay_api_ErrorInfoT.line$VH.get(seg.asSlice(index*sizeof())); - } - public static void line$set(MemorySegment seg, long index, int x) { - sdrplay_api_ErrorInfoT.line$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment message$slice(MemorySegment seg) { - return seg.asSlice(516, 1024); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventCallback_t.java deleted file mode 100644 index 48d93f7df..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventCallback_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * void (*sdrplay_api_EventCallback_t)(enum eventId,enum tuner,union * params,void* cbContext); - * } - */ -public interface sdrplay_api_EventCallback_t { - - void apply(int eventId, int tuner, java.lang.foreign.MemorySegment params, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_EventCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_EventCallback_t_UP$MH, fi, constants$0.sdrplay_api_EventCallback_t$FUNC, scope); - } - static sdrplay_api_EventCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _eventId, int _tuner, java.lang.foreign.MemorySegment _params, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_EventCallback_t_DOWN$MH.invokeExact(symbol, _eventId, _tuner, _params, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventParamsT.java deleted file mode 100644 index 81a7d3207..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_EventParamsT.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 - * **************************************************************************** - */ - -// Generated by jextract - -package io.github.dsheirer.source.tuner.sdrplay.api.v3_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.UnionLayout; -/** - * {@snippet : - * union { - * sdrplay_api_GainCbParamT gainParams; - * sdrplay_api_PowerOverloadCbParamT powerOverloadParams; - * sdrplay_api_RspDuoModeCbParamT rspDuoModeParams; - * }; - * } - */ -public class sdrplay_api_EventParamsT { - - static final UnionLayout $union$LAYOUT = MemoryLayout.unionLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ).withName("gainParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ).withName("powerOverloadParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ).withName("rspDuoModeParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_EventParamsT.$union$LAYOUT; - } - public static MemorySegment gainParams$slice(MemorySegment seg) { - return seg.asSlice(0, 16); - } - public static MemorySegment powerOverloadParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static MemorySegment rspDuoModeParams$slice(MemorySegment seg) { - return seg.asSlice(0, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_FsFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_FsFreqT.java deleted file mode 100644 index 4f880204e..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_FsFreqT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * double fsHz; - * unsigned char syncUpdate; - * unsigned char reCal; - * }; - * } - */ -public class sdrplay_api_FsFreqT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("fsHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("reCal"), - MemoryLayout.paddingLayout(48) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_FsFreqT.$struct$LAYOUT; - } - static final VarHandle fsHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsHz")); - public static VarHandle fsHz$VH() { - return sdrplay_api_FsFreqT.fsHz$VH; - } - /** - * Getter for field: - * {@snippet : - * double fsHz; - * } - */ - public static double fsHz$get(MemorySegment seg) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * double fsHz; - * } - */ - public static void fsHz$set(MemorySegment seg, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg, x); - } - public static double fsHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_FsFreqT.fsHz$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_FsFreqT.fsHz$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_FsFreqT.syncUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg, x); - } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle reCal$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("reCal")); - public static VarHandle reCal$VH() { - return sdrplay_api_FsFreqT.reCal$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char reCal; - * } - */ - public static byte reCal$get(MemorySegment seg) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char reCal; - * } - */ - public static void reCal$set(MemorySegment seg, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg, x); - } - public static byte reCal$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_FsFreqT.reCal$VH.get(seg.asSlice(index*sizeof())); - } - public static void reCal$set(MemorySegment seg, long index, byte x) { - sdrplay_api_FsFreqT.reCal$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainCbParamT.java deleted file mode 100644 index e87f9c7e0..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainCbParamT.java +++ /dev/null @@ -1,141 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned int gRdB; - * unsigned int lnaGRdB; - * double currGain; - * }; - * } - */ -public class sdrplay_api_GainCbParamT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_INT$LAYOUT.withName("lnaGRdB"), - Constants$root.C_DOUBLE$LAYOUT.withName("currGain") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainCbParamT.$struct$LAYOUT; - } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainCbParamT.gRdB$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int gRdB; - * } - */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int gRdB; - * } - */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg, x); - } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.gRdB$VH.get(seg.asSlice(index*sizeof())); - } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle lnaGRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("lnaGRdB")); - public static VarHandle lnaGRdB$VH() { - return sdrplay_api_GainCbParamT.lnaGRdB$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int lnaGRdB; - * } - */ - public static int lnaGRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int lnaGRdB; - * } - */ - public static void lnaGRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg, x); - } - public static int lnaGRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainCbParamT.lnaGRdB$VH.get(seg.asSlice(index*sizeof())); - } - public static void lnaGRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainCbParamT.lnaGRdB$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle currGain$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("currGain")); - public static VarHandle currGain$VH() { - return sdrplay_api_GainCbParamT.currGain$VH; - } - /** - * Getter for field: - * {@snippet : - * double currGain; - * } - */ - public static double currGain$get(MemorySegment seg) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * double currGain; - * } - */ - public static void currGain$set(MemorySegment seg, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg, x); - } - public static double currGain$get(MemorySegment seg, long index) { - return (double)sdrplay_api_GainCbParamT.currGain$VH.get(seg.asSlice(index*sizeof())); - } - public static void currGain$set(MemorySegment seg, long index, double x) { - sdrplay_api_GainCbParamT.currGain$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainT.java deleted file mode 100644 index 29319857b..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainT.java +++ /dev/null @@ -1,181 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * int gRdB; - * unsigned char LNAstate; - * unsigned char syncUpdate; - * sdrplay_api_MinGainReductionT minGr; - * sdrplay_api_GainValuesT gainVals; - * }; - * } - */ -public class sdrplay_api_GainT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainT.$struct$LAYOUT; - } - static final VarHandle gRdB$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("gRdB")); - public static VarHandle gRdB$VH() { - return sdrplay_api_GainT.gRdB$VH; - } - /** - * Getter for field: - * {@snippet : - * int gRdB; - * } - */ - public static int gRdB$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int gRdB; - * } - */ - public static void gRdB$set(MemorySegment seg, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg, x); - } - public static int gRdB$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.gRdB$VH.get(seg.asSlice(index*sizeof())); - } - public static void gRdB$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.gRdB$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle LNAstate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("LNAstate")); - public static VarHandle LNAstate$VH() { - return sdrplay_api_GainT.LNAstate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char LNAstate; - * } - */ - public static byte LNAstate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char LNAstate; - * } - */ - public static void LNAstate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg, x); - } - public static byte LNAstate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.LNAstate$VH.get(seg.asSlice(index*sizeof())); - } - public static void LNAstate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.LNAstate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_GainT.syncUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg, x); - } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_GainT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_GainT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle minGr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("minGr")); - public static VarHandle minGr$VH() { - return sdrplay_api_GainT.minGr$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_MinGainReductionT minGr; - * } - */ - public static int minGr$get(MemorySegment seg) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_MinGainReductionT minGr; - * } - */ - public static void minGr$set(MemorySegment seg, int x) { - sdrplay_api_GainT.minGr$VH.set(seg, x); - } - public static int minGr$get(MemorySegment seg, long index) { - return (int)sdrplay_api_GainT.minGr$VH.get(seg.asSlice(index*sizeof())); - } - public static void minGr$set(MemorySegment seg, long index, int x) { - sdrplay_api_GainT.minGr$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment gainVals$slice(MemorySegment seg) { - return seg.asSlice(12, 12); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainValuesT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainValuesT.java deleted file mode 100644 index f0dad2034..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GainValuesT.java +++ /dev/null @@ -1,141 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * float curr; - * float max; - * float min; - * }; - * } - */ -public class sdrplay_api_GainValuesT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_GainValuesT.$struct$LAYOUT; - } - static final VarHandle curr$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("curr")); - public static VarHandle curr$VH() { - return sdrplay_api_GainValuesT.curr$VH; - } - /** - * Getter for field: - * {@snippet : - * float curr; - * } - */ - public static float curr$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * float curr; - * } - */ - public static void curr$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg, x); - } - public static float curr$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.curr$VH.get(seg.asSlice(index*sizeof())); - } - public static void curr$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.curr$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle max$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("max")); - public static VarHandle max$VH() { - return sdrplay_api_GainValuesT.max$VH; - } - /** - * Getter for field: - * {@snippet : - * float max; - * } - */ - public static float max$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * float max; - * } - */ - public static void max$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg, x); - } - public static float max$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.max$VH.get(seg.asSlice(index*sizeof())); - } - public static void max$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.max$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle min$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("min")); - public static VarHandle min$VH() { - return sdrplay_api_GainValuesT.min$VH; - } - /** - * Getter for field: - * {@snippet : - * float min; - * } - */ - public static float min$get(MemorySegment seg) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * float min; - * } - */ - public static void min$set(MemorySegment seg, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg, x); - } - public static float min$get(MemorySegment seg, long index) { - return (float)sdrplay_api_GainValuesT.min$VH.get(seg.asSlice(index*sizeof())); - } - public static void min$set(MemorySegment seg, long index, float x) { - sdrplay_api_GainValuesT.min$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDeviceParams_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDeviceParams_t.java deleted file mode 100644 index ab106c626..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDeviceParams_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_GetDeviceParams_t)(void* dev,struct ** deviceParams); - * } - */ -public interface sdrplay_api_GetDeviceParams_t { - - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment deviceParams); - static MemorySegment allocate(sdrplay_api_GetDeviceParams_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_GetDeviceParams_t_UP$MH, fi, constants$5.sdrplay_api_GetDeviceParams_t$FUNC, scope); - } - static sdrplay_api_GetDeviceParams_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _deviceParams) -> { - try { - return (int)constants$5.sdrplay_api_GetDeviceParams_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_GetDevices_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDevices_t.java deleted file mode 100644 index 61749a33a..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetDevices_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_GetDevices_t)(struct * devices,unsigned int* numDevs,unsigned int maxDevs); - * } - */ -public interface sdrplay_api_GetDevices_t { - - int apply(java.lang.foreign.MemorySegment devices, java.lang.foreign.MemorySegment numDevs, int maxDevs); - static MemorySegment allocate(sdrplay_api_GetDevices_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_GetDevices_t_UP$MH, fi, constants$2.sdrplay_api_GetDevices_t$FUNC, scope); - } - static sdrplay_api_GetDevices_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _devices, java.lang.foreign.MemorySegment _numDevs, int _maxDevs) -> { - try { - return (int)constants$2.sdrplay_api_GetDevices_t_DOWN$MH.invokeExact(symbol, _devices, _numDevs, _maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetErrorString_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetErrorString_t.java deleted file mode 100644 index dbfb8e7b4..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetErrorString_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * char* (*sdrplay_api_GetErrorString_t)(enum err); - * } - */ -public interface sdrplay_api_GetErrorString_t { - - java.lang.foreign.MemorySegment apply(int err); - static MemorySegment allocate(sdrplay_api_GetErrorString_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetErrorString_t_UP$MH, fi, constants$3.sdrplay_api_GetErrorString_t$FUNC, scope); - } - static sdrplay_api_GetErrorString_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (int _err) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetErrorString_t_DOWN$MH.invokeExact(symbol, _err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastErrorByType_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastErrorByType_t.java deleted file mode 100644 index a4dfc82c1..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastErrorByType_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * struct * (*sdrplay_api_GetLastErrorByType_t)(struct * device,int type,unsigned long long* time); - * } - */ -public interface sdrplay_api_GetLastErrorByType_t { - - java.lang.foreign.MemorySegment apply(java.lang.foreign.MemorySegment device, int type, java.lang.foreign.MemorySegment time); - static MemorySegment allocate(sdrplay_api_GetLastErrorByType_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$4.sdrplay_api_GetLastErrorByType_t_UP$MH, fi, constants$4.sdrplay_api_GetLastErrorByType_t$FUNC, scope); - } - static sdrplay_api_GetLastErrorByType_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _device, int _type, java.lang.foreign.MemorySegment _time) -> { - try { - return (java.lang.foreign.MemorySegment)constants$4.sdrplay_api_GetLastErrorByType_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_GetLastError_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastError_t.java deleted file mode 100644 index f20d55394..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_GetLastError_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * struct * (*sdrplay_api_GetLastError_t)(struct * device); - * } - */ -public interface sdrplay_api_GetLastError_t { - - java.lang.foreign.MemorySegment apply(java.lang.foreign.MemorySegment device); - static MemorySegment allocate(sdrplay_api_GetLastError_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_GetLastError_t_UP$MH, fi, constants$3.sdrplay_api_GetLastError_t$FUNC, scope); - } - static sdrplay_api_GetLastError_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _device) -> { - try { - return (java.lang.foreign.MemorySegment)constants$3.sdrplay_api_GetLastError_t_DOWN$MH.invokeExact(symbol, _device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Init_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Init_t.java deleted file mode 100644 index aa981ea32..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Init_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_Init_t)(void* dev,struct * callbackFns,void* cbContext); - * } - */ -public interface sdrplay_api_Init_t { - - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment callbackFns, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_Init_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Init_t_UP$MH, fi, constants$5.sdrplay_api_Init_t$FUNC, scope); - } - static sdrplay_api_Init_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _callbackFns, java.lang.foreign.MemorySegment _cbContext) -> { - try { - return (int)constants$5.sdrplay_api_Init_t_DOWN$MH.invokeExact(symbol, _dev, _callbackFns, _cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_LockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_LockDeviceApi_t.java deleted file mode 100644 index 3c555969d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_LockDeviceApi_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_LockDeviceApi_t)(); - * } - */ -public interface sdrplay_api_LockDeviceApi_t { - - int apply(); - static MemorySegment allocate(sdrplay_api_LockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$1.sdrplay_api_LockDeviceApi_t_UP$MH, fi, constants$1.sdrplay_api_LockDeviceApi_t$FUNC, scope); - } - static sdrplay_api_LockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$1.sdrplay_api_LockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Open_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Open_t.java deleted file mode 100644 index 87e4ab360..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Open_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_Open_t)(); - * } - */ -public interface sdrplay_api_Open_t { - - int apply(); - static MemorySegment allocate(sdrplay_api_Open_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_Open_t_UP$MH, fi, constants$0.sdrplay_api_Open_t$FUNC, scope); - } - static sdrplay_api_Open_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$0.sdrplay_api_Open_t_DOWN$MH.invokeExact(symbol); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - }; - } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_PowerOverloadCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_PowerOverloadCbParamT.java deleted file mode 100644 index d79592637..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_PowerOverloadCbParamT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * }; - * } - */ -public class sdrplay_api_PowerOverloadCbParamT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("powerOverloadChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_PowerOverloadCbParamT.$struct$LAYOUT; - } - static final VarHandle powerOverloadChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("powerOverloadChangeType")); - public static VarHandle powerOverloadChangeType$VH() { - return sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * } - */ - public static int powerOverloadChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_PowerOverloadCbEventIdT powerOverloadChangeType; - * } - */ - public static void powerOverloadChangeType$set(MemorySegment seg, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg, x); - } - public static int powerOverloadChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.get(seg.asSlice(index*sizeof())); - } - public static void powerOverloadChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_PowerOverloadCbParamT.powerOverloadChangeType$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ReleaseDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ReleaseDevice_t.java deleted file mode 100644 index ad32fa3ac..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ReleaseDevice_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_ReleaseDevice_t)(struct * device); - * } - */ -public interface sdrplay_api_ReleaseDevice_t { - - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_ReleaseDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$3.sdrplay_api_ReleaseDevice_t_UP$MH, fi, constants$3.sdrplay_api_ReleaseDevice_t$FUNC, scope); - } - static sdrplay_api_ReleaseDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$3.sdrplay_api_ReleaseDevice_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_ResetFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ResetFlagsT.java deleted file mode 100644 index 339823ba9..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_ResetFlagsT.java +++ /dev/null @@ -1,141 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * unsigned char resetFsUpdate; - * }; - * } - */ -public class sdrplay_api_ResetFlagsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetFsUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_ResetFlagsT.$struct$LAYOUT; - } - static final VarHandle resetGainUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetGainUpdate")); - public static VarHandle resetGainUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetGainUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char resetGainUpdate; - * } - */ - public static byte resetGainUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char resetGainUpdate; - * } - */ - public static void resetGainUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg, x); - } - public static byte resetGainUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetGainUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetGainUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetGainUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle resetRfUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetRfUpdate")); - public static VarHandle resetRfUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetRfUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char resetRfUpdate; - * } - */ - public static byte resetRfUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char resetRfUpdate; - * } - */ - public static void resetRfUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg, x); - } - public static byte resetRfUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetRfUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetRfUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetRfUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle resetFsUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetFsUpdate")); - public static VarHandle resetFsUpdate$VH() { - return sdrplay_api_ResetFlagsT.resetFsUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char resetFsUpdate; - * } - */ - public static byte resetFsUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char resetFsUpdate; - * } - */ - public static void resetFsUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg, x); - } - public static byte resetFsUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_ResetFlagsT.resetFsUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetFsUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_ResetFlagsT.resetFsUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RfFreqT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RfFreqT.java deleted file mode 100644 index fb83fb160..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RfFreqT.java +++ /dev/null @@ -1,112 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * double rfHz; - * unsigned char syncUpdate; - * }; - * } - */ -public class sdrplay_api_RfFreqT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RfFreqT.$struct$LAYOUT; - } - static final VarHandle rfHz$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfHz")); - public static VarHandle rfHz$VH() { - return sdrplay_api_RfFreqT.rfHz$VH; - } - /** - * Getter for field: - * {@snippet : - * double rfHz; - * } - */ - public static double rfHz$get(MemorySegment seg) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * double rfHz; - * } - */ - public static void rfHz$set(MemorySegment seg, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg, x); - } - public static double rfHz$get(MemorySegment seg, long index) { - return (double)sdrplay_api_RfFreqT.rfHz$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfHz$set(MemorySegment seg, long index, double x) { - sdrplay_api_RfFreqT.rfHz$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle syncUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("syncUpdate")); - public static VarHandle syncUpdate$VH() { - return sdrplay_api_RfFreqT.syncUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static byte syncUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char syncUpdate; - * } - */ - public static void syncUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg, x); - } - public static byte syncUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RfFreqT.syncUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void syncUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RfFreqT.syncUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aParamsT.java deleted file mode 100644 index 14ef1acdf..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aParamsT.java +++ /dev/null @@ -1,111 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * }; - * } - */ -public class sdrplay_api_Rsp1aParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aParamsT.$struct$LAYOUT; - } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg, x); - } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aTunerParamsT.java deleted file mode 100644 index 5e853e96d..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp1aTunerParamsT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char biasTEnable; - * }; - * } - */ -public class sdrplay_api_Rsp1aTunerParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp1aTunerParamsT.$struct$LAYOUT; - } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp1aTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2ParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2ParamsT.java deleted file mode 100644 index bc8a29a3c..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2ParamsT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char extRefOutputEn; - * }; - * } - */ -public class sdrplay_api_Rsp2ParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2ParamsT.$struct$LAYOUT; - } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char extRefOutputEn; - * } - */ - public static byte extRefOutputEn$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char extRefOutputEn; - * } - */ - public static void extRefOutputEn$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg, x); - } - public static byte extRefOutputEn$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); - } - public static void extRefOutputEn$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2ParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2TunerParamsT.java deleted file mode 100644 index ce26c4227..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Rsp2TunerParamsT.java +++ /dev/null @@ -1,173 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char biasTEnable; - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * }; - * } - */ -public class sdrplay_api_Rsp2TunerParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_Rsp2TunerParamsT.$struct$LAYOUT; - } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle amPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("amPortSel")); - public static VarHandle amPortSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.amPortSel$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * } - */ - public static int amPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AmPortSelectT amPortSel; - * } - */ - public static void amPortSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg, x); - } - public static int amPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void amPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.amPortSel$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_Rsp2TunerParamsT.antennaSel$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * } - */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_Rsp2_AntennaSelectT antennaSel; - * } - */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_Rsp2TunerParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_Rsp2TunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoModeCbParamT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoModeCbParamT.java deleted file mode 100644 index 59e0a8e78..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoModeCbParamT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * }; - * } - */ -public class sdrplay_api_RspDuoModeCbParamT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("modeChangeType") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoModeCbParamT.$struct$LAYOUT; - } - static final VarHandle modeChangeType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("modeChangeType")); - public static VarHandle modeChangeType$VH() { - return sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * } - */ - public static int modeChangeType$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RspDuoModeCbEventIdT modeChangeType; - * } - */ - public static void modeChangeType$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg, x); - } - public static int modeChangeType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.get(seg.asSlice(index*sizeof())); - } - public static void modeChangeType$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoModeCbParamT.modeChangeType$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoParamsT.java deleted file mode 100644 index 06a949941..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoParamsT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * int extRefOutputEn; - * }; - * } - */ -public class sdrplay_api_RspDuoParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("extRefOutputEn") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoParamsT.$struct$LAYOUT; - } - static final VarHandle extRefOutputEn$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("extRefOutputEn")); - public static VarHandle extRefOutputEn$VH() { - return sdrplay_api_RspDuoParamsT.extRefOutputEn$VH; - } - /** - * Getter for field: - * {@snippet : - * int extRefOutputEn; - * } - */ - public static int extRefOutputEn$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int extRefOutputEn; - * } - */ - public static void extRefOutputEn$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg, x); - } - public static int extRefOutputEn$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.get(seg.asSlice(index*sizeof())); - } - public static void extRefOutputEn$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoParamsT.extRefOutputEn$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoTunerParamsT.java deleted file mode 100644 index d4bb24886..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuoTunerParamsT.java +++ /dev/null @@ -1,211 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate") - ).withName("resetSlaveFlags"), - MemoryLayout.paddingLayout(24) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuoTunerParamsT.$struct$LAYOUT; - } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle tuner1AmPortSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmPortSel")); - public static VarHandle tuner1AmPortSel$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; - * } - */ - public static int tuner1AmPortSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RspDuo_AmPortSelectT tuner1AmPortSel; - * } - */ - public static void tuner1AmPortSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg, x); - } - public static int tuner1AmPortSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner1AmPortSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmPortSel$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle tuner1AmNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("tuner1AmNotchEnable")); - public static VarHandle tuner1AmNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char tuner1AmNotchEnable; - * } - */ - public static byte tuner1AmNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char tuner1AmNotchEnable; - * } - */ - public static void tuner1AmNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg, x); - } - public static byte tuner1AmNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void tuner1AmNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.tuner1AmNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg, x); - } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuoTunerParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment resetSlaveFlags$slice(MemorySegment seg) { - return seg.asSlice(11, 2); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuo_ResetSlaveFlagsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuo_ResetSlaveFlagsT.java deleted file mode 100644 index a103cd713..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDuo_ResetSlaveFlagsT.java +++ /dev/null @@ -1,111 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char resetGainUpdate; - * unsigned char resetRfUpdate; - * }; - * } - */ -public class sdrplay_api_RspDuo_ResetSlaveFlagsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDuo_ResetSlaveFlagsT.$struct$LAYOUT; - } - static final VarHandle resetGainUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetGainUpdate")); - public static VarHandle resetGainUpdate$VH() { - return sdrplay_api_RspDuo_ResetSlaveFlagsT.resetGainUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char resetGainUpdate; - * } - */ - public static byte resetGainUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuo_ResetSlaveFlagsT.resetGainUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char resetGainUpdate; - * } - */ - public static void resetGainUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuo_ResetSlaveFlagsT.resetGainUpdate$VH.set(seg, x); - } - public static byte resetGainUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuo_ResetSlaveFlagsT.resetGainUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetGainUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuo_ResetSlaveFlagsT.resetGainUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle resetRfUpdate$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("resetRfUpdate")); - public static VarHandle resetRfUpdate$VH() { - return sdrplay_api_RspDuo_ResetSlaveFlagsT.resetRfUpdate$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char resetRfUpdate; - * } - */ - public static byte resetRfUpdate$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDuo_ResetSlaveFlagsT.resetRfUpdate$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char resetRfUpdate; - * } - */ - public static void resetRfUpdate$set(MemorySegment seg, byte x) { - sdrplay_api_RspDuo_ResetSlaveFlagsT.resetRfUpdate$VH.set(seg, x); - } - public static byte resetRfUpdate$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDuo_ResetSlaveFlagsT.resetRfUpdate$VH.get(seg.asSlice(index*sizeof())); - } - public static void resetRfUpdate$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDuo_ResetSlaveFlagsT.resetRfUpdate$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxParamsT.java deleted file mode 100644 index 7deb4fabb..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxParamsT.java +++ /dev/null @@ -1,203 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned char hdrEnable; - * unsigned char biasTEnable; - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * unsigned char rfNotchEnable; - * unsigned char rfDabNotchEnable; - * }; - * } - */ -public class sdrplay_api_RspDxParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("hdrEnable"), - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.paddingLayout(16) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxParamsT.$struct$LAYOUT; - } - static final VarHandle hdrEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrEnable")); - public static VarHandle hdrEnable$VH() { - return sdrplay_api_RspDxParamsT.hdrEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char hdrEnable; - * } - */ - public static byte hdrEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char hdrEnable; - * } - */ - public static void hdrEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg, x); - } - public static byte hdrEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.hdrEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void hdrEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.hdrEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle biasTEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("biasTEnable")); - public static VarHandle biasTEnable$VH() { - return sdrplay_api_RspDxParamsT.biasTEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static byte biasTEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char biasTEnable; - * } - */ - public static void biasTEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg, x); - } - public static byte biasTEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.biasTEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void biasTEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.biasTEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle antennaSel$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("antennaSel")); - public static VarHandle antennaSel$VH() { - return sdrplay_api_RspDxParamsT.antennaSel$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * } - */ - public static int antennaSel$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_AntennaSelectT antennaSel; - * } - */ - public static void antennaSel$set(MemorySegment seg, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg, x); - } - public static int antennaSel$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxParamsT.antennaSel$VH.get(seg.asSlice(index*sizeof())); - } - public static void antennaSel$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxParamsT.antennaSel$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfNotchEnable")); - public static VarHandle rfNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static byte rfNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfNotchEnable; - * } - */ - public static void rfNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg, x); - } - public static byte rfNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfDabNotchEnable$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfDabNotchEnable")); - public static VarHandle rfDabNotchEnable$VH() { - return sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static byte rfDabNotchEnable$get(MemorySegment seg) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned char rfDabNotchEnable; - * } - */ - public static void rfDabNotchEnable$set(MemorySegment seg, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg, x); - } - public static byte rfDabNotchEnable$get(MemorySegment seg, long index) { - return (byte)sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfDabNotchEnable$set(MemorySegment seg, long index, byte x) { - sdrplay_api_RspDxParamsT.rfDabNotchEnable$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxTunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxTunerParamsT.java deleted file mode 100644 index 290438d43..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RspDxTunerParamsT.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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * }; - * } - */ -public class sdrplay_api_RspDxTunerParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RspDxTunerParamsT.$struct$LAYOUT; - } - static final VarHandle hdrBw$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("hdrBw")); - public static VarHandle hdrBw$VH() { - return sdrplay_api_RspDxTunerParamsT.hdrBw$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * } - */ - public static int hdrBw$get(MemorySegment seg) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_RspDx_HdrModeBwT hdrBw; - * } - */ - public static void hdrBw$set(MemorySegment seg, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg, x); - } - public static int hdrBw$get(MemorySegment seg, long index) { - return (int)sdrplay_api_RspDxTunerParamsT.hdrBw$VH.get(seg.asSlice(index*sizeof())); - } - public static void hdrBw$set(MemorySegment seg, long index, int x) { - sdrplay_api_RspDxTunerParamsT.hdrBw$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RxChannelParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RxChannelParamsT.java deleted file mode 100644 index bd8ec9c8e..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_RxChannelParamsT.java +++ /dev/null @@ -1,155 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ).withName("tunerParams"), - MemoryLayout.structLayout( - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("DCenable"), - Constants$root.C_CHAR$LAYOUT.withName("IQenable") - ).withName("dcOffset"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("enable"), - Constants$root.C_CHAR$LAYOUT.withName("decimationFactor"), - Constants$root.C_CHAR$LAYOUT.withName("wideBandSignal") - ).withName("decimation"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("enable"), - Constants$root.C_INT$LAYOUT.withName("setPoint_dBfs"), - Constants$root.C_SHORT$LAYOUT.withName("attack_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_delay_ms"), - Constants$root.C_SHORT$LAYOUT.withName("decay_threshold_dB"), - Constants$root.C_INT$LAYOUT.withName("syncUpdate") - ).withName("agc"), - Constants$root.C_INT$LAYOUT.withName("adsbMode") - ).withName("ctrlParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable") - ).withName("rsp1aTunerParams"), - MemoryLayout.paddingLayout(24), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("amPortSel"), - Constants$root.C_INT$LAYOUT.withName("antennaSel"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - MemoryLayout.paddingLayout(24) - ).withName("rsp2TunerParams"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("biasTEnable"), - MemoryLayout.paddingLayout(24), - Constants$root.C_INT$LAYOUT.withName("tuner1AmPortSel"), - Constants$root.C_CHAR$LAYOUT.withName("tuner1AmNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfNotchEnable"), - Constants$root.C_CHAR$LAYOUT.withName("rfDabNotchEnable"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("resetGainUpdate"), - Constants$root.C_CHAR$LAYOUT.withName("resetRfUpdate") - ).withName("resetSlaveFlags"), - MemoryLayout.paddingLayout(24) - ).withName("rspDuoTunerParams"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("hdrBw") - ).withName("rspDxTunerParams") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_RxChannelParamsT.$struct$LAYOUT; - } - public static MemorySegment tunerParams$slice(MemorySegment seg) { - return seg.asSlice(0, 72); - } - public static MemorySegment ctrlParams$slice(MemorySegment seg) { - return seg.asSlice(72, 32); - } - public static MemorySegment rsp1aTunerParams$slice(MemorySegment seg) { - return seg.asSlice(104, 1); - } - public static MemorySegment rsp2TunerParams$slice(MemorySegment seg) { - return seg.asSlice(108, 16); - } - public static MemorySegment rspDuoTunerParams$slice(MemorySegment seg) { - return seg.asSlice(124, 16); - } - public static MemorySegment rspDxTunerParams$slice(MemorySegment seg) { - return seg.asSlice(140, 4); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SelectDevice_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SelectDevice_t.java deleted file mode 100644 index 701420565..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SelectDevice_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_SelectDevice_t)(struct * device); - * } - */ -public interface sdrplay_api_SelectDevice_t { - - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_SelectDevice_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_SelectDevice_t_UP$MH, fi, constants$2.sdrplay_api_SelectDevice_t$FUNC, scope); - } - static sdrplay_api_SelectDevice_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$2.sdrplay_api_SelectDevice_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_StreamCallback_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCallback_t.java deleted file mode 100644 index aa3832c41..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCallback_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * void (*sdrplay_api_StreamCallback_t)(short* xi,short* xq,struct * params,unsigned int numSamples,unsigned int reset,void* cbContext); - * } - */ -public interface sdrplay_api_StreamCallback_t { - - void apply(java.lang.foreign.MemorySegment xi, java.lang.foreign.MemorySegment xq, java.lang.foreign.MemorySegment params, int numSamples, int reset, java.lang.foreign.MemorySegment cbContext); - static MemorySegment allocate(sdrplay_api_StreamCallback_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$0.sdrplay_api_StreamCallback_t_UP$MH, fi, constants$0.sdrplay_api_StreamCallback_t$FUNC, scope); - } - static sdrplay_api_StreamCallback_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _xi, java.lang.foreign.MemorySegment _xq, java.lang.foreign.MemorySegment _params, int _numSamples, int _reset, java.lang.foreign.MemorySegment _cbContext) -> { - try { - constants$0.sdrplay_api_StreamCallback_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_StreamCbParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCbParamsT.java deleted file mode 100644 index 913df31cd..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_StreamCbParamsT.java +++ /dev/null @@ -1,201 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned int firstSampleNum; - * int grChanged; - * int rfChanged; - * int fsChanged; - * unsigned int numSamples; - * }; - * } - */ -public class sdrplay_api_StreamCbParamsT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("firstSampleNum"), - Constants$root.C_INT$LAYOUT.withName("grChanged"), - Constants$root.C_INT$LAYOUT.withName("rfChanged"), - Constants$root.C_INT$LAYOUT.withName("fsChanged"), - Constants$root.C_INT$LAYOUT.withName("numSamples") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_StreamCbParamsT.$struct$LAYOUT; - } - static final VarHandle firstSampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("firstSampleNum")); - public static VarHandle firstSampleNum$VH() { - return sdrplay_api_StreamCbParamsT.firstSampleNum$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int firstSampleNum; - * } - */ - public static int firstSampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int firstSampleNum; - * } - */ - public static void firstSampleNum$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg, x); - } - public static int firstSampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.firstSampleNum$VH.get(seg.asSlice(index*sizeof())); - } - public static void firstSampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.firstSampleNum$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle grChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("grChanged")); - public static VarHandle grChanged$VH() { - return sdrplay_api_StreamCbParamsT.grChanged$VH; - } - /** - * Getter for field: - * {@snippet : - * int grChanged; - * } - */ - public static int grChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int grChanged; - * } - */ - public static void grChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg, x); - } - public static int grChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.grChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void grChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.grChanged$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle rfChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("rfChanged")); - public static VarHandle rfChanged$VH() { - return sdrplay_api_StreamCbParamsT.rfChanged$VH; - } - /** - * Getter for field: - * {@snippet : - * int rfChanged; - * } - */ - public static int rfChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int rfChanged; - * } - */ - public static void rfChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg, x); - } - public static int rfChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.rfChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void rfChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.rfChanged$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle fsChanged$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("fsChanged")); - public static VarHandle fsChanged$VH() { - return sdrplay_api_StreamCbParamsT.fsChanged$VH; - } - /** - * Getter for field: - * {@snippet : - * int fsChanged; - * } - */ - public static int fsChanged$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * int fsChanged; - * } - */ - public static void fsChanged$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg, x); - } - public static int fsChanged$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.fsChanged$VH.get(seg.asSlice(index*sizeof())); - } - public static void fsChanged$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.fsChanged$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle numSamples$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("numSamples")); - public static VarHandle numSamples$VH() { - return sdrplay_api_StreamCbParamsT.numSamples$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int numSamples; - * } - */ - public static int numSamples$get(MemorySegment seg) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int numSamples; - * } - */ - public static void numSamples$set(MemorySegment seg, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg, x); - } - public static int numSamples$get(MemorySegment seg, long index) { - return (int)sdrplay_api_StreamCbParamsT.numSamples$VH.get(seg.asSlice(index*sizeof())); - } - public static void numSamples$set(MemorySegment seg, long index, int x) { - sdrplay_api_StreamCbParamsT.numSamples$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoActiveTuner_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoActiveTuner_t.java deleted file mode 100644 index 5e38a6f6a..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoActiveTuner_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoActiveTuner_t)(void* dev,enum * tuner,enum tuner1AmPortSel); - * } - */ -public interface sdrplay_api_SwapRspDuoActiveTuner_t { - - int apply(java.lang.foreign.MemorySegment dev, java.lang.foreign.MemorySegment tuner, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoActiveTuner_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoActiveTuner_t$FUNC, scope); - } - static sdrplay_api_SwapRspDuoActiveTuner_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, java.lang.foreign.MemorySegment _tuner, int _tuner1AmPortSel) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoActiveTuner_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java deleted file mode 100644 index 4b4883a96..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t)(double* currentSampleRate,double newSampleRate); - * } - */ -public interface sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t { - - int apply(java.lang.foreign.MemorySegment currentSampleRate, double newSampleRate); - static MemorySegment allocate(sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_UP$MH, fi, constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t$FUNC, scope); - } - static sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currentSampleRate, double _newSampleRate) -> { - try { - return (int)constants$6.sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_SwapRspDuoMode_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoMode_t.java deleted file mode 100644 index 8b317c314..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SwapRspDuoMode_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_SwapRspDuoMode_t)(struct * currDevice,struct ** deviceParams,enum rspDuoMode,double sampleRate,enum tuner,enum bwType,enum ifType,enum tuner1AmPortSel); - * } - */ -public interface sdrplay_api_SwapRspDuoMode_t { - - int apply(java.lang.foreign.MemorySegment currDevice, java.lang.foreign.MemorySegment deviceParams, int rspDuoMode, double sampleRate, int tuner, int bwType, int ifType, int tuner1AmPortSel); - static MemorySegment allocate(sdrplay_api_SwapRspDuoMode_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$7.sdrplay_api_SwapRspDuoMode_t_UP$MH, fi, constants$7.sdrplay_api_SwapRspDuoMode_t$FUNC, scope); - } - static sdrplay_api_SwapRspDuoMode_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _currDevice, java.lang.foreign.MemorySegment _deviceParams, int _rspDuoMode, double _sampleRate, int _tuner, int _bwType, int _ifType, int _tuner1AmPortSel) -> { - try { - return (int)constants$7.sdrplay_api_SwapRspDuoMode_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_SyncUpdateT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SyncUpdateT.java deleted file mode 100644 index bcdf90998..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_SyncUpdateT.java +++ /dev/null @@ -1,111 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * struct { - * unsigned int sampleNum; - * unsigned int period; - * }; - * } - */ -public class sdrplay_api_SyncUpdateT { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("sampleNum"), - Constants$root.C_INT$LAYOUT.withName("period") - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_SyncUpdateT.$struct$LAYOUT; - } - static final VarHandle sampleNum$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("sampleNum")); - public static VarHandle sampleNum$VH() { - return sdrplay_api_SyncUpdateT.sampleNum$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int sampleNum; - * } - */ - public static int sampleNum$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int sampleNum; - * } - */ - public static void sampleNum$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg, x); - } - public static int sampleNum$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.sampleNum$VH.get(seg.asSlice(index*sizeof())); - } - public static void sampleNum$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.sampleNum$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle period$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("period")); - public static VarHandle period$VH() { - return sdrplay_api_SyncUpdateT.period$VH; - } - /** - * Getter for field: - * {@snippet : - * unsigned int period; - * } - */ - public static int period$get(MemorySegment seg) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * unsigned int period; - * } - */ - public static void period$set(MemorySegment seg, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg, x); - } - public static int period$get(MemorySegment seg, long index) { - return (int)sdrplay_api_SyncUpdateT.period$VH.get(seg.asSlice(index*sizeof())); - } - public static void period$set(MemorySegment seg, long index, int x) { - sdrplay_api_SyncUpdateT.period$VH.set(seg.asSlice(index*sizeof()), x); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_TunerParamsT.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_TunerParamsT.java deleted file mode 100644 index 0531ac7e3..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_TunerParamsT.java +++ /dev/null @@ -1,179 +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_14; - -import java.lang.foreign.MemoryLayout; -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentAllocator; -import java.lang.foreign.SegmentScope; -import java.lang.foreign.StructLayout; -import java.lang.invoke.VarHandle; -/** - * {@snippet : - * 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 { - - static final StructLayout $struct$LAYOUT = MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("bwType"), - Constants$root.C_INT$LAYOUT.withName("ifType"), - Constants$root.C_INT$LAYOUT.withName("loMode"), - MemoryLayout.structLayout( - Constants$root.C_INT$LAYOUT.withName("gRdB"), - Constants$root.C_CHAR$LAYOUT.withName("LNAstate"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("minGr"), - MemoryLayout.structLayout( - Constants$root.C_FLOAT$LAYOUT.withName("curr"), - Constants$root.C_FLOAT$LAYOUT.withName("max"), - Constants$root.C_FLOAT$LAYOUT.withName("min") - ).withName("gainVals") - ).withName("gain"), - MemoryLayout.paddingLayout(32), - MemoryLayout.structLayout( - Constants$root.C_DOUBLE$LAYOUT.withName("rfHz"), - Constants$root.C_CHAR$LAYOUT.withName("syncUpdate"), - MemoryLayout.paddingLayout(56) - ).withName("rfFreq"), - MemoryLayout.structLayout( - Constants$root.C_CHAR$LAYOUT.withName("dcCal"), - Constants$root.C_CHAR$LAYOUT.withName("speedUp"), - MemoryLayout.paddingLayout(16), - Constants$root.C_INT$LAYOUT.withName("trackTime"), - Constants$root.C_INT$LAYOUT.withName("refreshRateTime") - ).withName("dcOffsetTuner"), - MemoryLayout.paddingLayout(32) - ); - public static MemoryLayout $LAYOUT() { - return sdrplay_api_TunerParamsT.$struct$LAYOUT; - } - static final VarHandle bwType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("bwType")); - public static VarHandle bwType$VH() { - return sdrplay_api_TunerParamsT.bwType$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_Bw_MHzT bwType; - * } - */ - public static int bwType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_Bw_MHzT bwType; - * } - */ - public static void bwType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg, x); - } - public static int bwType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.bwType$VH.get(seg.asSlice(index*sizeof())); - } - public static void bwType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.bwType$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle ifType$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("ifType")); - public static VarHandle ifType$VH() { - return sdrplay_api_TunerParamsT.ifType$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_If_kHzT ifType; - * } - */ - public static int ifType$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_If_kHzT ifType; - * } - */ - public static void ifType$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg, x); - } - public static int ifType$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.ifType$VH.get(seg.asSlice(index*sizeof())); - } - public static void ifType$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.ifType$VH.set(seg.asSlice(index*sizeof()), x); - } - static final VarHandle loMode$VH = $struct$LAYOUT.varHandle(MemoryLayout.PathElement.groupElement("loMode")); - public static VarHandle loMode$VH() { - return sdrplay_api_TunerParamsT.loMode$VH; - } - /** - * Getter for field: - * {@snippet : - * sdrplay_api_LoModeT loMode; - * } - */ - public static int loMode$get(MemorySegment seg) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg); - } - /** - * Setter for field: - * {@snippet : - * sdrplay_api_LoModeT loMode; - * } - */ - public static void loMode$set(MemorySegment seg, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg, x); - } - public static int loMode$get(MemorySegment seg, long index) { - return (int)sdrplay_api_TunerParamsT.loMode$VH.get(seg.asSlice(index*sizeof())); - } - public static void loMode$set(MemorySegment seg, long index, int x) { - sdrplay_api_TunerParamsT.loMode$VH.set(seg.asSlice(index*sizeof()), x); - } - public static MemorySegment gain$slice(MemorySegment seg) { - return seg.asSlice(12, 24); - } - public static MemorySegment rfFreq$slice(MemorySegment seg) { - return seg.asSlice(40, 16); - } - public static MemorySegment dcOffsetTuner$slice(MemorySegment seg) { - return seg.asSlice(56, 12); - } - public static long sizeof() { return $LAYOUT().byteSize(); } - public static MemorySegment allocate(SegmentAllocator allocator) { return allocator.allocate($LAYOUT()); } - public static MemorySegment allocateArray(long len, SegmentAllocator allocator) { - return allocator.allocate(MemoryLayout.sequenceLayout(len, $LAYOUT())); - } - public static MemorySegment ofAddress(MemorySegment addr, SegmentScope scope) { return RuntimeHelper.asArray(addr, $LAYOUT(), 1, scope); } -} - - diff --git a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Uninit_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Uninit_t.java deleted file mode 100644 index 2342fde1b..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Uninit_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_Uninit_t)(void* dev); - * } - */ -public interface sdrplay_api_Uninit_t { - - int apply(java.lang.foreign.MemorySegment dev); - static MemorySegment allocate(sdrplay_api_Uninit_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$5.sdrplay_api_Uninit_t_UP$MH, fi, constants$5.sdrplay_api_Uninit_t$FUNC, scope); - } - static sdrplay_api_Uninit_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev) -> { - try { - return (int)constants$5.sdrplay_api_Uninit_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_UnlockDeviceApi_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_UnlockDeviceApi_t.java deleted file mode 100644 index ae67c29ae..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_UnlockDeviceApi_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_UnlockDeviceApi_t)(); - * } - */ -public interface sdrplay_api_UnlockDeviceApi_t { - - int apply(); - static MemorySegment allocate(sdrplay_api_UnlockDeviceApi_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$2.sdrplay_api_UnlockDeviceApi_t_UP$MH, fi, constants$2.sdrplay_api_UnlockDeviceApi_t$FUNC, scope); - } - static sdrplay_api_UnlockDeviceApi_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return () -> { - try { - return (int)constants$2.sdrplay_api_UnlockDeviceApi_t_DOWN$MH.invokeExact(symbol); - } 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_14/sdrplay_api_Update_t.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Update_t.java deleted file mode 100644 index f5b976c0f..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_Update_t.java +++ /dev/null @@ -1,49 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.foreign.SegmentScope; -/** - * {@snippet : - * enum (*sdrplay_api_Update_t)(void* dev,enum tuner,enum reasonForUpdate,enum reasonForUpdateExt1); - * } - */ -public interface sdrplay_api_Update_t { - - int apply(java.lang.foreign.MemorySegment dev, int tuner, int reasonForUpdate, int reasonForUpdateExt1); - static MemorySegment allocate(sdrplay_api_Update_t fi, SegmentScope scope) { - return RuntimeHelper.upcallStub(constants$6.sdrplay_api_Update_t_UP$MH, fi, constants$6.sdrplay_api_Update_t$FUNC, scope); - } - static sdrplay_api_Update_t ofAddress(MemorySegment addr, SegmentScope scope) { - MemorySegment symbol = MemorySegment.ofAddress(addr.address(), 0, scope); - return (java.lang.foreign.MemorySegment _dev, int _tuner, int _reasonForUpdate, int _reasonForUpdateExt1) -> { - try { - return (int)constants$6.sdrplay_api_Update_t_DOWN$MH.invokeExact(symbol, _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_14/sdrplay_api_h.java b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_h.java deleted file mode 100644 index 10c4f1099..000000000 --- a/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_14/sdrplay_api_h.java +++ /dev/null @@ -1,1735 +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_14; - -import java.lang.foreign.MemorySegment; -import java.lang.invoke.MethodHandle; - -import static java.lang.foreign.ValueLayout.OfAddress; -import static java.lang.foreign.ValueLayout.OfByte; -import static java.lang.foreign.ValueLayout.OfDouble; -import static java.lang.foreign.ValueLayout.OfFloat; -import static java.lang.foreign.ValueLayout.OfInt; -import static java.lang.foreign.ValueLayout.OfLong; -import static java.lang.foreign.ValueLayout.OfShort; -public class sdrplay_api_h { - - public static final OfByte C_CHAR = Constants$root.C_CHAR$LAYOUT; - public static final OfShort C_SHORT = Constants$root.C_SHORT$LAYOUT; - public static final OfInt C_INT = Constants$root.C_INT$LAYOUT; - public static final OfLong C_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfLong C_LONG_LONG = Constants$root.C_LONG_LONG$LAYOUT; - public static final OfFloat C_FLOAT = Constants$root.C_FLOAT$LAYOUT; - public static final OfDouble C_DOUBLE = Constants$root.C_DOUBLE$LAYOUT; - public static final OfAddress C_POINTER = Constants$root.C_POINTER$LAYOUT; - /** - * {@snippet : - * #define RSPIA_NUM_LNA_STATES 10 - * } - */ - public static int RSPIA_NUM_LNA_STATES() { - return (int)10L; - } - /** - * {@snippet : - * #define RSPIA_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPIA_NUM_LNA_STATES_AM() { - return (int)7L; - } - /** - * {@snippet : - * #define RSPIA_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPIA_NUM_LNA_STATES_LBAND() { - return (int)9L; - } - /** - * {@snippet : - * #define RSPII_NUM_LNA_STATES 9 - * } - */ - public static int RSPII_NUM_LNA_STATES() { - return (int)9L; - } - /** - * {@snippet : - * #define RSPII_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPII_NUM_LNA_STATES_AMPORT() { - return (int)5L; - } - /** - * {@snippet : - * #define RSPII_NUM_LNA_STATES_420MHZ 6 - * } - */ - public static int RSPII_NUM_LNA_STATES_420MHZ() { - return (int)6L; - } - /** - * {@snippet : - * #define RSPDUO_NUM_LNA_STATES 10 - * } - */ - public static int RSPDUO_NUM_LNA_STATES() { - return (int)10L; - } - /** - * {@snippet : - * #define RSPDUO_NUM_LNA_STATES_AMPORT 5 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AMPORT() { - return (int)5L; - } - /** - * {@snippet : - * #define RSPDUO_NUM_LNA_STATES_AM 7 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_AM() { - return (int)7L; - } - /** - * {@snippet : - * #define RSPDUO_NUM_LNA_STATES_LBAND 9 - * } - */ - public static int RSPDUO_NUM_LNA_STATES_LBAND() { - return (int)9L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES 28 - * } - */ - public static int RSPDX_NUM_LNA_STATES() { - return (int)28L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_0_12 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_0_12() { - return (int)19L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_12_50 20 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_12_50() { - return (int)20L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_AMPORT2_50_60 25 - * } - */ - public static int RSPDX_NUM_LNA_STATES_AMPORT2_50_60() { - return (int)25L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_VHF_BAND3 27 - * } - */ - public static int RSPDX_NUM_LNA_STATES_VHF_BAND3() { - return (int)27L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_420MHZ 21 - * } - */ - public static int RSPDX_NUM_LNA_STATES_420MHZ() { - return (int)21L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_LBAND 19 - * } - */ - public static int RSPDX_NUM_LNA_STATES_LBAND() { - return (int)19L; - } - /** - * {@snippet : - * #define RSPDX_NUM_LNA_STATES_DX 22 - * } - */ - public static int RSPDX_NUM_LNA_STATES_DX() { - return (int)22L; - } - /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_A = 5; - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_A() { - return (int)5L; - } - /** - * {@snippet : - * enum .sdrplay_api_Rsp2_ANTENNA_B = 6; - * } - */ - public static int sdrplay_api_Rsp2_ANTENNA_B() { - return (int)6L; - } - /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_1 = 1; - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_1() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_Rsp2_AMPORT_2 = 0; - * } - */ - public static int sdrplay_api_Rsp2_AMPORT_2() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Unknown = 0; - * } - */ - public static int sdrplay_api_RspDuoMode_Unknown() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Single_Tuner = 1; - * } - */ - public static int sdrplay_api_RspDuoMode_Single_Tuner() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Dual_Tuner = 2; - * } - */ - public static int sdrplay_api_RspDuoMode_Dual_Tuner() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Master = 4; - * } - */ - public static int sdrplay_api_RspDuoMode_Master() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoMode_Slave = 8; - * } - */ - public static int sdrplay_api_RspDuoMode_Slave() { - return (int)8L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_1 = 1; - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_1() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuo_AMPORT_2 = 0; - * } - */ - public static int sdrplay_api_RspDuo_AMPORT_2() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_Undefined = 0; - * } - */ - public static int sdrplay_api_BW_Undefined() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_0_200 = 200; - * } - */ - public static int sdrplay_api_BW_0_200() { - return (int)200L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_0_300 = 300; - * } - */ - public static int sdrplay_api_BW_0_300() { - return (int)300L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_0_600 = 600; - * } - */ - public static int sdrplay_api_BW_0_600() { - return (int)600L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_1_536 = 1536; - * } - */ - public static int sdrplay_api_BW_1_536() { - return (int)1536L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_5_000 = 5000; - * } - */ - public static int sdrplay_api_BW_5_000() { - return (int)5000L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_6_000 = 6000; - * } - */ - public static int sdrplay_api_BW_6_000() { - return (int)6000L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_7_000 = 7000; - * } - */ - public static int sdrplay_api_BW_7_000() { - return (int)7000L; - } - /** - * {@snippet : - * enum .sdrplay_api_BW_8_000 = 8000; - * } - */ - public static int sdrplay_api_BW_8_000() { - return (int)8000L; - } - /** - * {@snippet : - * enum .sdrplay_api_IF_Undefined = -1; - * } - */ - public static int sdrplay_api_IF_Undefined() { - return (int)-1L; - } - /** - * {@snippet : - * enum .sdrplay_api_IF_Zero = 0; - * } - */ - public static int sdrplay_api_IF_Zero() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_IF_0_450 = 450; - * } - */ - public static int sdrplay_api_IF_0_450() { - return (int)450L; - } - /** - * {@snippet : - * enum .sdrplay_api_IF_1_620 = 1620; - * } - */ - public static int sdrplay_api_IF_1_620() { - return (int)1620L; - } - /** - * {@snippet : - * enum .sdrplay_api_IF_2_048 = 2048; - * } - */ - public static int sdrplay_api_IF_2_048() { - return (int)2048L; - } - /** - * {@snippet : - * enum .sdrplay_api_LO_Undefined = 0; - * } - */ - public static int sdrplay_api_LO_Undefined() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_LO_Auto = 1; - * } - */ - public static int sdrplay_api_LO_Auto() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_LO_120MHz = 2; - * } - */ - public static int sdrplay_api_LO_120MHz() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_LO_144MHz = 3; - * } - */ - public static int sdrplay_api_LO_144MHz() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_LO_168MHz = 4; - * } - */ - public static int sdrplay_api_LO_168MHz() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_EXTENDED_MIN_GR = 0; - * } - */ - public static int sdrplay_api_EXTENDED_MIN_GR() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_NORMAL_MIN_GR = 20; - * } - */ - public static int sdrplay_api_NORMAL_MIN_GR() { - return (int)20L; - } - /** - * {@snippet : - * enum .sdrplay_api_Tuner_Neither = 0; - * } - */ - public static int sdrplay_api_Tuner_Neither() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_Tuner_A = 1; - * } - */ - public static int sdrplay_api_Tuner_A() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_Tuner_B = 2; - * } - */ - public static int sdrplay_api_Tuner_B() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_Tuner_Both = 3; - * } - */ - public static int sdrplay_api_Tuner_Both() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_A = 0; - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_A() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_B = 1; - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_B() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_ANTENNA_C = 2; - * } - */ - public static int sdrplay_api_RspDx_ANTENNA_C() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_200 = 0; - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_200() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_0_500 = 1; - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_0_500() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_200 = 2; - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_200() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDx_HDRMODE_BW_1_700 = 3; - * } - */ - public static int sdrplay_api_RspDx_HDRMODE_BW_1_700() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_ISOCH = 0; - * } - */ - public static int sdrplay_api_ISOCH() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_BULK = 1; - * } - */ - public static int sdrplay_api_BULK() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_AGC_DISABLE = 0; - * } - */ - public static int sdrplay_api_AGC_DISABLE() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_AGC_100HZ = 1; - * } - */ - public static int sdrplay_api_AGC_100HZ() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_AGC_50HZ = 2; - * } - */ - public static int sdrplay_api_AGC_50HZ() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_AGC_5HZ = 3; - * } - */ - public static int sdrplay_api_AGC_5HZ() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_AGC_CTRL_EN = 4; - * } - */ - public static int sdrplay_api_AGC_CTRL_EN() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_ADSB_DECIMATION = 0; - * } - */ - public static int sdrplay_api_ADSB_DECIMATION() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_LOWPASS = 1; - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_LOWPASS() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ = 2; - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_2MHZ() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ = 3; - * } - */ - public static int sdrplay_api_ADSB_NO_DECIMATION_BANDPASS_3MHZ() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_Overload_Detected = 0; - * } - */ - public static int sdrplay_api_Overload_Detected() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_Overload_Corrected = 1; - * } - */ - public static int sdrplay_api_Overload_Corrected() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_MasterInitialised = 0; - * } - */ - public static int sdrplay_api_MasterInitialised() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_SlaveAttached = 1; - * } - */ - public static int sdrplay_api_SlaveAttached() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_SlaveDetached = 2; - * } - */ - public static int sdrplay_api_SlaveDetached() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_SlaveInitialised = 3; - * } - */ - public static int sdrplay_api_SlaveInitialised() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_SlaveUninitialised = 4; - * } - */ - public static int sdrplay_api_SlaveUninitialised() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_MasterDllDisappeared = 5; - * } - */ - public static int sdrplay_api_MasterDllDisappeared() { - return (int)5L; - } - /** - * {@snippet : - * enum .sdrplay_api_SlaveDllDisappeared = 6; - * } - */ - public static int sdrplay_api_SlaveDllDisappeared() { - return (int)6L; - } - /** - * {@snippet : - * enum .sdrplay_api_GainChange = 0; - * } - */ - public static int sdrplay_api_GainChange() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_PowerOverloadChange = 1; - * } - */ - public static int sdrplay_api_PowerOverloadChange() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_DeviceRemoved = 2; - * } - */ - public static int sdrplay_api_DeviceRemoved() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_RspDuoModeChange = 3; - * } - */ - public static int sdrplay_api_RspDuoModeChange() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_DeviceFailure = 4; - * } - */ - public static int sdrplay_api_DeviceFailure() { - return (int)4L; - } - /** - * {@snippet : - * typedef void* HANDLE; - * } - */ - public static final OfAddress HANDLE = Constants$root.C_POINTER$LAYOUT; - /** - * {@snippet : - * enum .sdrplay_api_Success = 0; - * } - */ - public static int sdrplay_api_Success() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_Fail = 1; - * } - */ - public static int sdrplay_api_Fail() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_InvalidParam = 2; - * } - */ - public static int sdrplay_api_InvalidParam() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_OutOfRange = 3; - * } - */ - public static int sdrplay_api_OutOfRange() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_GainUpdateError = 4; - * } - */ - public static int sdrplay_api_GainUpdateError() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_RfUpdateError = 5; - * } - */ - public static int sdrplay_api_RfUpdateError() { - return (int)5L; - } - /** - * {@snippet : - * enum .sdrplay_api_FsUpdateError = 6; - * } - */ - public static int sdrplay_api_FsUpdateError() { - return (int)6L; - } - /** - * {@snippet : - * enum .sdrplay_api_HwError = 7; - * } - */ - public static int sdrplay_api_HwError() { - return (int)7L; - } - /** - * {@snippet : - * enum .sdrplay_api_AliasingError = 8; - * } - */ - public static int sdrplay_api_AliasingError() { - return (int)8L; - } - /** - * {@snippet : - * enum .sdrplay_api_AlreadyInitialised = 9; - * } - */ - public static int sdrplay_api_AlreadyInitialised() { - return (int)9L; - } - /** - * {@snippet : - * enum .sdrplay_api_NotInitialised = 10; - * } - */ - public static int sdrplay_api_NotInitialised() { - return (int)10L; - } - /** - * {@snippet : - * enum .sdrplay_api_NotEnabled = 11; - * } - */ - public static int sdrplay_api_NotEnabled() { - return (int)11L; - } - /** - * {@snippet : - * enum .sdrplay_api_HwVerError = 12; - * } - */ - public static int sdrplay_api_HwVerError() { - return (int)12L; - } - /** - * {@snippet : - * enum .sdrplay_api_OutOfMemError = 13; - * } - */ - public static int sdrplay_api_OutOfMemError() { - return (int)13L; - } - /** - * {@snippet : - * enum .sdrplay_api_ServiceNotResponding = 14; - * } - */ - public static int sdrplay_api_ServiceNotResponding() { - return (int)14L; - } - /** - * {@snippet : - * enum .sdrplay_api_StartPending = 15; - * } - */ - public static int sdrplay_api_StartPending() { - return (int)15L; - } - /** - * {@snippet : - * enum .sdrplay_api_StopPending = 16; - * } - */ - public static int sdrplay_api_StopPending() { - return (int)16L; - } - /** - * {@snippet : - * enum .sdrplay_api_InvalidMode = 17; - * } - */ - public static int sdrplay_api_InvalidMode() { - return (int)17L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification1 = 18; - * } - */ - public static int sdrplay_api_FailedVerification1() { - return (int)18L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification2 = 19; - * } - */ - public static int sdrplay_api_FailedVerification2() { - return (int)19L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification3 = 20; - * } - */ - public static int sdrplay_api_FailedVerification3() { - return (int)20L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification4 = 21; - * } - */ - public static int sdrplay_api_FailedVerification4() { - return (int)21L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification5 = 22; - * } - */ - public static int sdrplay_api_FailedVerification5() { - return (int)22L; - } - /** - * {@snippet : - * enum .sdrplay_api_FailedVerification6 = 23; - * } - */ - public static int sdrplay_api_FailedVerification6() { - return (int)23L; - } - /** - * {@snippet : - * enum .sdrplay_api_InvalidServiceVersion = 24; - * } - */ - public static int sdrplay_api_InvalidServiceVersion() { - return (int)24L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_None = 0; - * } - */ - public static int sdrplay_api_Update_None() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Fs = 1; - * } - */ - public static int sdrplay_api_Update_Dev_Fs() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_Ppm = 2; - * } - */ - public static int sdrplay_api_Update_Dev_Ppm() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_SyncUpdate = 4; - * } - */ - public static int sdrplay_api_Update_Dev_SyncUpdate() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Dev_ResetFlags = 8; - * } - */ - public static int sdrplay_api_Update_Dev_ResetFlags() { - return (int)8L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_BiasTControl = 16; - * } - */ - public static int sdrplay_api_Update_Rsp1a_BiasTControl() { - return (int)16L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfNotchControl = 32; - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfNotchControl() { - return (int)32L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp1a_RfDabNotchControl = 64; - * } - */ - public static int sdrplay_api_Update_Rsp1a_RfDabNotchControl() { - return (int)64L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_BiasTControl = 128; - * } - */ - public static int sdrplay_api_Update_Rsp2_BiasTControl() { - return (int)128L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AmPortSelect = 256; - * } - */ - public static int sdrplay_api_Update_Rsp2_AmPortSelect() { - return (int)256L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_AntennaControl = 512; - * } - */ - public static int sdrplay_api_Update_Rsp2_AntennaControl() { - return (int)512L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_RfNotchControl = 1024; - * } - */ - public static int sdrplay_api_Update_Rsp2_RfNotchControl() { - return (int)1024L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Rsp2_ExtRefControl = 2048; - * } - */ - public static int sdrplay_api_Update_Rsp2_ExtRefControl() { - return (int)2048L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_ExtRefControl = 4096; - * } - */ - public static int sdrplay_api_Update_RspDuo_ExtRefControl() { - return (int)4096L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_1 = 8192; - * } - */ - public static int sdrplay_api_Update_Master_Spare_1() { - return (int)8192L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Master_Spare_2 = 16384; - * } - */ - public static int sdrplay_api_Update_Master_Spare_2() { - return (int)16384L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Gr = 32768; - * } - */ - public static int sdrplay_api_Update_Tuner_Gr() { - return (int)32768L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_GrLimits = 65536; - * } - */ - public static int sdrplay_api_Update_Tuner_GrLimits() { - return (int)65536L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_Frf = 131072; - * } - */ - public static int sdrplay_api_Update_Tuner_Frf() { - return (int)131072L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_BwType = 262144; - * } - */ - public static int sdrplay_api_Update_Tuner_BwType() { - return (int)262144L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_IfType = 524288; - * } - */ - public static int sdrplay_api_Update_Tuner_IfType() { - return (int)524288L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_DcOffset = 1048576; - * } - */ - public static int sdrplay_api_Update_Tuner_DcOffset() { - return (int)1048576L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Tuner_LoMode = 2097152; - * } - */ - public static int sdrplay_api_Update_Tuner_LoMode() { - return (int)2097152L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_DCoffsetIQimbalance = 4194304; - * } - */ - public static int sdrplay_api_Update_Ctrl_DCoffsetIQimbalance() { - return (int)4194304L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Decimation = 8388608; - * } - */ - public static int sdrplay_api_Update_Ctrl_Decimation() { - return (int)8388608L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_Agc = 16777216; - * } - */ - public static int sdrplay_api_Update_Ctrl_Agc() { - return (int)16777216L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_AdsbMode = 33554432; - * } - */ - public static int sdrplay_api_Update_Ctrl_AdsbMode() { - return (int)33554432L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ctrl_OverloadMsgAck = 67108864; - * } - */ - public static int sdrplay_api_Update_Ctrl_OverloadMsgAck() { - return (int)67108864L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_BiasTControl = 134217728; - * } - */ - public static int sdrplay_api_Update_RspDuo_BiasTControl() { - return (int)134217728L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_AmPortSelect = 268435456; - * } - */ - public static int sdrplay_api_Update_RspDuo_AmPortSelect() { - return (int)268435456L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_Tuner1AmNotchControl = 536870912; - * } - */ - public static int sdrplay_api_Update_RspDuo_Tuner1AmNotchControl() { - return (int)536870912L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfNotchControl = 1073741824; - * } - */ - public static int sdrplay_api_Update_RspDuo_RfNotchControl() { - return (int)1073741824L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_RfDabNotchControl = -2147483648; - * } - */ - public static int sdrplay_api_Update_RspDuo_RfDabNotchControl() { - return (int)-2147483648L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_Ext1_None = 0; - * } - */ - public static int sdrplay_api_Update_Ext1_None() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrEnable = 1; - * } - */ - public static int sdrplay_api_Update_RspDx_HdrEnable() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_BiasTControl = 2; - * } - */ - public static int sdrplay_api_Update_RspDx_BiasTControl() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_AntennaControl = 4; - * } - */ - public static int sdrplay_api_Update_RspDx_AntennaControl() { - return (int)4L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfNotchControl = 8; - * } - */ - public static int sdrplay_api_Update_RspDx_RfNotchControl() { - return (int)8L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_RfDabNotchControl = 16; - * } - */ - public static int sdrplay_api_Update_RspDx_RfDabNotchControl() { - return (int)16L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDx_HdrBw = 32; - * } - */ - public static int sdrplay_api_Update_RspDx_HdrBw() { - return (int)32L; - } - /** - * {@snippet : - * enum .sdrplay_api_Update_RspDuo_ResetSlaveFlags = 64; - * } - */ - public static int sdrplay_api_Update_RspDuo_ResetSlaveFlags() { - return (int)64L; - } - /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Disable = 0; - * } - */ - public static int sdrplay_api_DbgLvl_Disable() { - return (int)0L; - } - /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Verbose = 1; - * } - */ - public static int sdrplay_api_DbgLvl_Verbose() { - return (int)1L; - } - /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Warning = 2; - * } - */ - public static int sdrplay_api_DbgLvl_Warning() { - return (int)2L; - } - /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Error = 3; - * } - */ - public static int sdrplay_api_DbgLvl_Error() { - return (int)3L; - } - /** - * {@snippet : - * enum .sdrplay_api_DbgLvl_Message = 4; - * } - */ - public static int sdrplay_api_DbgLvl_Message() { - return (int)4L; - } - public static MethodHandle sdrplay_api_Open$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_Open$MH,"sdrplay_api_Open"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_Open(); - * } - */ - public static int sdrplay_api_Open() { - var mh$ = sdrplay_api_Open$MH(); - try { - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_Close$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_Close$MH,"sdrplay_api_Close"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_Close(); - * } - */ - public static int sdrplay_api_Close() { - var mh$ = sdrplay_api_Close$MH(); - try { - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_ApiVersion$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_ApiVersion$MH,"sdrplay_api_ApiVersion"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_ApiVersion(float* apiVer); - * } - */ - public static int sdrplay_api_ApiVersion(MemorySegment apiVer) { - var mh$ = sdrplay_api_ApiVersion$MH(); - try { - return (int)mh$.invokeExact(apiVer); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_LockDeviceApi$MH() { - return RuntimeHelper.requireNonNull(constants$7.sdrplay_api_LockDeviceApi$MH,"sdrplay_api_LockDeviceApi"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_LockDeviceApi(); - * } - */ - public static int sdrplay_api_LockDeviceApi() { - var mh$ = sdrplay_api_LockDeviceApi$MH(); - try { - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_UnlockDeviceApi$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_UnlockDeviceApi$MH,"sdrplay_api_UnlockDeviceApi"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_UnlockDeviceApi(); - * } - */ - public static int sdrplay_api_UnlockDeviceApi() { - var mh$ = sdrplay_api_UnlockDeviceApi$MH(); - try { - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_GetDevices$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_GetDevices$MH,"sdrplay_api_GetDevices"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(devices, numDevs, maxDevs); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_SelectDevice$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_SelectDevice$MH,"sdrplay_api_SelectDevice"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_SelectDevice(sdrplay_api_DeviceT* device); - * } - */ - public static int sdrplay_api_SelectDevice(MemorySegment device) { - var mh$ = sdrplay_api_SelectDevice$MH(); - try { - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_ReleaseDevice$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_ReleaseDevice$MH,"sdrplay_api_ReleaseDevice"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_ReleaseDevice(sdrplay_api_DeviceT* device); - * } - */ - public static int sdrplay_api_ReleaseDevice(MemorySegment device) { - var mh$ = sdrplay_api_ReleaseDevice$MH(); - try { - return (int)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_GetErrorString$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_GetErrorString$MH,"sdrplay_api_GetErrorString"); - } - /** - * {@snippet : - * char* sdrplay_api_GetErrorString(sdrplay_api_ErrT err); - * } - */ - public static MemorySegment sdrplay_api_GetErrorString(int err) { - var mh$ = sdrplay_api_GetErrorString$MH(); - try { - return (java.lang.foreign.MemorySegment)mh$.invokeExact(err); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_GetLastError$MH() { - return RuntimeHelper.requireNonNull(constants$8.sdrplay_api_GetLastError$MH,"sdrplay_api_GetLastError"); - } - /** - * {@snippet : - * sdrplay_api_ErrorInfoT* sdrplay_api_GetLastError(sdrplay_api_DeviceT* device); - * } - */ - public static MemorySegment sdrplay_api_GetLastError(MemorySegment device) { - var mh$ = sdrplay_api_GetLastError$MH(); - try { - return (java.lang.foreign.MemorySegment)mh$.invokeExact(device); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_GetLastErrorByType$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_GetLastErrorByType$MH,"sdrplay_api_GetLastErrorByType"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (java.lang.foreign.MemorySegment)mh$.invokeExact(device, type, time); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_DisableHeartbeat$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_DisableHeartbeat$MH,"sdrplay_api_DisableHeartbeat"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_DisableHeartbeat(); - * } - */ - public static int sdrplay_api_DisableHeartbeat() { - var mh$ = sdrplay_api_DisableHeartbeat$MH(); - try { - return (int)mh$.invokeExact(); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_DebugEnable$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_DebugEnable$MH,"sdrplay_api_DebugEnable"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, enable); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_GetDeviceParams$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_GetDeviceParams$MH,"sdrplay_api_GetDeviceParams"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, deviceParams); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_Init$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_Init$MH,"sdrplay_api_Init"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, callbackFns, cbContext); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_Uninit$MH() { - return RuntimeHelper.requireNonNull(constants$9.sdrplay_api_Uninit$MH,"sdrplay_api_Uninit"); - } - /** - * {@snippet : - * sdrplay_api_ErrT sdrplay_api_Uninit(HANDLE dev); - * } - */ - public static int sdrplay_api_Uninit(MemorySegment dev) { - var mh$ = sdrplay_api_Uninit$MH(); - try { - return (int)mh$.invokeExact(dev); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_Update$MH() { - return RuntimeHelper.requireNonNull(constants$10.sdrplay_api_Update$MH,"sdrplay_api_Update"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, tuner, reasonForUpdate, reasonForUpdateExt1); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_SwapRspDuoActiveTuner$MH() { - return RuntimeHelper.requireNonNull(constants$10.sdrplay_api_SwapRspDuoActiveTuner$MH,"sdrplay_api_SwapRspDuoActiveTuner"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, currentTuner, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH() { - return RuntimeHelper.requireNonNull(constants$10.sdrplay_api_SwapRspDuoDualTunerModeSampleRate$MH,"sdrplay_api_SwapRspDuoDualTunerModeSampleRate"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(dev, currentSampleRate, newSampleRate); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - public static MethodHandle sdrplay_api_SwapRspDuoMode$MH() { - return RuntimeHelper.requireNonNull(constants$10.sdrplay_api_SwapRspDuoMode$MH,"sdrplay_api_SwapRspDuoMode"); - } - /** - * {@snippet : - * 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$MH(); - try { - return (int)mh$.invokeExact(currDevice, deviceParams, rspDuoMode, sampleRate, tuner, bwType, ifType, tuner1AmPortSel); - } catch (Throwable ex$) { - throw new AssertionError("should not reach here", ex$); - } - } - /** - * {@snippet : - * #define MAX_BB_GR 59 - * } - */ - public static int MAX_BB_GR() { - return (int)59L; - } - /** - * {@snippet : - * #define SDRPLAY_API_VERSION 3.140000104904175 - * } - */ - public static float SDRPLAY_API_VERSION() { - return 3.140000104904175f; - } - /** - * {@snippet : - * #define SDRPLAY_MAX_DEVICES 16 - * } - */ - public static int SDRPLAY_MAX_DEVICES() { - return (int)16L; - } - /** - * {@snippet : - * #define SDRPLAY_MAX_TUNERS_PER_DEVICE 2 - * } - */ - public static int SDRPLAY_MAX_TUNERS_PER_DEVICE() { - return (int)2L; - } - /** - * {@snippet : - * #define SDRPLAY_MAX_SER_NO_LEN 64 - * } - */ - public static int SDRPLAY_MAX_SER_NO_LEN() { - return (int)64L; - } - /** - * {@snippet : - * #define SDRPLAY_MAX_ROOT_NM_LEN 32 - * } - */ - public static int SDRPLAY_MAX_ROOT_NM_LEN() { - return (int)32L; - } - /** - * {@snippet : - * #define SDRPLAY_RSP1_ID 1 - * } - */ - public static int SDRPLAY_RSP1_ID() { - return (int)1L; - } - /** - * {@snippet : - * #define SDRPLAY_RSP1A_ID 255 - * } - */ - public static int SDRPLAY_RSP1A_ID() { - return (int)255L; - } - /** - * {@snippet : - * #define SDRPLAY_RSP2_ID 2 - * } - */ - public static int SDRPLAY_RSP2_ID() { - return (int)2L; - } - /** - * {@snippet : - * #define SDRPLAY_RSPduo_ID 3 - * } - */ - public static int SDRPLAY_RSPduo_ID() { - return (int)3L; - } - /** - * {@snippet : - * #define SDRPLAY_RSPdx_ID 4 - * } - */ - public static int SDRPLAY_RSPdx_ID() { - return (int)4L; - } - /** - * {@snippet : - * #define SDRPLAY_RSP1B_ID 6 - * } - */ - public static int SDRPLAY_RSP1B_ID() { - return (int)6L; - } - - //Note: RSPdx_R2 manually edited for API version 3.15 - - /** - * {@snippet : - * #define SDRPLAY_RSPdx_R2_ID 7 - * } - */ - public static int SDRPLAY_RSPdx_R2_ID() { - return (int)7L; - } -} - - 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 new file mode 100644 index 000000000..8c228626a --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_AgcT.java @@ -0,0 +1,423 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..24065394e --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ApiVersion_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..78c5961e5 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_CallbackFnsT.java @@ -0,0 +1,238 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..9884e9f4f --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Close_t.java @@ -0,0 +1,81 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..b77c5ff5a --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ControlParamsT.java @@ -0,0 +1,285 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..eee8b6e60 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetT.java @@ -0,0 +1,192 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..21eb36ba6 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DcOffsetTunerT.java @@ -0,0 +1,286 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..cb2e5cf73 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DebugEnable_t.java @@ -0,0 +1,84 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..4dd250015 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DecimationT.java @@ -0,0 +1,238 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..269944274 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DevParamsT.java @@ -0,0 +1,563 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..8ef7adab0 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceParamsT.java @@ -0,0 +1,238 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..1467972fa --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DeviceT.java @@ -0,0 +1,463 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..1c8da1fcc --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_DisableHeartbeat_t.java @@ -0,0 +1,81 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..518b1514c --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ErrorInfoT.java @@ -0,0 +1,386 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..82531494b --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventCallback_t.java @@ -0,0 +1,85 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..94c6c82ae --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_EventParamsT.java @@ -0,0 +1,237 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..b88b295c5 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_FsFreqT.java @@ -0,0 +1,240 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..542a422d6 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainCbParamT.java @@ -0,0 +1,239 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..ab3cdf2b0 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainT.java @@ -0,0 +1,332 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..06bcd8675 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GainValuesT.java @@ -0,0 +1,238 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..552b17d0b --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDeviceParams_t.java @@ -0,0 +1,84 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..f9a5580dc --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetDevices_t.java @@ -0,0 +1,85 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..96aa9d9fa --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetErrorString_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..f1c3de6ec --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastErrorByType_t.java @@ -0,0 +1,85 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..cef3897b6 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_GetLastError_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..6cbd3d3e9 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Init_t.java @@ -0,0 +1,85 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..98ffc75c3 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_LockDeviceApi_t.java @@ -0,0 +1,81 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..db1d05a99 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Open_t.java @@ -0,0 +1,81 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..0f455751a --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_PowerOverloadCbParamT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..4250615d3 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ReleaseDevice_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..022e6fe77 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_ResetFlagsT.java @@ -0,0 +1,238 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..c1360d6c2 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RfFreqT.java @@ -0,0 +1,194 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..bde375399 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aParamsT.java @@ -0,0 +1,192 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..c91bdb1f0 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp1aTunerParamsT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..7c383a28e --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2ParamsT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..e98d51282 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Rsp2TunerParamsT.java @@ -0,0 +1,287 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..9179fae58 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoModeCbParamT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..b8a87b98a --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoParamsT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..3163acb91 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuoTunerParamsT.java @@ -0,0 +1,379 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..7268ba6e9 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDuo_ResetSlaveFlagsT.java @@ -0,0 +1,192 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..36d2e6455 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxParamsT.java @@ -0,0 +1,333 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..e8768d524 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RspDxTunerParamsT.java @@ -0,0 +1,146 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..8bd2fc274 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_RxChannelParamsT.java @@ -0,0 +1,376 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..921861caa --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SelectDevice_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..fde0210ac --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCallback_t.java @@ -0,0 +1,87 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..13bfeae2f --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_StreamCbParamsT.java @@ -0,0 +1,330 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..97a007f5d --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoActiveTuner_t.java @@ -0,0 +1,85 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..112792d35 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoDualTunerModeSampleRate_t.java @@ -0,0 +1,84 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..dae1df1cb --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SwapRspDuoMode_t.java @@ -0,0 +1,90 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..731f3e7d5 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_SyncUpdateT.java @@ -0,0 +1,192 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..b8a79e009 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_TunerParamsT.java @@ -0,0 +1,378 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..f2660e927 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Uninit_t.java @@ -0,0 +1,83 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..be033ec52 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_UnlockDeviceApi_t.java @@ -0,0 +1,81 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..5d302b1c0 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_Update_t.java @@ -0,0 +1,86 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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 new file mode 100644 index 000000000..1a9fa3e28 --- /dev/null +++ b/src/main/java/io/github/dsheirer/source/tuner/sdrplay/api/v3_15/sdrplay_api_h.java @@ -0,0 +1,2821 @@ +/* + * ***************************************************************************** + * Copyright (C) 2014-2024 Dennis Sheirer + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General 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.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) { + 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) + { + 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/vector/calibrate/CalibrationManager.java b/src/main/java/io/github/dsheirer/vector/calibrate/CalibrationManager.java index 0dac3acb2..fea304b15 100644 --- a/src/main/java/io/github/dsheirer/vector/calibrate/CalibrationManager.java +++ b/src/main/java/io/github/dsheirer/vector/calibrate/CalibrationManager.java @@ -1,6 +1,6 @@ /* * ***************************************************************************** - * Copyright (C) 2014-2023 Dennis Sheirer + * Copyright (C) 2014-2024 Dennis Sheirer * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -275,8 +275,20 @@ public List getUncalibrated() public static void main(String[] args) { CalibrationManager manager = getInstance(); -// manager.reset(); - manager.reset(CalibrationType.WINDOW); + + StringBuilder sb = new StringBuilder(); + sb.append("Current Calibration Settings:\n"); + for(CalibrationType type: CalibrationType.values()) + { + Calibration calibration = manager.getCalibration(type); + if(calibration != null) + { + sb.append("\t").append(type.name()).append("\t").append(manager.getCalibration(type).getImplementation()).append("\n"); + } + } + System.out.println(sb); + + manager.reset(); if(!manager.isCalibrated()) { @@ -290,6 +302,19 @@ public static void main(String[] args) } } + + StringBuilder sb1 = new StringBuilder(); + sb1.append("Updated Calibration Settings:\n"); + for(CalibrationType type: CalibrationType.values()) + { + Calibration calibration = manager.getCalibration(type); + if(calibration != null) + { + sb1.append("\t").append(type.name()).append("\t").append(manager.getCalibration(type).getImplementation()).append("\n"); + } + } + System.out.println(sb1); + System.out.println("Complete"); } }