Porównaj commity

...

2 Commity

Autor SHA1 Wiadomość Data
sh123 7e6e0bc43e Move map with own position changes 2023-07-04 21:25:02 +03:00
sh123 968a213bc6 Show aprs destination in map popup 2023-07-04 20:33:26 +03:00
7 zmienionych plików z 33 dodań i 14 usunięć

Wyświetl plik

@ -266,8 +266,8 @@ public class AppWorker extends Thread {
private final ProtocolCallback _protocolCallback = new ProtocolCallback() {
@Override
protected void onReceivePosition(Position position) {
Log.i(TAG, String.format("Position received: %s, %s, lat: %f, lon: %f, course: %f, speed: %f, alt: %f, sym: %s, range: %.2f, status: %s, comment: %s",
position.srcCallsign, position.maidenHead, position.latitude, position.longitude,
Log.i(TAG, String.format("Position received: %s→%s, %s, lat: %f, lon: %f, course: %f, speed: %f, alt: %f, sym: %s, range: %.2f, status: %s, comment: %s",
position.srcCallsign, position.dstCallsign, position.maidenHead, position.latitude, position.longitude,
position.bearingDegrees, position.speedMetersPerSecond, position.altitudeMeters,
position.symbolCode, position.rangeMiles, position.status, position.comment));
_positionItemRepository.upsertPositionItem(position.toPositionItem(false));

Wyświetl plik

@ -13,7 +13,9 @@ import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AppCompatActivity;
import androidx.preference.PreferenceManager;
import com.radio.codec2talkie.BuildConfig;
import com.radio.codec2talkie.R;
import com.radio.codec2talkie.protocol.Aprs;
import com.radio.codec2talkie.protocol.aprs.tools.AprsSymbolTable;
import com.radio.codec2talkie.settings.PreferenceKeys;
@ -30,6 +32,9 @@ import org.osmdroid.views.overlay.mylocation.MyLocationNewOverlay;
public class MapActivity extends AppCompatActivity {
private static final String TAG = MapActivity.class.getSimpleName();
private static final double MAP_STARTUP_ZOOM = 5.0;
private static final double MAP_FOLLOW_ZOOM = 14.0;
private MapView _mapView;
private IMapController _mapController;
private MyLocationNewOverlay _myLocationNewOverlay;
@ -47,7 +52,7 @@ public class MapActivity extends AppCompatActivity {
if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);
Context context = getApplicationContext();
Configuration.getInstance().setUserAgentValue("C2T");
Configuration.getInstance().setUserAgentValue(Aprs.APRS_ID + " " + BuildConfig.VERSION_NAME);
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
// my symbol
@ -61,7 +66,7 @@ public class MapActivity extends AppCompatActivity {
// controller
_mapController = _mapView.getController();
_mapController.zoomTo(5.0);
_mapController.zoomTo(MAP_STARTUP_ZOOM);
// compass
InternalCompassOrientationProvider compassOrientationProvider = new InternalCompassOrientationProvider(context) {
@ -149,7 +154,18 @@ public class MapActivity extends AppCompatActivity {
}
_mapStations.showMovingStations(showMoving);
return true;
} else if (itemId == R.id.map_menu_move_map) {
if (item.isChecked()) {
item.setChecked(false);
_myLocationNewOverlay.disableFollowLocation();
} else {
item.setChecked(true);
_myLocationNewOverlay.enableFollowLocation();
_mapController.zoomTo(MAP_FOLLOW_ZOOM);
}
return true;
}
return super.onOptionsItemSelected(item);
}
}

Wyświetl plik

@ -83,7 +83,8 @@ public class MapStations {
_stationItemLiveData.observe((LifecycleOwner) _owner, allStations -> {
Log.i(TAG, "add stations " + allStations.size());
for (StationItem station : allStations) {
//Log.i(TAG, "new position " + station.getLatitude() + " " + station.getLongitude());
//Log.i(TAG, "new position " + station.getSrcCallsign() + ">" +
// station.getDstCallsign() + " " + station.getLatitude() + " " + station.getLongitude());
// do not add items without coordinate
if (station.getMaidenHead() == null) continue;
if (addStationPositionIcon(station)) {
@ -200,7 +201,8 @@ public class MapStations {
private String getStatus(StationItem station) {
double range = UnitTools.milesToKilometers(station.getRangeMiles());
return String.format(Locale.US, "%s<br>%s %f %f<br>%03d° %03dkm/h %04dm %.2fkm<br>%s %s",
return String.format(Locale.US, "%s %s<br>%s %f %f<br>%03d° %03dkm/h %04dm %.2fkm<br>%s %s",
station.getDstCallsign(),
station.getDigipath(),
station.getMaidenHead(), station.getLatitude(), station.getLongitude(),
(int)station.getBearingDegrees(),

Wyświetl plik

@ -135,12 +135,6 @@ public class AprsIs implements Protocol, Runnable {
}
private boolean isEligibleForTxGate(AprsIsData aprsIsData) {
/* rules:
1. RX gate must be heard on rf within digi hops or range
2. RX gate has not been heard on internet within given period of time or in third party packets
3. sender must not be heard within given period of time on RF
4. sender must not have TCPXX, NOGATE, RFONLY
*/
AprsCallsign aprsCallsign = new AprsCallsign(aprsIsData.src);
return _isTxGateEnabled &&
aprsCallsign.isValid &&
@ -318,7 +312,7 @@ public class AprsIs implements Protocol, Runnable {
}
private String getLoginCommand() {
String cmd = "user " + new AX25Callsign(_callsign, _ssid).toString() + " pass " + _passcode + " vers " + "C2T " + BuildConfig.VERSION_NAME;
String cmd = "user " + new AX25Callsign(_callsign, _ssid).toString() + " pass " + _passcode + " vers " + Aprs.APRS_ID + " " + BuildConfig.VERSION_NAME;
if (_filterRadius > 0) {
cmd += " filter m/" + _filterRadius;
}

Wyświetl plik

@ -116,7 +116,6 @@ public class StationItem {
public void updateFrom(StationItem stationItem) {
setTimestampEpoch(stationItem.getTimestampEpoch());
setDstCallsign(stationItem.getDstCallsign());
// update position if known
if (stationItem.getMaidenHead() != null) {
setMaidenHead(stationItem.getMaidenHead());
@ -139,6 +138,8 @@ public class StationItem {
setLogLine(stationItem.getLogLine());
if (stationItem.getDigipath() != null)
setDigipath(stationItem.getDigipath());
if (stationItem.getDstCallsign() != null)
setDstCallsign(stationItem.getDstCallsign());
}
@Override

Wyświetl plik

@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/map_menu_move_map"
android:title="@string/map_menu_move_map"
android:checkable="true"
android:checked="false"/>
<item
android:id="@+id/map_menu_rotate_map"
android:title="@string/map_menu_rotate_map"

Wyświetl plik

@ -369,4 +369,5 @@
<string name="map_menu_show_moving">Show moving stations</string>
<string name="aprs_text_packets_enable_title">Enable text packets</string>
<string name="aprs_text_packets_enable_summary">Send lora aprs compatible text packets (0x3c,0xff,0x01 prefix)</string>
<string name="map_menu_move_map">Move map with own position</string>
</resources>