diff --git a/OsmAnd/AndroidManifest.xml b/OsmAnd/AndroidManifest.xml
index 8af99320de..6fb45a0312 100644
--- a/OsmAnd/AndroidManifest.xml
+++ b/OsmAnd/AndroidManifest.xml
@@ -106,6 +106,7 @@
+
diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml
index b259f11298..26a5713dbd 100644
--- a/OsmAnd/res/values/strings.xml
+++ b/OsmAnd/res/values/strings.xml
@@ -9,6 +9,12 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
-->
+ Unique device id
+ View unique device registration key and other monitoring specific settings
+ OSMo (OpenStreetMap-Monitoring)
+ OpenStreetMap-Monitoring - Advanced Live Monitoring with lots of features for remote control http://osmo.mobi
+ OSMo (Advanced Live Monitoring)
+ OSMo settings
Display position always in center
Voice
Miscallenious
diff --git a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java
index 09b7699562..4b193757a0 100644
--- a/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java
+++ b/OsmAnd/src/net/osmand/plus/OsmAndLocationProvider.java
@@ -705,7 +705,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
scheduleCheckIfGpsLost(location);
}
app.getSavingTrackHelper().updateLocation(location);
- app.getLiveMonitoringHelper().updateLocation(location);
+ OsmandPlugin.updateLocationPlugins(location);
// 2. accessibility routing
navigationInfo.setLocation(location);
@@ -736,7 +736,7 @@ public class OsmAndLocationProvider implements SensorEventListener {
// 1. Logging services
if (location != null) {
app.getSavingTrackHelper().updateLocation(location);
- app.getLiveMonitoringHelper().updateLocation(location);
+ OsmandPlugin.updateLocationPlugins(location);
}
// 2. accessibility routing
navigationInfo.setLocation(location);
diff --git a/OsmAnd/src/net/osmand/plus/OsmandApplication.java b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
index c5f7ce5149..cf49ce59bb 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandApplication.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandApplication.java
@@ -22,11 +22,11 @@ import net.osmand.plus.GPXUtilities.GPXFile;
import net.osmand.plus.GPXUtilities.WptPt;
import net.osmand.plus.access.AccessibilityMode;
import net.osmand.plus.activities.DayNightHelper;
-import net.osmand.plus.activities.LiveMonitoringHelper;
import net.osmand.plus.activities.SavingTrackHelper;
import net.osmand.plus.activities.SettingsActivity;
import net.osmand.plus.api.SQLiteAPI;
import net.osmand.plus.api.SQLiteAPIImpl;
+import net.osmand.plus.monitoring.LiveMonitoringHelper;
import net.osmand.plus.render.NativeOsmandLibrary;
import net.osmand.plus.render.RendererRegistry;
import net.osmand.plus.resources.ResourceManager;
diff --git a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
index 49c0efb921..f5768930e7 100644
--- a/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/OsmandPlugin.java
@@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.pm.PackageManager.NameNotFoundException;
import android.preference.PreferenceScreen;
import net.osmand.IProgress;
+import net.osmand.Location;
import net.osmand.PlatformUtil;
import net.osmand.access.AccessibilityPlugin;
import net.osmand.plus.activities.LocalIndexInfo;
@@ -17,6 +18,7 @@ import net.osmand.plus.development.OsmandDevelopmentPlugin;
import net.osmand.plus.distancecalculator.DistanceCalculatorPlugin;
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import net.osmand.plus.osmedit.OsmEditingPlugin;
+import net.osmand.plus.osmo.OsMoPlugin;
import net.osmand.plus.osmodroid.OsMoDroidPlugin;
import net.osmand.plus.parkingpoint.ParkingPositionPlugin;
import net.osmand.plus.rastermaps.OsmandRasterMapsPlugin;
@@ -75,6 +77,7 @@ public abstract class OsmandPlugin {
installedPlugins.add(new DistanceCalculatorPlugin(app));
installedPlugins.add(new AudioVideoNotesPlugin(app));
installedPlugins.add(new OsmEditingPlugin(app));
+ installedPlugins.add(new OsMoPlugin(app));
installedPlugins.add(new OsmandDevelopmentPlugin(app));
@@ -130,7 +133,9 @@ public abstract class OsmandPlugin {
public void registerOptionsMenuItems(MapActivity mapActivity, ContextMenuAdapter helper) {}
- public void loadLocalIndexes(List result, LoadLocalIndexTask loadTask) {};
+ public void loadLocalIndexes(List result, LoadLocalIndexTask loadTask) {}
+
+ public void updateLocation(Location location) {}
public void contextMenuLocalIndexes(LocalIndexesActivity la, LocalIndexInfo info, ContextMenuAdapter adapter) {};
@@ -300,5 +305,11 @@ public abstract class OsmandPlugin {
return false;
}
+ public static void updateLocationPlugins(net.osmand.Location location) {
+ for(OsmandPlugin p : installedPlugins){
+ p.updateLocation(location);
+ }
+ }
+
}
diff --git a/OsmAnd/src/net/osmand/plus/activities/LiveMonitoringHelper.java b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java
similarity index 98%
rename from OsmAnd/src/net/osmand/plus/activities/LiveMonitoringHelper.java
rename to OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java
index 6efba25a22..07244fb9cf 100644
--- a/OsmAnd/src/net/osmand/plus/activities/LiveMonitoringHelper.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/LiveMonitoringHelper.java
@@ -1,4 +1,4 @@
-package net.osmand.plus.activities;
+package net.osmand.plus.monitoring;
import java.io.BufferedReader;
import java.io.InputStream;
@@ -13,7 +13,6 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandPlugin;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R;
-import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
import org.apache.commons.logging.Log;
import org.apache.http.HttpResponse;
diff --git a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
index e50bd77011..01cbeeb601 100644
--- a/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/monitoring/OsmandMonitoringPlugin.java
@@ -1,5 +1,6 @@
package net.osmand.plus.monitoring;
+import net.osmand.Location;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
@@ -36,11 +37,18 @@ public class OsmandMonitoringPlugin extends OsmandPlugin implements MonitoringIn
private OsmandSettings settings;
private OsmandApplication app;
private BaseMapWidget monitoringControl;
+ private LiveMonitoringHelper liveMonitoringHelper;
public OsmandMonitoringPlugin(OsmandApplication app) {
this.app = app;
+ liveMonitoringHelper = new LiveMonitoringHelper(app);
ApplicationMode.regWidget("monitoring", (ApplicationMode[])null);
}
+
+ @Override
+ public void updateLocation(Location location) {
+ liveMonitoringHelper.updateLocation(location);
+ }
@Override
public boolean init(OsmandApplication app) {
diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java
new file mode 100644
index 0000000000..09825b31df
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoPlugin.java
@@ -0,0 +1,118 @@
+package net.osmand.plus.osmo;
+
+import java.io.IOException;
+
+import net.osmand.Location;
+import net.osmand.PlatformUtil;
+import net.osmand.plus.ContextMenuAdapter;
+import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
+import net.osmand.plus.OsmandApplication;
+import net.osmand.plus.OsmandPlugin;
+import net.osmand.plus.R;
+import net.osmand.plus.activities.SettingsActivity;
+import net.osmand.plus.views.MonitoringInfoControl;
+import net.osmand.plus.views.MonitoringInfoControl.MonitoringInfoControlServices;
+import net.osmand.plus.views.OsmandMapTileView;
+
+import org.apache.commons.logging.Log;
+
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.preference.Preference;
+import android.preference.Preference.OnPreferenceClickListener;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+
+public class OsMoPlugin extends OsmandPlugin implements MonitoringInfoControlServices {
+
+ private OsmandApplication app;
+ public static final String ID = "osmand.osmodroid.v2";
+ private static final Log log = PlatformUtil.getLog(OsMoPlugin.class);
+ private OsMoService service;
+
+ public OsMoPlugin(final OsmandApplication app){
+ service = new OsMoService();
+ this.app = app;
+ }
+
+ @Override
+ public boolean init(final OsmandApplication app) {
+ return true;
+ }
+
+ @Override
+ public void updateLocation(Location location) {
+ if(service.isActive()) {
+ try {
+ service.sendCoordinate(location.getLatitude(), location.getLongitude(), location.getAccuracy(),
+ (float) location.getAltitude(), location.getSpeed(), location.getBearing());
+ } catch (IOException e) {
+ log.error(e.getMessage(), e);
+ }
+ }
+ }
+
+ public static String getUUID(Context ctx) {
+ return Settings.Secure.getString(ctx.getContentResolver(), Settings.Secure.ANDROID_ID);
+ }
+
+ @Override
+ public String getDescription() {
+ return app.getString(R.string.osmo_plugin_description);
+ }
+
+ @Override
+ public String getName() {
+ return app.getString(R.string.osmo_plugin_name) ;
+ }
+
+ @Override
+ public void addMonitorActions(ContextMenuAdapter qa, MonitoringInfoControl li, OsmandMapTileView view) {
+ final boolean off = service.isActive();
+ qa.item(off ? R.string.osmodroid_mode_off : R.string.osmodroid_mode_on
+)
+ .icon(off ? R.drawable.monitoring_rec_inactive : R.drawable.monitoring_rec_big)
+ .listen(new OnContextMenuClick() {
+
+ @Override
+ public void onContextMenuClick(int itemId, int pos, boolean isChecked, DialogInterface dialog) {
+ try {
+ String response;
+ if (off) {
+ response = service.activate(getUUID(app));
+ } else {
+ response = service.deactivate();
+ }
+ app.showToastMessage(response);
+ } catch (Exception e) {
+ app.showToastMessage(app.getString(R.string.error_io_error) + ": " + e.getMessage());
+ }
+ }
+
+
+ }).reg();
+ }
+
+ @Override
+ public void settingsActivityCreate(final SettingsActivity activity, PreferenceScreen screen) {
+ Preference grp = new Preference(activity);
+ grp.setOnPreferenceClickListener(new OnPreferenceClickListener() {
+
+ @Override
+ public boolean onPreferenceClick(Preference preference) {
+ activity.startActivity(new Intent(activity, SettingsOsMoActivity.class));
+ return true;
+ }
+ });
+ grp.setSummary(R.string.osmo_settings_descr);
+ grp.setTitle(R.string.osmo_settings);
+ grp.setKey("osmo_settings");
+ screen.addPreference(grp);
+ }
+
+ @Override
+ public String getId() {
+ return ID;
+ }
+}
diff --git a/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java
new file mode 100644
index 0000000000..f9f401fb68
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/osmo/OsMoService.java
@@ -0,0 +1,52 @@
+package net.osmand.plus.osmo;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.net.URL;
+import java.net.URLConnection;
+
+public class OsMoService {
+ private static String TRACKER_URL = "ws://srv.osmo.mobi";
+ private URLConnection conn;
+ private OutputStreamWriter out;
+ private BufferedReader in;
+
+ public boolean isActive() {
+ return conn != null;
+ }
+
+ public String activate(String hash) throws IOException {
+ URL tu = new URL(TRACKER_URL);
+ conn = tu.openConnection();
+ conn.connect();
+ in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
+ out = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
+
+ String t = sendCommand("auth|"+hash);
+ t += sendCommand("session_open");
+ return t;
+ }
+
+ private String sendCommand(String s) throws IOException {
+ if(s.endsWith("\n")) {
+ s += "\n";
+ }
+ out.write(s);
+ return in.readLine();
+ }
+
+ public void sendCoordinate(double lat, double lon, float hdop, float alt, float speed, float bearing) throws IOException {
+ sendCommand("p|"+lat+":"+lon+":"+hdop+":"+alt+":"+speed+":"+bearing);
+ }
+
+ public String deactivate() throws IOException {
+ String t = sendCommand("session_close");
+ in.close();
+ out.close();
+ conn = null;
+ return t;
+ }
+
+}
diff --git a/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java b/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java
new file mode 100644
index 0000000000..bc0060a2b8
--- /dev/null
+++ b/OsmAnd/src/net/osmand/plus/osmo/SettingsOsMoActivity.java
@@ -0,0 +1,38 @@
+package net.osmand.plus.osmo;
+
+
+import net.osmand.plus.R;
+import net.osmand.plus.activities.SettingsBaseActivity;
+import android.os.Bundle;
+import android.preference.Preference;
+import android.preference.PreferenceScreen;
+import android.provider.Settings;
+
+public class SettingsOsMoActivity extends SettingsBaseActivity {
+
+ public static final String MORE_VALUE = "MORE_VALUE";
+ public static final String DEFINE_EDIT = "DEFINE_EDIT";
+
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ getSupportActionBar().setTitle(R.string.online_map_settings);
+ PreferenceScreen grp = getPreferenceScreen();
+
+ Preference pref = new Preference(this);
+ pref.setTitle(R.string.osmo_settings_uuid);
+ pref.setSummary(OsMoPlugin.getUUID(this));
+
+ grp.addPreference(pref);
+
+
+ }
+
+
+ public void updateAllSettings() {
+ super.updateAllSettings();
+ }
+
+
+}
diff --git a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java
index d90dc8938b..97b3a0f365 100644
--- a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java
+++ b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPlugin.java
@@ -161,12 +161,12 @@ public class OsMoDroidPlugin extends OsmandPlugin implements MonitoringInfoContr
@Override
public String getDescription() {
- return app.getString(R.string.osmodroid_plugin_description);
+ return app.getString(R.string.osmodroid_plugin_description) + "\n External application.";
}
@Override
public String getName() {
- return app.getString(R.string.osmodroid_plugin_name);
+ return app.getString(R.string.osmodroid_plugin_name) + " (external)";
}
// test
diff --git a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPoint.java b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPoint.java
index ef0b2ee780..a724e07f79 100644
--- a/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPoint.java
+++ b/OsmAnd/src/net/osmand/plus/osmodroid/OsMoDroidPoint.java
@@ -1,42 +1,40 @@
package net.osmand.plus.osmodroid;
-
import net.osmand.data.LatLon;
public class OsMoDroidPoint {
-@Override
-public boolean equals(Object o) {
+ @Override
+ public boolean equals(Object o) {
-if((o instanceof OsMoDroidPoint) && this.id == ((OsMoDroidPoint)o).id )
-{
-return true;
-}
-else
-{
-return false;
-}
-}
+ if ((o instanceof OsMoDroidPoint) && this.id == ((OsMoDroidPoint) o).id) {
+ return true;
+ } else {
+ return false;
+ }
+ }
-LatLon latlon;
-LatLon prevlatlon;
-String name;
-String description;
-int id;
-int layerId;
-String speed="";
-String color="AAAAAA";
+ LatLon latlon;
+ LatLon prevlatlon;
+ String name;
+ String description;
+ int id;
+ int layerId;
+ String speed = "";
+ String color = "AAAAAA";
-public OsMoDroidPoint(float objectLat, float objectLon, String objectName, String objectDescription, int objectId, int layerId ,String speed, String color) {
-this.latlon=new LatLon(objectLat, objectLon);
-this.name=objectName;
-this.description=objectDescription;
-this.id=objectId;
-this.layerId=layerId;
-if(speed!=null){ this.speed=speed;}
-if(color!=null){ this.color=color;}
-}
+ public OsMoDroidPoint(float objectLat, float objectLon, String objectName, String objectDescription, int objectId,
+ int layerId, String speed, String color) {
+ this.latlon = new LatLon(objectLat, objectLon);
+ this.name = objectName;
+ this.description = objectDescription;
+ this.id = objectId;
+ this.layerId = layerId;
+ if (speed != null) {
+ this.speed = speed;
+ }
+ if (color != null) {
+ this.color = color;
+ }
+ }
}
-
-
-