ALARM logging
This commit is contained in:
parent
e462ae9c55
commit
b8a41e5f5b
3 changed files with 12 additions and 4 deletions
|
@ -39,6 +39,7 @@ public class Config {
|
||||||
public static final boolean logBgSource = true;
|
public static final boolean logBgSource = true;
|
||||||
public static final boolean logOverview = true;
|
public static final boolean logOverview = true;
|
||||||
public static final boolean logNotification = true;
|
public static final boolean logNotification = true;
|
||||||
|
public static final boolean logAlarm = false;
|
||||||
|
|
||||||
// DanaR specific
|
// DanaR specific
|
||||||
public static final boolean logDanaBTComm = true;
|
public static final boolean logDanaBTComm = true;
|
||||||
|
|
|
@ -75,4 +75,5 @@ public class Constants {
|
||||||
public static final String BGSOURCE = "BGSOURCE";
|
public static final String BGSOURCE = "BGSOURCE";
|
||||||
public static final String OVERVIEW = "OVERVIEW";
|
public static final String OVERVIEW = "OVERVIEW";
|
||||||
public static final String NOTIFICATION = "NOTIFICATION";
|
public static final String NOTIFICATION = "NOTIFICATION";
|
||||||
|
public static final String ALARM = "ALARM";
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,11 +13,13 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.Config;
|
||||||
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
|
||||||
public class AlarmSoundService extends Service {
|
public class AlarmSoundService extends Service {
|
||||||
private static Logger log = LoggerFactory.getLogger(AlarmSoundService.class);
|
private static Logger log = LoggerFactory.getLogger(Constants.ALARM);
|
||||||
|
|
||||||
MediaPlayer player;
|
MediaPlayer player;
|
||||||
int resourceId = R.raw.error;
|
int resourceId = R.raw.error;
|
||||||
|
@ -34,12 +36,14 @@ public class AlarmSoundService extends Service {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate() {
|
public void onCreate() {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
|
if (Config.logAlarm)
|
||||||
log.debug("onCreate");
|
log.debug("onCreate");
|
||||||
}
|
}
|
||||||
|
|
||||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||||
if (player != null && player.isPlaying())
|
if (player != null && player.isPlaying())
|
||||||
player.stop();
|
player.stop();
|
||||||
|
if (Config.logAlarm)
|
||||||
log.debug("onStartCommand");
|
log.debug("onStartCommand");
|
||||||
if (intent != null && intent.hasExtra("soundid"))
|
if (intent != null && intent.hasExtra("soundid"))
|
||||||
resourceId = intent.getIntExtra("soundid", R.raw.error);
|
resourceId = intent.getIntExtra("soundid", R.raw.error);
|
||||||
|
@ -74,5 +78,7 @@ public class AlarmSoundService extends Service {
|
||||||
public void onDestroy() {
|
public void onDestroy() {
|
||||||
player.stop();
|
player.stop();
|
||||||
player.release();
|
player.release();
|
||||||
|
if (Config.logAlarm)
|
||||||
|
log.debug("onDestroy");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue