Added cancel audible button (was only present on client app, not server)
This commit is contained in:
@@ -127,6 +127,18 @@ public class MainActivity extends Activity {
|
||||
}
|
||||
});
|
||||
|
||||
// Deal with the 'Cancel Audible Button'
|
||||
button = (Button) findViewById(R.id.cancelAudibleButton);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View v) {
|
||||
Log.v(TAG, "cancelAudibleButton.onClick()");
|
||||
if (mConnection.mBound) {
|
||||
mConnection.mSdServer.cancelAudible();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
// start timer to refresh user interface every second.
|
||||
Timer uiTimer = new Timer();
|
||||
uiTimer.schedule(new TimerTask() {
|
||||
@@ -402,6 +414,26 @@ public class MainActivity extends Activity {
|
||||
} catch (Exception e) {
|
||||
Log.v(TAG, "ServerStatusRunnable: Exception - " + e.toString());
|
||||
}
|
||||
|
||||
|
||||
// Deal with Cancel Audible button
|
||||
Button cancelAudibleButton =
|
||||
(Button) findViewById(R.id.cancelAudibleButton);
|
||||
if (mConnection.mSdServer.isAudibleCancelled()) {
|
||||
cancelAudibleButton.setText("Audible Alarms Cancelled "
|
||||
+ "for "
|
||||
+ mConnection.mSdServer.
|
||||
cancelAudibleTimeRemaining()
|
||||
+ " sec."
|
||||
+ " Press to re-enable");
|
||||
} else {
|
||||
if (mConnection.mSdServer.mAudibleAlarm) {
|
||||
cancelAudibleButton.setText("Cancel Audible Alarms (temporarily)");
|
||||
} else {
|
||||
cancelAudibleButton.setText("Audible Alarms OFF");
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
// Produce graph
|
||||
LineChart mChart = (LineChart) findViewById(R.id.chart1);
|
||||
|
||||
@@ -91,7 +91,7 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
private String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
|
||||
private boolean mLatchAlarms = false;
|
||||
private boolean mCancelAudible = false;
|
||||
private boolean mAudibleAlarm = false;
|
||||
public boolean mAudibleAlarm = false;
|
||||
private boolean mAudibleWarning = false;
|
||||
private boolean mAudibleFaultWarning = false;
|
||||
private boolean mSMSAlarm = false;
|
||||
@@ -232,6 +232,15 @@ public class SdServer extends Service implements SdDataReceiver {
|
||||
|
||||
mSdDataSource.stop();
|
||||
|
||||
// Stop the data update timer
|
||||
if (mCancelAudibleTimer !=null) {
|
||||
Log.v(TAG,"stop(): cancelling Cancel_Audible timer");
|
||||
mCancelAudibleTimer.cancel();
|
||||
//mCancelAudibleTimer.purge();
|
||||
mCancelAudibleTimer = null;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
// Cancel the notification.
|
||||
Log.v(TAG, "onDestroy(): cancelling notification");
|
||||
|
||||
Reference in New Issue
Block a user