Skip to content

Commit

Permalink
1.0.33
Browse files Browse the repository at this point in the history
tweak the logic when sending chunks, don't let the user get into a situation of sending multiple chunked CoTs

in the future need to implement a queue or something
  • Loading branch information
niccellular committed Sep 11, 2024
1 parent 4ccd798 commit 7884300
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 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.32"
ext.PLUGIN_VERSION = "1.0.33"
ext.ATAK_VERSION = "4.10.0"

def takdevVersion = '2.+'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,14 @@ else if (xpp.getAttributeName(i).equalsIgnoreCase("speed"))
if (prefs.getBoolean("plugin_meshtastic_plichat_only", false)) {
Log.d(TAG, "PLI/Chat Only");
return;
} else if (prefs.getBoolean("plugin_meshtastic_chunking", false)) {
Log.d(TAG, "Chunking in progress");
return;
}

editor.putBoolean("plugin_meshtastic_chunking", true);
editor.apply();

new Thread(() -> {
Log.d(TAG, "Sending Chunks");

Expand Down Expand Up @@ -714,7 +721,7 @@ else if (xpp.getAttributeName(i).equalsIgnoreCase("speed"))
mMeshService.send(dp[0]);
while (prefs.getBoolean("plugin_meshtastic_chunk_ACK", false)) {
try {
Thread.sleep(500);
Thread.sleep(250);
if (prefs.getBoolean("plugin_meshtastic_chunk_ERR", false)) {
Log.d(TAG, "Chunk ERR received, retransmitting message ID: " + i[0]);
j = 0;
Expand All @@ -739,6 +746,8 @@ else if (xpp.getAttributeName(i).equalsIgnoreCase("speed"))
e.printStackTrace();
}
}
editor.putBoolean("plugin_meshtastic_chunking", false);
editor.apply();
}).start();
}
}
Expand Down Expand Up @@ -784,6 +793,8 @@ public void onCreate(final Context context, Intent intent, MapView view) {
prefs = PreferenceManager.getDefaultSharedPreferences(MapView.getMapView().getContext());
editor = prefs.edit();
editor.putBoolean("plugin_meshtastic_file_transfer", false);
editor.putBoolean("plugin_meshtastic_chunking", true);
editor.apply();
prefs.registerOnSharedPreferenceChangeListener(this);

mr = new MeshtasticReceiver();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,20 @@ public void onReceive(Context context, Intent intent) {
MessageStatus status = intent.getParcelableExtra(MeshtasticMapComponent.EXTRA_STATUS);
Log.d(TAG, "Message Status ID: " + id + " Status: " + status);
if (prefs.getInt("plugin_meshtastic_switch_id", 0) == id && status == MessageStatus.DELIVERED) {
SharedPreferences.Editor editor = prefs.edit();
editor.putBoolean("plugin_meshtastic_switch_ACK", false);
editor.apply();
Log.d(TAG, "Got ACK from Switch");
} else if (prefs.getInt("plugin_meshtastic_chunk_id", 0) == id && status == MessageStatus.DELIVERED) {
SharedPreferences.Editor editor = prefs.edit();
// clear the ACK/ERR for the chunk
editor.putBoolean("plugin_meshtastic_chunk_ACK", false);
editor.putBoolean("plugin_meshtastic_chunk_ERR", false);
editor.apply();
Log.d(TAG, "Got ACK from Chunk");
Log.d(TAG, "Got DELIVERED from Chunk");
} else if (prefs.getInt("plugin_meshtastic_chunk_id", 0) == id && status == MessageStatus.ERROR) {
Log.d(TAG, "Got ERROR from Chunk");
editor.putBoolean("plugin_meshtastic_chunk_ACK", true);
editor.putBoolean("plugin_meshtastic_chunk_ACK", false);
editor.putBoolean("plugin_meshtastic_chunk_ERR", true);
editor.apply();
Log.d(TAG, "Got ERROR from Chunk");
}
break;
case MeshtasticMapComponent.ACTION_RECEIVED_ATAK_FORWARDER:
Expand Down

0 comments on commit 7884300

Please sign in to comment.