Skip to content

Commit

Permalink
#1916 SDRPlay API 3.15 and RSPdxR2 support. (#1921)
Browse files Browse the repository at this point in the history
Co-authored-by: sheirerd <[email protected]>
  • Loading branch information
DSheirer and sheirerd authored May 26, 2024
1 parent 03792b0 commit 737c3fa
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ public static List<DiscoveredRspTuner> getRspTuners(DeviceInfo deviceInfo, Chann
tuners.add(new DiscoveredRsp2Tuner(deviceInfo, channelizerType));
break;
case RSPdx:
case RSPdxR2:
tuners.add(new DiscoveredRspDxTuner(deviceInfo, channelizerType));
break;
case RSPduo:
Expand Down Expand Up @@ -255,6 +256,7 @@ public static RspTuner getRspTuner(DeviceInfo deviceInfo, ChannelizerType channe
}
break;
case RSPdx:
case RSPdxR2:
if(device instanceof RspDxDevice rspDxDevice)
{
IControlRspDx controlRspDx = new ControlRspDx(rspDxDevice);
Expand Down Expand Up @@ -476,6 +478,7 @@ public static TunerEditor getEditor(UserPreferences userPreferences, DiscoveredT
case RSP2:
return new Rsp2TunerEditor(userPreferences, tunerManager, discoveredRspTuner);
case RSPdx:
case RSPdxR2:
return new RspDxTunerEditor(userPreferences, tunerManager, discoveredRspTuner);
case RSPduo:
if(discoveredRspTuner instanceof DiscoveredRspDuoTuner1 duoTuner1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ public enum Version
V3_11(3.11f, true),
V3_12(3.12f, true),
V3_13(3.13f, true), //No changes - OSX build only.
V3_14(3.14f, true);
V3_14(3.14f, true),
V3_15(3.15f, true);

private float mValue;
private boolean mSupported;
Expand All @@ -57,6 +58,7 @@ public boolean isSupported()

/**
* Indicates if this version is greater than or equal to the specified version.
*
* @param version to compare
* @return true if this version is greater than or equal to
*/
Expand All @@ -75,13 +77,14 @@ public float getVersion()

/**
* Lookup the version from the specified value.
*
* @param value to lookup
* @return version or UNKNOWN
*/
public static Version fromValue(float value)
{

for(Version version: values())
for(Version version : values())
{
if(version.mValue == value)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public static Device createDevice(SDRplay sdrPlay, IDeviceStruct deviceStruct)
case RSPduo -> {
return new RspDuoDevice(sdrPlay, deviceStruct);
}
case RSPdx -> {
case RSPdx, RSPdxR2 -> {
return new RspDxDevice(sdrPlay, deviceStruct);
}
default -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

package io.github.dsheirer.source.tuner.sdrplay.api.device;

import io.github.dsheirer.source.tuner.sdrplay.api.v3_07.sdrplay_api_h;
import io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h;

/**
* RSP Device type
Expand All @@ -28,10 +28,11 @@ public enum DeviceType
{
RSP1(sdrplay_api_h.SDRPLAY_RSP1_ID(), "RSP1"),
RSP1A(sdrplay_api_h.SDRPLAY_RSP1A_ID(), "RSP1A"),
RSP1B(io.github.dsheirer.source.tuner.sdrplay.api.v3_14.sdrplay_api_h.SDRPLAY_RSP1B_ID(), "RSP1B"),
RSP1B(sdrplay_api_h.SDRPLAY_RSP1B_ID(), "RSP1B"),
RSP2(sdrplay_api_h.SDRPLAY_RSP2_ID(), "RSP2"),
RSPduo(sdrplay_api_h.SDRPLAY_RSPduo_ID(), "RSPduo"),
RSPdx(sdrplay_api_h.SDRPLAY_RSPdx_ID(), "RSPdx"),
RSPdxR2(sdrplay_api_h.SDRPLAY_RSPdx_R2_ID(), "RSPdxR2"),
UNKNOWN(Integer.MIN_VALUE, "UNKNOWN");

private int mValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static CompositeParameters create(Version version, DeviceType deviceType,
case RSPduo -> {
return new RspDuoCompositeParameters(version, memorySegment, arena);
}
case RSPdx -> {
case RSPdx, RSPdxR2 -> {
return new RspDxCompositeParameters(version, memorySegment, arena);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static DeviceParameters create(DeviceType deviceType, MemorySegment memor
case RSPduo -> {
return new RspDuoDeviceParameters(memorySegment);
}
case RSPdx -> {
case RSPdx, RSPdxR2 -> {
return new RspDxDeviceParameters(memorySegment);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ else if(version.gte(Version.V3_07))
throw new IllegalArgumentException("Unrecognized API version: " + version);
}
}
case RSPdx -> {
case RSPdx, RSPdxR2 -> {
MemorySegment rspDxMemorySegment = sdrplay_api_RxChannelParamsT.rspDxTunerParams$slice(memorySegment);
return new RspDxTunerParameters(memorySegment, rspDxMemorySegment);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1719,6 +1719,17 @@ public static int SDRPLAY_RSPdx_ID() {
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;
}
}


0 comments on commit 737c3fa

Please sign in to comment.