Skip to content

Commit 0790a78

Browse files
committed
1.0.28
try registering this time
1 parent 8e0c144 commit 0790a78

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

app/src/main/java/com/atakmap/android/meshtastic/MeshtasticMapComponent.java

+23-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import android.content.ServiceConnection;
1515

1616
import android.content.SharedPreferences;
17+
import android.os.Bundle;
1718
import android.os.IBinder;
1819
import android.os.RemoteException;
1920
import android.preference.PreferenceManager;
@@ -30,6 +31,7 @@
3031
import com.atakmap.android.meshtastic.plugin.R;
3132
import com.atakmap.android.util.NotificationUtil;
3233
import com.atakmap.app.preferences.ToolsPreferenceFragment;
34+
import com.atakmap.comms.CotServiceRemote;
3335
import com.atakmap.coremap.filesystem.FileSystemUtils;
3436
import com.atakmap.coremap.log.Log;
3537
import com.atakmap.coremap.cot.event.CotEvent;
@@ -68,11 +70,23 @@
6870

6971
public class MeshtasticMapComponent extends DropDownMapComponent
7072
implements CommsMapComponent.PreSendProcessor,
71-
SharedPreferences.OnSharedPreferenceChangeListener {
73+
SharedPreferences.OnSharedPreferenceChangeListener,
74+
CotServiceRemote.ConnectionListener {
7275
private static final String TAG = "MeshtasticMapComponent";
7376
private Context pluginContext;
7477
public static CotShrinkerFactory cotShrinkerFactory = new CotShrinkerFactory();
7578
public static CotShrinker cotShrinker = cotShrinkerFactory.createCotShrinker();
79+
80+
@Override
81+
public void onCotServiceConnected(Bundle bundle) {
82+
83+
}
84+
85+
@Override
86+
public void onCotServiceDisconnected() {
87+
88+
}
89+
7690
public enum ServiceConnectionState {
7791
DISCONNECTED,
7892
CONNECTED
@@ -687,7 +701,10 @@ public void onCreate(final Context context, Intent intent, MapView view) {
687701
CommsMapComponent.getInstance().registerPreSendProcessor(this);
688702
context.setTheme(R.style.ATAKPluginTheme);
689703
pluginContext = context;
690-
704+
705+
706+
707+
691708
mNotifyManager =
692709
(NotificationManager) view.getContext()
693710
.getSystemService(NOTIFICATION_SERVICE);
@@ -742,6 +759,10 @@ public void onCreate(final Context context, Intent intent, MapView view) {
742759

743760
view.getContext().registerReceiver(mr, intentFilter, Context.RECEIVER_EXPORTED);
744761

762+
CotServiceRemote cotService = new CotServiceRemote();
763+
cotService.setCotEventListener(mr);
764+
cotService.connect(this);
765+
745766
mServiceIntent = new Intent();
746767
mServiceIntent.setClassName(PACKAGE_NAME, CLASS_NAME);
747768

app/src/main/java/com/atakmap/android/meshtastic/MeshtasticReceiver.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,9 @@ public void onCotEvent(CotEvent cotEvent, Bundle bundle) {
997997
if (prefs.getBoolean("plugin_meshtastic_from_server", false)) {
998998
if (cotEvent.isValid()) {
999999

1000+
Log.d(TAG, "onCotEvent");
1001+
Log.d(TAG, cotEvent.toString());
1002+
10001003
int hopLimit = prefs.getInt("plugin_meshtastic_hop_limit", 3);
10011004
if (hopLimit > 8) {
10021005
hopLimit = 8;
@@ -1029,7 +1032,6 @@ public void onCotEvent(CotEvent cotEvent, Bundle bundle) {
10291032

10301033
// All Chat Rooms
10311034
if (cotEvent.getType().startsWith("b-t-f") && cotEvent.getUID().contains("All Chat Rooms")) {
1032-
10331035
try {
10341036
while (eventType != XmlPullParser.END_DOCUMENT) {
10351037
if (eventType == XmlPullParser.START_TAG) {

0 commit comments

Comments
 (0)