Skip to content

Commit f88dc5a

Browse files
committed
- provided some easy geopackage sharing capability
- initial geopackage extraction capability (not yet exposed to the user) - small enhancements to real-time EW estimation tools - minor GUI and admin stuff for the viewer (like providing licensing and contribution acknowledgements and initial settings support)
1 parent 4f25beb commit f88dc5a

32 files changed

Lines changed: 688 additions & 63 deletions

torgi/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ android {
66
applicationId "org.sofwerx.torgi"
77
minSdkVersion 24
88
targetSdkVersion 27
9-
versionCode 3
10-
versionName "0.4"
9+
versionCode 4
10+
versionName "1.0"
1111
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
1212
externalNativeBuild {
1313
cmake {
@@ -50,9 +50,10 @@ dependencies {
5050
//implementation fileTree(include: ['*.jar'], dir: 'libs')
5151
//implementation project(':geopackage-sdk')
5252

53+
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
5354
viewerImplementation 'com.github.PhilJay:MPAndroidChart:v3.0.3' //for charts
5455
viewerImplementation 'org.osmdroid:osmdroid-android:6.0.2'
55-
viewerImplementation 'org.apache.commons:commons-math3:3.0' //for statistical analysis
56+
implementation 'org.apache.commons:commons-math3:3.0' //for statistical analysis
5657
implementation 'mil.nga.geopackage:geopackage-android:3.0.2'
5758
implementation 'com.android.support:appcompat-v7:27.1.1'
5859
viewerImplementation 'com.android.support.constraint:constraint-layout:1.1.3'
@@ -61,4 +62,4 @@ dependencies {
6162
testImplementation 'junit:junit:4.12'
6263
androidTestImplementation 'com.android.support.test:runner:1.0.2'
6364
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
64-
}
65+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<menu xmlns:android="http://schemas.android.com/apk/res/android"
2+
xmlns:app="http://schemas.android.com/apk/res-auto"
3+
xmlns:tools="http://schemas.android.com/tools"
4+
tools:context="org.sofwerx.signalmonitor.MainActivity">
5+
<item
6+
android:id="@+id/action_settings"
7+
android:orderInCategory="100"
8+
android:title="@string/action_settings"
9+
app:showAsAction="never" />
10+
</menu>

torgi/src/main/AndroidManifest.xml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
33
package="org.sofwerx.torgi">
4+
45
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
56
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
67
<uses-permission android:name="android.permission.INTERNET" />
@@ -13,17 +14,28 @@
1314
android:roundIcon="@mipmap/ic_launcher_round"
1415
android:supportsRtl="true"
1516
android:theme="@style/AppTheme">
16-
17-
<service android:name="org.sofwerx.torgi.service.TorgiService"/>
18-
17+
<service android:name=".service.TorgiService" />
18+
<provider
19+
android:name=".GeoPackageFileProvider"
20+
android:authorities="${applicationId}.geopackage.provider"
21+
android:exported="false"
22+
android:grantUriPermissions="true">
23+
<meta-data
24+
android:name="android.support.FILE_PROVIDER_PATHS"
25+
android:resource="@xml/provider_paths"/>
26+
</provider>
1927
<activity
2028
android:name=".ui.MainActivity"
2129
android:label="@string/app_name"
2230
android:launchMode="singleTask">
2331
<intent-filter>
2432
<action android:name="android.intent.action.MAIN" />
33+
2534
<category android:name="android.intent.category.LAUNCHER" />
2635
</intent-filter>
2736
</activity>
37+
<activity android:name=".ui.SettingsActivity" />
38+
2839
</application>
40+
2941
</manifest>
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
package org.sofwerx.torgi;
2+
3+
import android.content.Context;
4+
import android.content.SharedPreferences;
5+
import android.os.Environment;
6+
import android.preference.PreferenceManager;
7+
8+
import java.io.File;
9+
10+
public class Config {
11+
public final static String PREFS_SAVE_DIR = "savedir";
12+
13+
private static Config instance = null;
14+
private String savedDir = null;
15+
private SharedPreferences prefs = null;
16+
private Context context;
17+
18+
private Config(Context context) {
19+
this.context = context;
20+
prefs = PreferenceManager.getDefaultSharedPreferences(context);
21+
}
22+
23+
public static Config getInstance(Context context) {
24+
if (instance == null)
25+
instance = new Config(context);
26+
return instance;
27+
}
28+
29+
public String getSavedDir() {
30+
if (savedDir == null) {
31+
/*savedDir = prefs.getString(PREFS_SAVE_DIR, null);
32+
if (savedDir != null) {
33+
try {
34+
Uri savedDirUri = Uri.parse(savedDir);
35+
if (savedDirUri != null) {
36+
context.getContentResolver().takePersistableUriPermission(savedDirUri,
37+
Intent.FLAG_GRANT_READ_URI_PERMISSION |
38+
Intent.FLAG_GRANT_WRITE_URI_PERMISSION); //Keep the permissions to access this location up to date across reboots
39+
}
40+
} catch (NullPointerException ignore) {}
41+
}
42+
if (savedDir == null)
43+
savedDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS).getAbsolutePath();*/
44+
if (savedDir == null) {
45+
File folder = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS), "TORGI");
46+
folder.mkdirs();
47+
savedDir = folder.getAbsolutePath();
48+
}
49+
}
50+
return savedDir;
51+
}
52+
53+
public void setSavedDir(String savedDir) {
54+
SharedPreferences.Editor edit = prefs.edit();
55+
if (savedDir == null)
56+
edit.remove(PREFS_SAVE_DIR);
57+
else
58+
edit.putString(PREFS_SAVE_DIR,savedDir);
59+
edit.commit();
60+
}
61+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.sofwerx.torgi;
2+
3+
import android.support.v4.content.FileProvider;
4+
5+
public class GeoPackageFileProvider extends FileProvider {}

torgi/src/main/java/org/sofwerx/torgi/gnss/DataPoint.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ public class DataPoint {
1414
private SpaceTime spaceTime;
1515
private ArrayList<SatMeasurement> measurements = null;
1616

17+
public DataPoint() {}
18+
1719
public DataPoint(SpaceTime spaceTime, ArrayList<SatMeasurement> measurements) {
1820
this.spaceTime = spaceTime;
1921
this.measurements = measurements;
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package org.sofwerx.torgi.gnss.helper;
2+
3+
public class GeoPackageGPSPtHelper {
4+
private long id;
5+
private double lat;
6+
private double lng;
7+
private double alt;
8+
private long time;
9+
10+
public double getLat() {
11+
return lat;
12+
}
13+
14+
public void setLat(Object lat) {
15+
this.lat = (double)lat;
16+
}
17+
18+
public long getId() {
19+
return id;
20+
}
21+
22+
public void setId(Object id) {
23+
this.id = (long)id;
24+
}
25+
26+
public double getLng() {
27+
return lng;
28+
}
29+
30+
public void setLng(Object lng) {
31+
this.lng = (double)lng;
32+
}
33+
34+
public double getAlt() {
35+
return alt;
36+
}
37+
38+
public void setAlt(Object alt) {
39+
this.alt = (double)alt;
40+
}
41+
42+
public long getTime() {
43+
return time;
44+
}
45+
46+
public void setTime(Object time) {
47+
this.time = (long)time;
48+
}
49+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package org.sofwerx.torgi.gnss.helper;
2+
3+
import org.sofwerx.torgi.gnss.Constellation;
4+
5+
public class GeoPackageSatDataHelper {
6+
private long meassuredTime;
7+
private long id;
8+
private int svid;
9+
private Constellation constellation;
10+
private double cn0;
11+
private double agc;
12+
13+
public int getSvid() {
14+
return svid;
15+
}
16+
17+
public void setSvid(Object svid) {
18+
this.svid = (int)((long)svid);
19+
}
20+
21+
public Constellation getConstellation() {
22+
return constellation;
23+
}
24+
25+
public void setConstellation(Object constellation) {
26+
this.constellation = Constellation.valueOf((String) constellation);
27+
}
28+
29+
public double getCn0() {
30+
return cn0;
31+
}
32+
33+
public void setCn0(Object cn0) {
34+
this.cn0 = (double)cn0;
35+
}
36+
37+
public double getAgc() {
38+
return agc;
39+
}
40+
41+
public void setAgc(Object agc) {
42+
this.agc = (double)agc;
43+
}
44+
45+
public long getId() {
46+
return id;
47+
}
48+
49+
public void setId(Object id) {
50+
this.id = (long)id;
51+
}
52+
53+
public long getMeassuredTime() {
54+
return meassuredTime;
55+
}
56+
57+
public void setMeassuredTime(Object meassuredTime) {
58+
this.meassuredTime = (long) meassuredTime;
59+
}
60+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package org.sofwerx.torgi.listener;
2+
3+
import android.location.GnssMeasurement;
4+
import android.support.annotation.NonNull;
5+
6+
import org.sofwerx.torgi.gnss.helper.GeoPackageGPSPtHelper;
7+
import org.sofwerx.torgi.gnss.helper.GeoPackageSatDataHelper;
8+
9+
import java.util.ArrayList;
10+
11+
public interface GeoPackageRetrievalListener {
12+
void onGnssSatDataRetrieved(ArrayList<GeoPackageSatDataHelper> measurements);
13+
void onGnssGeoPtRetrieved(ArrayList<GeoPackageGPSPtHelper> measurements);
14+
}

0 commit comments

Comments
 (0)