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.
|
// start timer to refresh user interface every second.
|
||||||
Timer uiTimer = new Timer();
|
Timer uiTimer = new Timer();
|
||||||
uiTimer.schedule(new TimerTask() {
|
uiTimer.schedule(new TimerTask() {
|
||||||
@@ -402,6 +414,26 @@ public class MainActivity extends Activity {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.v(TAG, "ServerStatusRunnable: Exception - " + e.toString());
|
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
|
// Produce graph
|
||||||
LineChart mChart = (LineChart) findViewById(R.id.chart1);
|
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 String mSdDataSourceName = "undefined"; // The name of the data soruce specified in the preferences.
|
||||||
private boolean mLatchAlarms = false;
|
private boolean mLatchAlarms = false;
|
||||||
private boolean mCancelAudible = false;
|
private boolean mCancelAudible = false;
|
||||||
private boolean mAudibleAlarm = false;
|
public boolean mAudibleAlarm = false;
|
||||||
private boolean mAudibleWarning = false;
|
private boolean mAudibleWarning = false;
|
||||||
private boolean mAudibleFaultWarning = false;
|
private boolean mAudibleFaultWarning = false;
|
||||||
private boolean mSMSAlarm = false;
|
private boolean mSMSAlarm = false;
|
||||||
@@ -232,6 +232,15 @@ public class SdServer extends Service implements SdDataReceiver {
|
|||||||
|
|
||||||
mSdDataSource.stop();
|
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 {
|
try {
|
||||||
// Cancel the notification.
|
// Cancel the notification.
|
||||||
Log.v(TAG, "onDestroy(): cancelling notification");
|
Log.v(TAG, "onDestroy(): cancelling notification");
|
||||||
|
|||||||
@@ -113,11 +113,20 @@
|
|||||||
android:id="@+id/spectrumProgressBar"
|
android:id="@+id/spectrumProgressBar"
|
||||||
android:indeterminate="false" />
|
android:indeterminate="false" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
<Button
|
<Button
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:text="Accept Alarm"
|
android:text="Accept Alarm"
|
||||||
android:id="@+id/acceptAlarmButton" />
|
android:id="@+id/acceptAlarmButton" />
|
||||||
|
<Button
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Cancel Audible (temporarily)"
|
||||||
|
android:id="@+id/cancelAudibleButton" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<com.github.mikephil.charting.charts.LineChart
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
android:id="@+id/chart1"
|
android:id="@+id/chart1"
|
||||||
|
|||||||
Reference in New Issue
Block a user