Skip to content

Commit 6ab4c7b

Browse files
committed
externel web viewer
1 parent 3c2ff2d commit 6ab4c7b

File tree

10 files changed

+152
-63
lines changed

10 files changed

+152
-63
lines changed

app/build.gradle

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,21 @@ android {
5151
version '3.18.1+'
5252
}
5353
}
54-
buildToolsVersion '30.0.3'
5554
ndkVersion '24.0.8215888'
5655
namespace 'com.jvdegithub.aiscatcher'
5756
}
5857

5958
dependencies {
6059

61-
implementation 'androidx.appcompat:appcompat:1.5.0'
62-
implementation 'com.google.android.material:material:1.6.1'
63-
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
64-
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
65-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
60+
implementation 'androidx.appcompat:appcompat:1.7.0'
61+
implementation 'com.google.android.material:material:1.12.0'
62+
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
63+
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.7'
64+
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7'
6665
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
67-
implementation 'androidx.preference:preference:1.2.0'
68-
implementation 'androidx.webkit:webkit:1.4.0'
66+
implementation 'androidx.preference:preference:1.2.1'
67+
implementation 'androidx.webkit:webkit:1.12.1'
6968
testImplementation 'junit:junit:4.13.2'
70-
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
71-
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
69+
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
70+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
7271
}

