Skip to content

Commit

Permalink
Use LastAlarm as alternative source for timezone identification
Browse files Browse the repository at this point in the history
  • Loading branch information
benceszasz committed May 26, 2023
1 parent 0497244 commit ca91200
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ static synchronized void processData(final RecentData recentData, final boolean
// Only Guardian Connect, NGP has all in notifications
if (recentData.isGM() && recentData.lastAlarm != null) {
//Add notification from alarm
if (recentData.lastAlarm.datetime != null && recentData.lastAlarm.kind != null)
addNotification(recentData.lastAlarm.datetime, recentData.getDeviceFamily(), recentData.lastAlarm);
if (recentData.lastAlarm.datetimeAsDate != null && recentData.lastAlarm.kind != null)
addNotification(recentData.lastAlarm.datetimeAsDate, recentData.getDeviceFamily(), recentData.lastAlarm);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -645,9 +645,15 @@ protected void correctTimeInRecentData(RecentData recentData) {

timezoneMissing = true;

//offset = this.getZonedDate(recentData.lastSG.datetime).getOffset();
offsetString = this.getZoneOffset(recentData.lastSG.datetime);

//Try get TZ offset string: lastSG or lastAlarm
if(recentData.lastSG != null && recentData.lastSG.datetime != null)
offsetString = this.getZoneOffset(recentData.lastSG.datetime);
else
offsetString = this.getZoneOffset(recentData.lastAlarm.datetime);

//Set last alarm datetimeAsDate
if(recentData.lastAlarm != null && recentData.lastAlarm.datetime != null)
recentData.lastAlarm.datetimeAsDate = parseDateString(recentData.lastAlarm.datetime);
//Build correct dates with timezone
recentData.sMedicalDeviceTime = recentData.sMedicalDeviceTime + offsetString;
recentData.medicalDeviceTimeAsString = recentData.medicalDeviceTimeAsString + offsetString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ public String getMessageAlarmCode() {
}

public int code;
public Date datetime;
public String datetime;
public Date datetimeAsDate;
public String type;
public boolean flash;
public String kind;
Expand Down

0 comments on commit ca91200

Please sign in to comment.