Skip to content

Commit

Permalink
externel web viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
jvde-github committed Dec 9, 2024
1 parent 3c2ff2d commit 6ab4c7b
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 63 deletions.
19 changes: 9 additions & 10 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,22 +51,21 @@ android {
version '3.18.1+'
}
}
buildToolsVersion '30.0.3'
ndkVersion '24.0.8215888'
namespace 'com.jvdegithub.aiscatcher'
}

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.0'
implementation 'com.google.android.material:material:1.6.1'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.5.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.5.1'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'androidx.constraintlayout:constraintlayout:2.2.0'
implementation 'androidx.lifecycle:lifecycle-livedata-ktx:2.8.7'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.preference:preference:1.2.0'
implementation 'androidx.webkit:webkit:1.4.0'
implementation 'androidx.preference:preference:1.2.1'
implementation 'androidx.webkit:webkit:1.12.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
androidTestImplementation 'androidx.test.ext:junit:1.2.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.6.1'
}
2 changes: 1 addition & 1 deletion app/src/main/assets/webassets
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public interface AisCallback {

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

static native int createWebViewer(String p);

static native int createSharing(boolean b, String key);


Expand Down
22 changes: 21 additions & 1 deletion app/src/main/java/com/jvdegithub/aiscatcher/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ static void setDefault(Context context) {
preferences.edit().putString("sSHARINGKEY", "").commit();
preferences.edit().putBoolean("sSHARING", false).commit();

preferences.edit().putBoolean("w1SWITCH", false).commit();
preferences.edit().putInt("w1PORT", 8100).commit();


preferences.edit().putString("oCGF_WIDE", "Default").commit();
preferences.edit().putString("oMODEL_TYPE", "Default").commit();
preferences.edit().putBoolean("oFP_DS", false).commit();
Expand Down Expand Up @@ -123,6 +127,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {

((EditTextPreference) getPreferenceManager().findPreference("sHOST")).setOnBindEditTextListener(validateIP);
((EditTextPreference) getPreferenceManager().findPreference("sPORT")).setOnBindEditTextListener(validatePort);
((EditTextPreference) getPreferenceManager().findPreference("w1PORT")).setOnBindEditTextListener(validatePort);;
((SeekBarPreference) getPreferenceManager().findPreference("sGAIN")).setUpdatesContinuously(true);
((EditTextPreference) getPreferenceManager().findPreference("tPORT")).setOnBindEditTextListener(validatePort);
((EditTextPreference) getPreferenceManager().findPreference("rFREQOFFSET")).setOnBindEditTextListener(validatePPM);
Expand All @@ -147,7 +152,7 @@ static public int getModelType(Context context)
}

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

if (!SetWebViewerOutput( context)) return false;

if(!SetSharing(context)) return false;

return true;
Expand Down Expand Up @@ -360,6 +367,19 @@ static private boolean SetUDPoutput(String s, Context context) {
}
return true;
}

static private boolean SetWebViewerOutput(Context context) {
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);

boolean b = preferences.getBoolean("w1SWITCH", false);
if (b) {
String port = preferences.getString("w1PORT", "");
return AisCatcherJava.createWebViewer(port) == 0;

}
return true;
}