app/src/main/java/com/jvdegithub/aiscatcher/AisCatcherJava.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ public interface AisCallback {
5555

5656
static native int createUDP(String h, String p);
5757

58+
static native int createWebViewer(String p);
59+
5860
static native int createSharing(boolean b, String key);
5961

6062

app/src/main/java/com/jvdegithub/aiscatcher/Settings.java

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ static void setDefault(Context context) {
6060
preferences.edit().putString("sSHARINGKEY", "").commit();
6161
preferences.edit().putBoolean("sSHARING", false).commit();
6262

63+
preferences.edit().putBoolean("w1SWITCH", false).commit();
64+
preferences.edit().putInt("w1PORT", 8100).commit();
65+
66+
6367
preferences.edit().putString("oCGF_WIDE", "Default").commit();
6468
preferences.edit().putString("oMODEL_TYPE", "Default").commit();
6569
preferences.edit().putBoolean("oFP_DS", false).commit();
@@ -123,6 +127,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
123127

124128
((EditTextPreference) getPreferenceManager().findPreference("sHOST")).setOnBindEditTextListener(validateIP);
125129
((EditTextPreference) getPreferenceManager().findPreference("sPORT")).setOnBindEditTextListener(validatePort);
130+
((EditTextPreference) getPreferenceManager().findPreference("w1PORT")).setOnBindEditTextListener(validatePort);;
126131
((SeekBarPreference) getPreferenceManager().findPreference("sGAIN")).setUpdatesContinuously(true);
127132
((EditTextPreference) getPreferenceManager().findPreference("tPORT")).setOnBindEditTextListener(validatePort);
128133
((EditTextPreference) getPreferenceManager().findPreference("rFREQOFFSET")).setOnBindEditTextListener(validatePPM);
@@ -147,7 +152,7 @@ static public int getModelType(Context context)
147152
}
148153

149154
private void setSummaries() {
150-
setSummaryText(new String[]{"tPORT","tHOST","sPORT","sHOST","u1HOST","u1PORT","u2HOST","u2PORT", "u3HOST","u3PORT", "u4HOST","u4PORT", "rFREQOFFSET", "sSHARINGKEY"});
155+
setSummaryText(new String[]{"w1PORT","tPORT","tHOST","sPORT","sHOST","u1HOST","u1PORT","u2HOST","u2PORT", "u3HOST","u3PORT", "u4HOST","u4PORT", "rFREQOFFSET", "sSHARINGKEY"});
151156
setSummaryList(new String[]{"rTUNER","rRATE","sRATE","tRATE","tPROTOCOL","tTUNER","mRATE","hRATE","oMODEL_TYPE","oCGF_WIDE"});
152157
setSummarySeekbar(new String[]{"mLINEARITY", "sGAIN"});
153158
}
@@ -269,6 +274,8 @@ static public boolean Apply(Context context) {
269274
if (!SetUDPoutput("u3", context)) return false;
270275
if (!SetUDPoutput("u4", context)) return false;
271276

277+
if (!SetWebViewerOutput( context)) return false;
278+
272279
if(!SetSharing(context)) return false;
273280

274281
return true;
@@ -360,6 +367,19 @@ static private boolean SetUDPoutput(String s, Context context) {
360367
}
361368
return true;
362369
}
370+
371+
static private boolean SetWebViewerOutput(Context context) {
372+
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
373+
374+
boolean b = preferences.getBoolean("w1SWITCH", false);
375+
if (b) {
376+
String port = preferences.getString("w1PORT", "");
377+
return AisCatcherJava.createWebViewer(port) == 0;
378+
379+
}
380+
return true;
381+
}
382+
363383
static private boolean SetSharing(Context context) {
364384
String defaultKey = "a6392e08-c57e-4e7a-a4fb-d73bfc7619ae";
365385

app/src/main/jni/AIS-catcher

Submodule AIS-catcher updated 90 files

app/src/main/jni/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.10.2)
77

88
project("AIScatcherNDK")
99

10-
set(OPTIMIZATION_FLAGS "-Ofast")
11-
#set(OPTIMIZATION_FLAGS "-g")
10+
#set(OPTIMIZATION_FLAGS "-Ofast")
11+
set(OPTIMIZATION_FLAGS "-g")
1212

1313
set(CMAKE_CXX_FLAGS "${OPTIMIZATION_FLAGS}")
1414
set(CMAKE_C_FLAGS "${OPTIMIZATION_FLAGS}")
@@ -52,7 +52,7 @@ add_library( # Sets the name of the library.
5252
./AIS-catcher/Device/ZMQ.cpp ./AIS-catcher/Device/SoapySDR.cpp ./AIS-catcher/Device/SpyServer.cpp ./AIS-catcher/Library/Message.cpp ./AIS-catcher/Library/NMEA.cpp
5353
./AIS-catcher/Library/Utilities.cpp ./AIS-catcher/Library/TCP.cpp ./AIS-catcher/JSON/JSON.cpp ./AIS-catcher/IO/Network.cpp ./AIS-catcher/IO/HTTPServer.cpp
5454
./AIS-catcher/JSON/StringBuilder.cpp ./AIS-catcher/JSON/Parser.cpp ./AIS-catcher/Device/AIRSPY.cpp ./AIS-catcher/Device/Serial.cpp
55-
./AIS-catcher/DSP/DSP.cpp ./AIS-catcher/IO/IO.cpp ./AIS-catcher/Application/WebViewer.cpp ./AIS-catcher/Application/Prometheus.cpp
55+
./AIS-catcher/DSP/DSP.cpp ./AIS-catcher/Application/WebViewer.cpp ./AIS-catcher/Application/Prometheus.cpp ./AIS-catcher/Protocol/Protocol.cpp ./AIS-catcher/Library/Logger.cpp
5656

5757
JNI/AIScatcherNDK.cpp)
5858

@@ -61,7 +61,7 @@ include_directories(
6161
./rtl-sdr/include
6262
./airspyone_host/libairspy/src
6363
./airspyhf/libairspyhf/src
64-
./AIS-catcher ./AIS-catcher/Application ./AIS-catcher/IO ./AIS-catcher/Library ./AIS-catcher/Ships ./AIS-catcher/DBMS ./AIS-catcher/DSP ./AIS-catcher/Device)
64+
./AIS-catcher ./AIS-catcher/Application ./AIS-catcher/IO ./AIS-catcher/Library ./AIS-catcher/Ships ./AIS-catcher/DBMS ./AIS-catcher/DSP ./AIS-catcher/Device ./AIS-catcher/Protocol)
6565

6666
add_definitions(-DHASRTLSDR -DHASRTLSDR_BIASTEE -DHASRTL_ANDROID -DHASAIRSPY -DHASAIRSPY_ANDROID -D HASAIRSPYHF -DHASAIRSPYHF_ANDROID -DHASRTLSDR_TUNERBW)
6767

0 commit comments

Comments
 (0)