From edfd6162a2e66c41f408b3ca9bc88b404ee1c712 Mon Sep 17 00:00:00 2001 From: Nathaniel Wesley Filardo Date: Tue, 19 Feb 2019 00:57:59 +0000 Subject: [PATCH] Slightly richer Logging --- .../ctfwstimer/CtFwSCallbacksMQTT.java | 1 + .../com/acmetensortoys/ctfwstimer/MainActivity.java | 13 ++++++++----- .../com/acmetensortoys/ctfwstimer/MainService.java | 2 ++ .../ctfwstimer/MainServiceNotification.java | 3 +++ 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSCallbacksMQTT.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSCallbacksMQTT.java index cb0a458..69d7e1a 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSCallbacksMQTT.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/CtFwSCallbacksMQTT.java @@ -72,6 +72,7 @@ class CtFwSCallbacksMQTT { @Override public void messageArrived(String topic, MqttMessage message) throws Exception { String str = message.toString(); + Log.d("CtFwS", "Message(Reset): " + str); long before; try { before = Long.parseLong(message.toString()); diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java index ae0e198..797766c 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainActivity.java @@ -20,6 +20,9 @@ import android.view.View; import android.widget.TextView; public class MainActivity extends AppCompatActivity { + + private static final String TAG = "CtFwS"; + private final MainActivityBuildHooks mabh = new MainActivityBuildHooksImpl(); private MainService.LocalBinder mSrvBinder; // set once connection completed @@ -119,7 +122,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onStart() { - Log.d("CtFwS", "onStart"); + Log.d(TAG, "onStart"); super.onStart(); if (mSrvBinder == null) { @@ -130,7 +133,7 @@ public class MainActivity extends AppCompatActivity { @Override public void onResume() { - Log.d("CtFwS", "onResume"); + Log.d(TAG, "onResume"); super.onResume(); if (mSrvBinder != null) { @@ -155,7 +158,7 @@ public class MainActivity extends AppCompatActivity { @Override protected void onPause() { - Log.d("CtFwS", "onPause"); + Log.d(TAG, "onPause"); if (mSrvBinder != null) { mSrvBinder.getGameState().unregisterObserver(mCdl); mSrvBinder.unregisterObserver(mSrvObs); @@ -166,13 +169,13 @@ public class MainActivity extends AppCompatActivity { @Override protected void onStop() { - Log.d("CtFwS", "onStop"); + Log.d(TAG, "onStop"); super.onStop(); } @Override protected void onDestroy() { - Log.d("CtFwS", "onDestroy"); + Log.d(TAG, "onDestroy"); unbindService(ctfwssc); super.onDestroy(); diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java index 1c4a422..073e4f5 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainService.java @@ -246,6 +246,8 @@ public class MainService extends Service { mCgs.deconfigure(); } + Log.d("Service", "domqtt finish disconn"); + notifyServerChanged(server); // If disconnecting is all we were told to do, we're done. diff --git a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java index 073303f..aaef01a 100644 --- a/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java +++ b/mobile/src/main/java/com/acmetensortoys/ctfwstimer/MainServiceNotification.java @@ -15,6 +15,7 @@ import android.os.Build; import android.os.IBinder; import android.preference.PreferenceManager; import android.support.v4.app.NotificationCompat; +import android.util.Log; import com.acmetensortoys.ctfwstimer.lib.CtFwSGameStateManager; @@ -150,8 +151,10 @@ class MainServiceNotification { // and if it's in (or after) the current game. // Always update the length in case this is a reset to zero. int s = msgs.size(); + Log.d("CtFwSNotify", "on msg s=" + s + " lastix=" + lastMsgIx); if (s > lastMsgIx) { CtFwSGameStateManager.Msg m = msgs.get(s-1); + Log.d("CtFwsNotify", "msg gst=" + game.getStartT() + " when=" + m.when); if (game.isConfigured() && m.when >= game.getStartT()) { notifyUserSomehow(NotificationSource.MESG); lastContextTextSource = LastContentTextSource.MESG; -- 2.50.1