legacy
sh123 2022-07-24 17:00:56 +03:00
rodzic 8621df64a1
commit b065ee7d42
4 zmienionych plików z 25 dodań i 20 usunięć

Wyświetl plik

@ -733,6 +733,7 @@ public class MainActivity extends AppCompatActivity implements ServiceConnection
break;
case EV_TEXT_MESSAGE_RECEIVED:
case EV_DATA_RECEIVED:
case EV_POSITION_RECEIVED:
if (msg.obj != null) {
String note = (String)msg.obj;
_textStatus.setText(note.split(":")[0]);

Wyświetl plik

@ -12,21 +12,22 @@ public enum AppMessage {
EV_VOICE_RECEIVED(7),
EV_TEXT_MESSAGE_RECEIVED(8),
EV_DATA_RECEIVED(9),
EV_RX_LEVEL(10),
EV_TX_LEVEL(11),
EV_RX_ERROR(12),
EV_TX_ERROR(13),
EV_RX_RADIO_LEVEL(14),
EV_STARTED_TRACKING(15),
EV_STOPPED_TRACKING(16),
EV_POSITION_RECEIVED(10),
EV_RX_LEVEL(11),
EV_TX_LEVEL(12),
EV_RX_ERROR(13),
EV_TX_ERROR(14),
EV_RX_RADIO_LEVEL(15),
EV_STARTED_TRACKING(16),
EV_STOPPED_TRACKING(17),
// commands
CMD_SEND_LOCATION_TO_TNC(17),
CMD_PROCESS(18),
CMD_QUIT(19),
CMD_START_TRACKING(20),
CMD_STOP_TRACKING(21),
CMD_SEND_SINGLE_TRACKING(22),
CMD_SEND_MESSAGE(23);
CMD_SEND_LOCATION_TO_TNC(18),
CMD_PROCESS(19),
CMD_QUIT(20),
CMD_START_TRACKING(21),
CMD_STOP_TRACKING(22),
CMD_SEND_SINGLE_TRACKING(23),
CMD_SEND_MESSAGE(24);
private final int _value;

Wyświetl plik

@ -239,6 +239,10 @@ public class AppWorker extends Thread {
position.bearingDegrees, position.speedMetersPerSecond, position.altitudeMeters,
position.symbolCode, position.status, position.comment));
_positionItemRepository.insertPositionItem(position.toPositionItem(false));
String note = (position.srcCallsign == null ? "UNK" : position.srcCallsign) + "→" +
(position.dstCallsign == null ? "UNK" : position.dstCallsign);
sendStatusUpdate(AppMessage.EV_POSITION_RECEIVED, note);
}
@Override

Wyświetl plik

@ -139,7 +139,7 @@ public class AprsDataPositionReport implements AprsData {
byte[] tail = new byte[buffer.remaining()];
buffer.get(tail);
String strTail = new String(tail);
Pattern latLonPattern = Pattern.compile("^(\\\\|/)(\\S{4})(\\S{4})(\\S)(.\\S)(\\S)(.*)$");
Pattern latLonPattern = Pattern.compile("^([\\\\/])(\\S{4})(\\S{4})(\\S)(.\\S)(\\S)(.*)$", Pattern.DOTALL);
Matcher latLonMatcher = latLonPattern.matcher(strTail);
if (!latLonMatcher.matches()) return false;
@ -156,9 +156,7 @@ public class AprsDataPositionReport implements AprsData {
_position.latitude = getUncompressedCoordinate(latitude.getBytes(), true);
if (longitude == null) return false;
_position.longitude = getUncompressedCoordinate(longitude.getBytes(), false);
if (comment == null)
_position.comment = "";
else
if (comment != null)
_position.comment = comment;
if (altSpeed == null) return false;
@ -216,7 +214,8 @@ public class AprsDataPositionReport implements AprsData {
"([\\S])" + // symbol table
"([\\d ]{5}[.][\\d ]{2})(E|W)" + // longitude
"(\\S)(.+)?" + // tail (speed/bearing/altitude/comment)
"$");
"$", Pattern.DOTALL);
Matcher latLonMatcher = latLonPattern.matcher(strTail);
if (!latLonMatcher.matches()) return false;
@ -240,7 +239,7 @@ public class AprsDataPositionReport implements AprsData {
if (strTail == null) return true;
// read course/speed
Pattern courseSpeedPattern = Pattern.compile("^(\\d{3})/(\\d{3})(.*)?$");
Pattern courseSpeedPattern = Pattern.compile("^(\\d{3})/(\\d{3})(.*)?$", Pattern.DOTALL);
Matcher courseSpeedMatcher = courseSpeedPattern.matcher(strTail);
if (courseSpeedMatcher.matches()) {
String course = courseSpeedMatcher.group(1);