static private boolean SetSharing(Context context) {
String defaultKey = "a6392e08-c57e-4e7a-a4fb-d73bfc7619ae";

Expand Down
2 changes: 1 addition & 1 deletion app/src/main/jni/AIS-catcher
Submodule AIS-catcher updated 90 files
+37 −2 .github/workflows/build.yml
+2 −5 Application/AIS-catcher.h
+54 −23 Application/Config.cpp
+3 −1 Application/Config.h
+250 −160 Application/Main.cpp
+16 −15 Application/Receiver.cpp
+5 −4 Application/Receiver.h
+273 −155 Application/WebViewer.cpp
+5 −7 Application/WebViewer.h
+2 −0 Application/version.h
+557 −516 CMakeLists.txt
+21 −21 DBMS/PostgreSQL.cpp
+1 −1 DBMS/PostgreSQL.h
+2 −2 DSP/DSP.cpp
+21 −14 DSP/Model.cpp
+55 −38 DSP/Model.h
+2 −2 Device/AIRSPYHF.cpp
+1 −1 Device/Device.h
+8 −5 Device/FileRAW.cpp
+1 −0 Device/FileRAW.h
+13 −6 Device/RTLSDR.cpp
+1 −1 Device/RTLSDR.h
+137 −137 Device/RTLTCP.cpp
+19 −47 Device/RTLTCP.h
+35 −10 Device/SDRPLAY.cpp
+9 −8 Device/SDRPLAY.h
+7 −7 Device/Serial.cpp
+9 −8 Device/SoapySDR.cpp
+1 −0 Device/SoapySDR.h
+36 −24 Device/SpyServer.cpp
+2 −2 Device/SpyServer.h
+5 −5 Device/UDP.cpp
+3 −3 Device/ZMQ.cpp
+11 −3 Dockerfile
+0 −161 Documentation/README-grafana.md
+1,272 −58 HTML/favicon.cpp
+162 −290 HTML/index.html
+831 −774 HTML/index_html.cpp
+162 −290 HTML/index_local.html
+829 −773 HTML/index_local_html.cpp
+845 −229 HTML/script.js
+3,241 −2,930 HTML/script_js.cpp
+238 −247 HTML/style.css
+2,306 −2,424 HTML/style_css.cpp
+12 −33 IO/HTTPClient.cpp
+1 −3 IO/HTTPClient.h
+7 −4 IO/HTTPServer.cpp
+0 −4 IO/HTTPServer.h
+10 −10 IO/MsgOut.cpp
+6 −4 IO/MsgOut.h
+7 −7 IO/N2KInterface.cpp
+2 −2 IO/N2KInterface.h
+1 −1 IO/N2KStream.h
+184 −35 IO/Network.cpp
+83 −35 IO/Network.h
+3 −2 JSON/Parser.cpp
+54 −27 Library/AIS.cpp
+3 −1 Library/AIS.h
+22 −3 Library/Common.h
+3 −0 Library/Keys.cpp
+3 −0 Library/Keys.h
+287 −0 Library/Logger.cpp
+91 −0 Library/Logger.h
+75 −121 Library/Message.cpp
+5 −1 Library/Message.h
+107 −167 Library/NMEA.cpp
+6 −0 Library/NMEA.h
+143 −0 Library/StackTracer.cpp
+287 −155 Library/TCP.cpp
+39 −21 Library/TCP.h
+503 −155 Library/Utilities.cpp
+10 −1 Library/Utilities.h
+5 −5 Makefile
+835 −0 Protocol/Protocol.cpp
+936 −0 Protocol/Protocol.h
+14 −1,277 README.md
+11 −7 Ships/DB.cpp
+1 −0 Ships/Ships.cpp
+1 −9 Ships/Statistics.h
+1 −1 build-docker/bookworm/Dockerfile
+10 −6 msvc/AIS-catcher RTLSDR.vcxproj
+4 −10 plugins/google_option.pjs
+1 −1 plugins/marinetraffic_option.pjs
+1 −1 plugins/shipxplorer_option.pjs
+1 −1 plugins/vesselfinder_option.pjs
+269 −49 scripts/aiscatcher-install
+41 −5 scripts/build-NMEA2000.sh
+6 −6 scripts/build-html.sh
+12 −62 scripts/build.sh
+80 −0 scripts/site_generator.sh
8 changes: 4 additions & 4 deletions app/src/main/jni/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ cmake_minimum_required(VERSION 3.10.2)

project("AIScatcherNDK")

set(OPTIMIZATION_FLAGS "-Ofast")
#set(OPTIMIZATION_FLAGS "-g")
#set(OPTIMIZATION_FLAGS "-Ofast")
set(OPTIMIZATION_FLAGS "-g")

set(CMAKE_CXX_FLAGS "${OPTIMIZATION_FLAGS}")
set(CMAKE_C_FLAGS "${OPTIMIZATION_FLAGS}")
Expand Down Expand Up @@ -52,7 +52,7 @@ add_library( # Sets the name of the library.
./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
./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
./AIS-catcher/JSON/StringBuilder.cpp ./AIS-catcher/JSON/Parser.cpp ./AIS-catcher/Device/AIRSPY.cpp ./AIS-catcher/Device/Serial.cpp
./AIS-catcher/DSP/DSP.cpp ./AIS-catcher/IO/IO.cpp ./AIS-catcher/Application/WebViewer.cpp ./AIS-catcher/Application/Prometheus.cpp
./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

JNI/AIScatcherNDK.cpp)

Expand All @@ -61,7 +61,7 @@ include_directories(
./rtl-sdr/include
./airspyone_host/libairspy/src
./airspyhf/libairspyhf/src
./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 ./AIS-catcher/Application ./AIS-catcher/IO ./AIS-catcher/Library ./AIS-catcher/Ships ./AIS-catcher/DBMS ./AIS-catcher/DSP ./AIS-catcher/Device ./AIS-catcher/Protocol)

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

Expand Down
Loading

0 comments on commit 6ab4c7b

Please sign in to comment.