retrieve device status with xdrip too
This commit is contained in:
parent
af31ca804f
commit
744a4143f4
1 changed files with 17 additions and 19 deletions
|
@ -199,32 +199,30 @@ public class DataService extends IntentService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (intent.getAction().equals(Intents.ACTION_NEW_DEVICESTATUS)) {
|
if (intent.getAction().equals(Intents.ACTION_NEW_DEVICESTATUS)) {
|
||||||
if (nsClientEnabled) {
|
try {
|
||||||
try {
|
if (bundles.containsKey("devicestatus")) {
|
||||||
if (bundles.containsKey("devicestatus")) {
|
String devicestatusesstring = bundles.getString("devicestatus");
|
||||||
String devicestatusesstring = bundles.getString("devicestatus");
|
JSONObject devicestatusJson = new JSONObject(bundles.getString("devicestatus"));
|
||||||
JSONObject devicestatusJson = new JSONObject(bundles.getString("devicestatus"));
|
if (devicestatusJson.has("pump")) {
|
||||||
|
// Objectives 0
|
||||||
|
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
|
||||||
|
ObjectivesPlugin.saveProgress();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (bundles.containsKey("devicestatuses")) {
|
||||||
|
String devicestatusesstring = bundles.getString("devicestatuses");
|
||||||
|
JSONArray jsonArray = new JSONArray(devicestatusesstring);
|
||||||
|
if (jsonArray.length() > 0) {
|
||||||
|
JSONObject devicestatusJson = jsonArray.getJSONObject(0);
|
||||||
if (devicestatusJson.has("pump")) {
|
if (devicestatusJson.has("pump")) {
|
||||||
// Objectives 0
|
// Objectives 0
|
||||||
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
|
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
|
||||||
ObjectivesPlugin.saveProgress();
|
ObjectivesPlugin.saveProgress();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (bundles.containsKey("devicestatuses")) {
|
|
||||||
String devicestatusesstring = bundles.getString("devicestatuses");
|
|
||||||
JSONArray jsonArray = new JSONArray(devicestatusesstring);
|
|
||||||
if (jsonArray.length() > 0) {
|
|
||||||
JSONObject devicestatusJson = jsonArray.getJSONObject(0);
|
|
||||||
if (devicestatusJson.has("pump")) {
|
|
||||||
// Objectives 0
|
|
||||||
ObjectivesPlugin.pumpStatusIsAvailableInNS = true;
|
|
||||||
ObjectivesPlugin.saveProgress();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Handle profile
|
// Handle profile
|
||||||
|
|
Loading…
Reference in a new issue