Skip to content

Commit 8c4f925

Browse files
committed
- method included to clear an SosSensor of any assignments made by a server
1 parent eef2fc9 commit 8c4f925

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

Example/app/src/main/java/org/sofwerx/swe/example/MainActivity.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,7 @@ protected void onCreate(Bundle savedInstanceState) {
126126
sendButton.setOnClickListener(v -> sendData());
127127
eraseAssignedButton.setOnClickListener(v -> {
128128
if (sosSensor != null) {
129-
sosSensor = null;
130-
if (sosService != null) {
131-
sosService.shutdown();
132-
sosService = null;
133-
}
129+
sosSensor.clearAssignments();
134130
log("Sensor assignments from server removed");
135131
updateVisibility();
136132
}

SweLib/src/main/java/org/sofwerx/ogc/sos/SosSensor.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ public void addMeasurement(SensorMeasurement measurement) {
5858
measurements.add(measurement);
5959
}
6060

61+
/**
62+
* Removes any assignments (Assigned Offering, Assigned Procedure, Assigned Template) that
63+
* may have been made by an SOS Server. This is primarily used when switching to a new
64+
* server.
65+
*/
66+
public void clearAssignments() {
67+
assignedOffering = null;
68+
assignedProcedure = null;
69+
assignedTemplate = null;
70+
}
71+
6172
/**
6273
* Gets the assigned procedure ID provided by the SOS
6374
* (i.e. "http://www.sofwerx.org/torgi/wiskey35")

0 commit comments

Comments
 (0)