-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dennis Sheirer
committed
Jan 15, 2023
1 parent
8be4e78
commit 2cb1ee6
Showing
350 changed files
with
30,898 additions
and
280 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform | ||
|
||
plugins { | ||
id 'java' | ||
id 'maven-publish' | ||
} | ||
|
||
group 'com.github.DSheirer' | ||
version '3.11.0.0' | ||
|
||
repositories { | ||
mavenCentral() | ||
maven { url "https://jitpack.io" } | ||
} | ||
|
||
//Java 19 is required for this version of the Project Panama preview/incubator feature | ||
java { | ||
toolchain { | ||
languageVersion = JavaLanguageVersion.of(19) | ||
} | ||
} | ||
|
||
/** | ||
* This is needed for the JDK19 panama until it moves out of preview | ||
*/ | ||
tasks.withType(JavaCompile) { | ||
options.compilerArgs.add("--enable-preview") //Panama Foreign Function/Memory is preview in JDK 19 | ||
} | ||
|
||
var incubatorArguments = ["-Djava.library.path=" + getJavaLibraryPath()] | ||
|
||
tasks.withType(JavaExec) { | ||
jvmArgs += incubatorArguments | ||
} | ||
tasks.withType(Test) { | ||
jvmArgs += incubatorArguments | ||
} | ||
|
||
dependencies { | ||
implementation project(':sdrplay-api') | ||
implementation 'ch.qos.logback:logback-classic:1.4.4' | ||
implementation 'org.apache.commons:commons-lang3:3.12.0' | ||
implementation 'org.slf4j:slf4j-api:2.0.3' | ||
|
||
testImplementation 'com.github.wendykierp:JTransforms:3.1' | ||
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0' | ||
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0' | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
|
||
//Exclude all tests by default. Comment out this line to run tests. | ||
// exclude '**/*' | ||
} | ||
|
||
/** | ||
* Determine library path for the current operating system and architecture | ||
*/ | ||
static String getJavaLibraryPath() { | ||
OperatingSystem os = DefaultNativePlatform.currentOperatingSystem | ||
|
||
if(os.isLinux() || os.isMacOsX()) { | ||
return "/usr/local/lib" | ||
} | ||
|
||
if(os.isWindows()) { | ||
if(System.getProperty("sun.arch.data.model").contentEquals("64")) { | ||
return "c:\\Program Files\\SDRplay\\API\\x64" | ||
} | ||
else { | ||
return "c:\\Program Files\\SDRplay\\API\\x86" | ||
} | ||
} | ||
|
||
return "" | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
} | ||
} | ||
} |
106 changes: 106 additions & 0 deletions
106
jsdrplay/src/main/java/com/github/dsheirer/sdrplay/DeviceSelectionMode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2023 Dennis Sheirer | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* **************************************************************************** | ||
*/ | ||
|
||
package com.github.dsheirer.sdrplay; | ||
|
||
import com.github.dsheirer.sdrplay.device.RspDuoMode; | ||
import com.github.dsheirer.sdrplay.device.TunerSelect; | ||
import java.util.EnumSet; | ||
|
||
/** | ||
* Enumeration of modes that indicate how each SDRplay RSP device can be selected | ||
*/ | ||
public enum DeviceSelectionMode | ||
{ | ||
//All RSP devices | ||
SINGLE_TUNER_1("Single Tuner 1", RspDuoMode.SINGLE_TUNER, TunerSelect.TUNER_1), | ||
SINGLE_TUNER_2("Single Tuner 2", RspDuoMode.SINGLE_TUNER, TunerSelect.TUNER_2), | ||
MASTER_TUNER_1("Master - Tuner 1", RspDuoMode.MASTER, TunerSelect.TUNER_1), | ||
SLAVE_TUNER_2("Slave - Tuner 2", RspDuoMode.SLAVE, TunerSelect.TUNER_2); | ||
|
||
private String mDescription; | ||
private RspDuoMode mRspDuoMode; | ||
private TunerSelect mTunerSelect; | ||
|
||
/** | ||
* Private constructor | ||
* @param description of the mode | ||
* @param rspDuoMode that corresponds to the mode | ||
* @param tunerSelect tuner(s) that correspond to the mode | ||
*/ | ||
DeviceSelectionMode(String description, RspDuoMode rspDuoMode, TunerSelect tunerSelect) | ||
{ | ||
mDescription = description; | ||
mRspDuoMode = rspDuoMode; | ||
mTunerSelect = tunerSelect; | ||
} | ||
|
||
/** | ||
* Set of all selection modes available for the RSPduo | ||
*/ | ||
public static final EnumSet<DeviceSelectionMode> MASTER_MODES = EnumSet.of(MASTER_TUNER_1); | ||
public static final EnumSet<DeviceSelectionMode> SLAVE_MODES = EnumSet.of(SLAVE_TUNER_2); | ||
public static final EnumSet<DeviceSelectionMode> SINGLE_TUNER_MODES = EnumSet.of(SINGLE_TUNER_1, SINGLE_TUNER_2); | ||
|
||
/** | ||
* RSPduo mode associated with the selection mode | ||
*/ | ||
public RspDuoMode getRspDuoMode() | ||
{ | ||
return mRspDuoMode; | ||
} | ||
|
||
/** | ||
* Indicates if this mode is designated as a master mode. | ||
*/ | ||
public boolean isMasterMode() | ||
{ | ||
return MASTER_MODES.contains(this); | ||
} | ||
|
||
/** | ||
* Indicates if this mode is designated as a slave mode. | ||
*/ | ||
public boolean isSlaveMode() | ||
{ | ||
return SLAVE_MODES.contains(this); | ||
} | ||
|
||
/** | ||
* Indicates if this is a single-tuner mode | ||
*/ | ||
public boolean isSingleTunerMode() | ||
{ | ||
return SINGLE_TUNER_MODES.contains(this); | ||
} | ||
|
||
/** | ||
* Tuner(s) associated with the selection mode | ||
*/ | ||
public TunerSelect getTunerSelect() | ||
{ | ||
return mTunerSelect; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return mDescription; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
jsdrplay/src/main/java/com/github/dsheirer/sdrplay/SDRPlayException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* ***************************************************************************** | ||
* Copyright (C) 2014-2022 Dennis Sheirer | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* **************************************************************************** | ||
*/ | ||
|
||
package com.github.dsheirer.sdrplay; | ||
|
||
/** | ||
* SDRplay checked exception. | ||
*/ | ||
public class SDRPlayException extends Exception | ||
{ | ||
private Status mStatus = Status.UNKNOWN; | ||
|
||
/** | ||
* Creates an exception | ||
* @param message for the exception | ||
*/ | ||
public SDRPlayException(String message) | ||
{ | ||
super(message); | ||
} | ||
|
||
/** | ||
* Creates an operation exception | ||
* @param message for the exception | ||
* @param status of the operation | ||
*/ | ||
public SDRPlayException(String message, Status status) | ||
{ | ||
super(message + " Status:" + status); | ||
mStatus = status; | ||
} | ||
|
||
/** | ||
* Creates an exception | ||
* @param message for the exception | ||
* @param throwable nested exception | ||
*/ | ||
public SDRPlayException(String message, Throwable throwable) | ||
{ | ||
super(message, throwable); | ||
} | ||
|
||
public Status getStatus() | ||
{ | ||
return mStatus; | ||
} | ||
} |
Oops, something went wrong.