Skip to content

Commit

Permalink
Rename app to SoftSA
Browse files Browse the repository at this point in the history
  • Loading branch information
zeertzjq committed Sep 8, 2024
1 parent 6dabad9 commit 312b2dd
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 32 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Spectral Plot
# SoftSA

An RF spectrum analyzer app for Android phones using only built-in hardware.

Expand All @@ -12,7 +12,7 @@ This app requires an Android phone with the following:

## Installation

Download the APK file built by GitHub Actions from the [Releases](https://github.com/zlab-pub/spectral-plot/releases) page and install it using `adb install`.
Download the APK file built by GitHub Actions from the [Releases](https://github.com/zlab-pub/SoftSA/releases) page and install it using `adb install`.

Alternatively, build the app on a Linux system with JDK 17 (or above) and Android SDK 34 by running `./gradlew assembleDebug`, which produces an APK file at `app/build/outputs/apk/debug/app-debug.apk`.

Expand Down
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ android {
ndkVersion '26.3.11579264'

defaultConfig {
applicationId 'com.example.spectral_plot'
applicationId 'com.example.softsa'
minSdkVersion 24
targetSdkVersion 34
ndk {
Expand All @@ -26,7 +26,7 @@ android {
path 'src/main/cpp/CMakeLists.txt'
}
}
namespace 'com.example.spectral_plot'
namespace 'com.example.softsa'
}

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name">
<activity
android:name=".SpectralPlot"
android:name=".SoftSA"
android:label="@string/app_name"
android:exported="true">
<intent-filter>
Expand Down
20 changes: 8 additions & 12 deletions app/src/main/cpp/spectral-plot.c
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ static size_t update_plot(const AndroidBitmapInfo *info,
return num_scans;
}

JNIEXPORT void JNICALL Java_com_example_spectral_1plot_SpectralPlot_startPlot(
JNIEXPORT void JNICALL Java_com_example_softsa_SoftSA_startPlot(
JNIEnv *env, jobject obj, jclass viewClass, jstring sockPath) {
if (state.running) {
return;
Expand Down Expand Up @@ -670,8 +670,8 @@ JNIEXPORT void JNICALL Java_com_example_spectral_1plot_SpectralPlot_startPlot(
pthread_create(&state.recv_thread, 0, recv_thread, NULL);
}

JNIEXPORT void JNICALL Java_com_example_spectral_1plot_SpectralPlot_stopPlot(
JNIEnv *env, jobject obj) {
JNIEXPORT void JNICALL Java_com_example_softsa_SoftSA_stopPlot(JNIEnv *env,
jobject obj) {
if (!state.running) {
return;
}
Expand All @@ -694,26 +694,22 @@ JNIEXPORT void JNICALL Java_com_example_spectral_1plot_SpectralPlot_stopPlot(
state.sock_path = NULL;
}

JNIEXPORT void JNICALL Java_com_example_spectral_1plot_SpectralPlot_configPlot(
JNIEXPORT void JNICALL Java_com_example_softsa_SoftSA_configPlot(
JNIEnv *env, jobject obj, jboolean showPulses) {
state.show_pulses = showPulses;
}

JNIEXPORT void JNICALL
Java_com_example_spectral_1plot_SpectralPlotView_changeHeight(JNIEnv *env,
jobject obj,
jint height) {
JNIEXPORT void JNICALL Java_com_example_softsa_PlotView_changeHeight(
JNIEnv *env, jobject obj, jint height) {
sem_wait(&state.sem);
if (height >= 0 && (size_t)height != state.rbuffer_capacity) {
resize_rbuffer(height);
}
sem_post(&state.sem);
}

JNIEXPORT jlong JNICALL
Java_com_example_spectral_1plot_SpectralPlotView_updatePlot(JNIEnv *env,
jobject obj,
jobject bitmap) {
JNIEXPORT jlong JNICALL Java_com_example_softsa_PlotView_updatePlot(
JNIEnv *env, jobject obj, jobject bitmap) {
AndroidBitmapInfo info;
void *pixels;
int ret;
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/cpp/spectral-scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ static void *forward_thread(void *arg) {
return NULL;
}

JNIEXPORT void JNICALL Java_com_example_spectral_1plot_ScanService_startScan(
JNIEXPORT void JNICALL Java_com_example_softsa_ScanService_startScan(
JNIEnv *env, jobject obj, jintArray apFreqs, jint fftSize,
jstring sockPath) {
if (state.running) {
Expand Down Expand Up @@ -500,7 +500,7 @@ JNIEXPORT void JNICALL Java_com_example_spectral_1plot_ScanService_startScan(
}

JNIEXPORT void JNICALL
Java_com_example_spectral_1plot_ScanService_stopScan(JNIEnv *env, jobject obj) {
Java_com_example_softsa_ScanService_stopScan(JNIEnv *env, jobject obj) {
if (!state.running) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.spectral_plot;
package com.example.softsa;

import android.app.Activity;
import android.app.AlertDialog;
Expand Down Expand Up @@ -35,7 +35,7 @@

import com.topjohnwu.superuser.ipc.RootService;

public class SpectralPlot extends Activity {
public class SoftSA extends Activity {
static {
System.loadLibrary("spectral-plot");
}
Expand Down Expand Up @@ -139,14 +139,14 @@ protected void onCreate(Bundle savedInstanceState) {
String uuid = UUID.randomUUID().toString();
String sockPath = new File(getCacheDir(), uuid + ".sock").getAbsolutePath();
configPlot(showPulses);
startPlot(SpectralPlotView.class, sockPath);
View view = new SpectralPlotView(this);
startPlot(PlotView.class, sockPath);
View view = new PlotView(this);
setContentView(view);
scanConn = new ScanConnection();
Intent scanIntent = new Intent(this, ScanService.class);
scanIntent.putExtra("com.example.spectral_plot.ap_freqs", getApFreqs());
scanIntent.putExtra("com.example.spectral_plot.fft_size", fftSize);
scanIntent.putExtra("com.example.spectral_plot.sock_path", sockPath);
scanIntent.putExtra("com.example.softsa.ap_freqs", getApFreqs());
scanIntent.putExtra("com.example.softsa.fft_size", fftSize);
scanIntent.putExtra("com.example.softsa.sock_path", sockPath);
RootService.bind(scanIntent, scanConn);
view.setOnClickListener(v -> {
scanConn.pause();
Expand All @@ -165,7 +165,7 @@ protected void onDestroy() {
}
}

class SpectralPlotView extends View {
class PlotView extends View {
private native long updatePlot(Bitmap bitmap);

private native void changeHeight(int height);
Expand All @@ -189,7 +189,7 @@ class SpectralPlotView extends View {
private double bluetoothPower = Double.NaN;
private double pulseFreq = Double.NaN;

protected SpectralPlotView(Context context) {
protected PlotView(Context context) {
super(context);
float density = getResources().getDisplayMetrics().density;
rightLargePaint.setColor(Color.YELLOW);
Expand Down Expand Up @@ -285,9 +285,9 @@ class ScanService extends RootService implements Handler.Callback {

@Override
public IBinder onBind(Intent intent) {
apFreqs = intent.getIntArrayExtra("com.example.spectral_plot.ap_freqs");
fftSize = intent.getIntExtra("com.example.spectral_plot.fft_size", 0);
sockPath = intent.getStringExtra("com.example.spectral_plot.sock_path");
apFreqs = intent.getIntArrayExtra("com.example.softsa.ap_freqs");
fftSize = intent.getIntExtra("com.example.softsa.fft_size", 0);
sockPath = intent.getStringExtra("com.example.softsa.sock_path");
startScan(apFreqs, fftSize, sockPath);
Handler h = new Handler(Looper.getMainLooper(), this);
Messenger m = new Messenger(h);
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Spectral Plot</string>
<string name="app_name">SoftSA</string>
</resources>

0 comments on commit 312b2dd

Please sign in to comment.