Skip to content

Commit

Permalink
1.0.16
Browse files Browse the repository at this point in the history
No one in the discord knows regex anymore than I do.
  • Loading branch information
niccellular committed May 3, 2024
1 parent fecb2d6 commit 7bab2fd
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 36 deletions.
2 changes: 1 addition & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
buildscript {


ext.PLUGIN_VERSION = "1.0.15"
ext.PLUGIN_VERSION = "1.0.16"
ext.ATAK_VERSION = "4.10.0"

def takdevVersion = '2.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public void onReceive(Context context, Intent intent) {
cotDetail.addChild(linkDetail);

CotDetail serverDestinationDetail = new CotDetail("__serverdestination");
serverDestinationDetail.setAttribute("destination", "*:-1:tcp");
serverDestinationDetail.setAttribute("destination", "0.0.0.0:4242:tcp");
cotDetail.addChild(serverDestinationDetail);

CotDetail remarksDetail = new CotDetail("remarks");
Expand Down Expand Up @@ -223,7 +223,7 @@ public void onReceive(Context context, Intent intent) {
cotDetail.addChild(linkDetail);

CotDetail serverDestinationDetail = new CotDetail("__serverdestination");
serverDestinationDetail.setAttribute("destination", "*:-1:tcp");
serverDestinationDetail.setAttribute("destination", "0.0.0.0:4242:tcp");
cotDetail.addChild(serverDestinationDetail);

CotDetail remarksDetail = new CotDetail("remarks");
Expand Down Expand Up @@ -258,7 +258,11 @@ public void onReceive(Context context, Intent intent) {
CotDetail groupDetail = new CotDetail("__group");
String[] teamColor = {"Unknown", " -0"};
try {
teamColor = nodeName.split("((?= -[0-9]+$))");
teamColor = nodeName.split("((?= -[0-9]*$))");
Log.d(TAG, String.valueOf(teamColor.length));
for (int i=0; i<teamColor.length; i++) {
Log.d(TAG, "teamColor[" + i + "]: " + teamColor[i]);
}
if (teamColor.length < 2) {
teamColor = new String[]{nodeName, " -10"};
}
Expand Down Expand Up @@ -336,16 +340,18 @@ public void onReceive(Context context, Intent intent) {
cotDetail.addChild(remarksDetail);
CotDetail contactDetail = new CotDetail("contact");
contactDetail.setAttribute("callsign", teamColor[0]);
contactDetail.setAttribute("endpoint", ni.getUser().getId() + ":72:meshtastic");
contactDetail.setAttribute("endpoint", "0.0.0.0:4242:tcp");
cotDetail.addChild(contactDetail);

if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
} else
Log.e(TAG, "cotEvent was not valid");
new Thread(() -> {
if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
} else
Log.e(TAG, "cotEvent was not valid");
}).start();
}
break;
}
Expand Down Expand Up @@ -466,7 +472,7 @@ protected void receive(Intent intent) {

CotDetail contactDetail = new CotDetail("contact");
contactDetail.setAttribute("callsign", callsign);
contactDetail.setAttribute("endpoint", "*:-1:tcp");
contactDetail.setAttribute("endpoint", "0.0.0.0:4242:tcp");
cotDetail.addChild(contactDetail);

CotDetail groupDetail = new CotDetail("__group");
Expand Down Expand Up @@ -519,14 +525,15 @@ else if (team.equals("DarkGreen"))
CotPoint.UNKNOWN, CotPoint.UNKNOWN);
cotEvent.setPoint(cotPoint);

if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
}
else
Log.e(TAG, "cotEvent was not valid");
new Thread(() -> {
if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
} else
Log.e(TAG, "cotEvent was not valid");
}).start();


/*
Expand Down Expand Up @@ -579,7 +586,7 @@ else if (team.equals("DarkGreen"))
cotDetail.addChild(linkDetail);

CotDetail serverDestinationDetail = new CotDetail("__serverdestination");
serverDestinationDetail.setAttribute("destination", "*:-1:tcp");
serverDestinationDetail.setAttribute("destination", "0.0.0.0:4242:tcp");
cotDetail.addChild(serverDestinationDetail);

CotDetail remarksDetail = new CotDetail("remarks");
Expand All @@ -602,14 +609,15 @@ else if (team.equals("DarkGreen"))
CotPoint.UNKNOWN, CotPoint.UNKNOWN);
cotEvent.setPoint(cotPoint);

if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
}
else
Log.e(TAG, "cotEvent was not valid");
new Thread(() -> {
if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
if (prefs.getBoolean("plugin_meshtastic_server", false)) {
CotMapComponent.getExternalDispatcher().dispatch(cotEvent);
}
} else
Log.e(TAG, "cotEvent was not valid");
}).start();

} else if (tp.hasChat() && tp.getChat().getTo().equals(MapView.getMapView().getSelfMarker().getUID())) {
/*
Expand Down Expand Up @@ -663,7 +671,7 @@ else if (team.equals("DarkGreen"))
cotDetail.addChild(linkDetail);

CotDetail serverDestinationDetail = new CotDetail("__serverdestination");
serverDestinationDetail.setAttribute("destination", "*:-1:tcp");
serverDestinationDetail.setAttribute("destination", "0.0.0.0:4242:tcp");
cotDetail.addChild(serverDestinationDetail);

CotDetail remarksDetail = new CotDetail("remarks");
Expand All @@ -686,11 +694,12 @@ else if (team.equals("DarkGreen"))
CotPoint.UNKNOWN, CotPoint.UNKNOWN);
cotEvent.setPoint(cotPoint);

if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
}
else
Log.e(TAG, "cotEvent was not valid");
new Thread(() -> {
if (cotEvent.isValid()) {
CotMapComponent.getInternalDispatcher().dispatch(cotEvent);
} else
Log.e(TAG, "cotEvent was not valid");
}).start();
}

} catch (InvalidProtocolBufferException e) {
Expand Down

0 comments on commit 7bab2fd

Please sign in to comment.