From 312b2ddf6dc9d69c2d2c29866ecb7ac4d7f09a26 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 8 Sep 2024 22:46:45 +0800 Subject: [PATCH] Rename app to SoftSA --- README.md | 4 ++-- app/build.gradle | 4 ++-- app/src/main/AndroidManifest.xml | 2 +- app/src/main/cpp/spectral-plot.c | 20 +++++++--------- app/src/main/cpp/spectral-scan.c | 4 ++-- .../SpectralPlot.java => softsa/SoftSA.java} | 24 +++++++++---------- app/src/main/res/values/strings.xml | 2 +- 7 files changed, 28 insertions(+), 32 deletions(-) rename app/src/main/java/com/example/{spectral_plot/SpectralPlot.java => softsa/SoftSA.java} (94%) diff --git a/README.md b/README.md index c0fc09f..d3d2b4f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Spectral Plot +# SoftSA An RF spectrum analyzer app for Android phones using only built-in hardware. @@ -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`. diff --git a/app/build.gradle b/app/build.gradle index 2750829..bd5eb96 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -7,7 +7,7 @@ android { ndkVersion '26.3.11579264' defaultConfig { - applicationId 'com.example.spectral_plot' + applicationId 'com.example.softsa' minSdkVersion 24 targetSdkVersion 34 ndk { @@ -26,7 +26,7 @@ android { path 'src/main/cpp/CMakeLists.txt' } } - namespace 'com.example.spectral_plot' + namespace 'com.example.softsa' } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 62f360f..9549ac7 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -9,7 +9,7 @@ android:icon="@mipmap/ic_launcher" android:label="@string/app_name"> diff --git a/app/src/main/cpp/spectral-plot.c b/app/src/main/cpp/spectral-plot.c index c8bdb42..40333e4 100644 --- a/app/src/main/cpp/spectral-plot.c +++ b/app/src/main/cpp/spectral-plot.c @@ -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; @@ -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; } @@ -694,15 +694,13 @@ 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); @@ -710,10 +708,8 @@ Java_com_example_spectral_1plot_SpectralPlotView_changeHeight(JNIEnv *env, 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; diff --git a/app/src/main/cpp/spectral-scan.c b/app/src/main/cpp/spectral-scan.c index 9179cfe..3b02f87 100644 --- a/app/src/main/cpp/spectral-scan.c +++ b/app/src/main/cpp/spectral-scan.c @@ -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) { @@ -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; } diff --git a/app/src/main/java/com/example/spectral_plot/SpectralPlot.java b/app/src/main/java/com/example/softsa/SoftSA.java similarity index 94% rename from app/src/main/java/com/example/spectral_plot/SpectralPlot.java rename to app/src/main/java/com/example/softsa/SoftSA.java index 8ffd8fd..6c51111 100644 --- a/app/src/main/java/com/example/spectral_plot/SpectralPlot.java +++ b/app/src/main/java/com/example/softsa/SoftSA.java @@ -1,4 +1,4 @@ -package com.example.spectral_plot; +package com.example.softsa; import android.app.Activity; import android.app.AlertDialog; @@ -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"); } @@ -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(); @@ -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); @@ -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); @@ -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); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e1e7227..a483d57 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1,4 +1,4 @@ - Spectral Plot + SoftSA