@@ -73,7 +73,7 @@ static synchronized void processData(final RecentData recentData, final boolean
7373 filteredSgList = new ArrayList <>();
7474 for (SensorGlucose sg : recentData .sgs ) {
7575 //SG DateTime is null (sensor expired?)
76- if (sg != null && sg .datetimeAsDate != null ) {
76+ if (sg != null && sg .getDate () != null ) {
7777 filteredSgList .add (sg );
7878 }
7979 }
@@ -84,31 +84,31 @@ static synchronized void processData(final RecentData recentData, final boolean
8484 sensor .save ();
8585
8686 // place in order of oldest first
87- Collections .sort (filteredSgList , (o1 , o2 ) -> o1 .datetimeAsDate .compareTo (o2 .datetimeAsDate ));
87+ Collections .sort (filteredSgList , (o1 , o2 ) -> o1 .getDate () .compareTo (o2 .getDate () ));
8888
8989 for (final SensorGlucose sg : filteredSgList ) {
9090
9191 //Not EPOCH 0 (warmup?)
92- if (sg .datetimeAsDate .getTime () > 1 ) {
92+ if (sg .getDate () .getTime () > 1 ) {
9393
9494 //Not in the future
95- if (sg .datetimeAsDate .getTime () < new Date ().getTime () + 300_000 ) {
95+ if (sg .getDate () .getTime () < new Date ().getTime () + 300_000 ) {
9696
9797 //Not 0 SG (not calibrated?)
9898 if (sg .sg > 0 ) {
9999
100100 //newer than last BG
101- if (sg .datetimeAsDate .getTime () > lastBgTimestamp ) {
101+ if (sg .getDate () .getTime () > lastBgTimestamp ) {
102102
103- if (sg .datetimeAsDate .getTime () > 0 ) {
103+ if (sg .getDate () .getTime () > 0 ) {
104104
105105 //New entry
106- if (BgReading .getForPreciseTimestamp (sg .datetimeAsDate .getTime (), 10_000 ) == null ) {
106+ if (BgReading .getForPreciseTimestamp (sg .getDate () .getTime (), 10_000 ) == null ) {
107107 UserError .Log .d (TAG , "NEW NEW NEW New entry: " + sg .toS ());
108108
109109 if (live ) {
110110 final BgReading bg = new BgReading ();
111- bg .timestamp = sg .datetimeAsDate .getTime ();
111+ bg .timestamp = sg .getDate () .getTime ();
112112 bg .calculated_value = (double ) sg .sg ;
113113 bg .raw_data = SPECIAL_FOLLOWER_PLACEHOLDER ;
114114 bg .filtered_data = (double ) sg .sg ;
@@ -149,25 +149,25 @@ static synchronized void processData(final RecentData recentData, final boolean
149149 //Filter markers
150150 filteredMarkerList = new ArrayList <>();
151151 for (Marker marker : recentData .markers ) {
152- if (marker != null && marker .type != null && marker .dateTime != null ) {
152+ if (marker != null && marker .type != null && marker .getDate () != null ) {
153153 filteredMarkerList .add (marker );
154154 }
155155 }
156156
157157 if (filteredMarkerList .size () > 0 ) {
158158 //sort markers by time
159- Collections .sort (filteredMarkerList , (o1 , o2 ) -> o1 .dateTime .compareTo (o2 .dateTime ));
159+ Collections .sort (filteredMarkerList , (o1 , o2 ) -> o1 .getDate () .compareTo (o2 .getDate () ));
160160
161161 //process markers one-by-one
162162 for (Marker marker : filteredMarkerList ) {
163163
164164 //FINGER BG
165165 if (marker .isBloodGlucose () && Pref .getBooleanDefaultFalse ("clfollow_download_finger_bgs" )) {
166166 //check required values
167- if (marker .value != null && !marker .value .equals (0 )) {
167+ if (marker .getBloodGlucose () != null && !marker .getBloodGlucose () .equals (0 )) {
168168 //new blood test
169- if (BloodTest .getForPreciseTimestamp (marker .dateTime .getTime (), 10000 ) == null ) {
170- BloodTest .create (marker .dateTime .getTime (), marker .value , SOURCE_CARELINK_FOLLOW );
169+ if (BloodTest .getForPreciseTimestamp (marker .getDate () .getTime (), 10000 ) == null ) {
170+ BloodTest .create (marker .getDate () .getTime (), marker .getBloodGlucose () , SOURCE_CARELINK_FOLLOW );
171171 }
172172 }
173173
@@ -186,24 +186,24 @@ static synchronized void processData(final RecentData recentData, final boolean
186186 //Insulin
187187 if (marker .type .equals (Marker .MARKER_TYPE_INSULIN )) {
188188 carbs = 0 ;
189- if (marker .deliveredExtendedAmount != null && marker . deliveredFastAmount != null ) {
190- insulin = marker .deliveredExtendedAmount + marker . deliveredFastAmount ;
189+ if (marker .getInsulinAmount () != null ) {
190+ insulin = marker .getInsulinAmount () ;
191191 }
192192 //SKIP if insulin = 0
193193 if (insulin == 0 ) continue ;
194194 //Carbs
195195 } else if (marker .type .equals (Marker .MARKER_TYPE_MEAL )) {
196- if (marker .amount != null ) {
197- carbs = marker .amount ;
196+ if (marker .getCarbAmount () != null ) {
197+ carbs = marker .getCarbAmount () ;
198198 }
199199 insulin = 0 ;
200200 //SKIP if carbs = 0
201201 if (carbs == 0 ) continue ;
202202 }
203203
204204 //new Treatment
205- if (newTreatment (carbs , insulin , marker .dateTime .getTime ())) {
206- t = Treatments .create (carbs , insulin , marker .dateTime .getTime ());
205+ if (newTreatment (carbs , insulin , marker .getDate () .getTime ())) {
206+ t = Treatments .create (carbs , insulin , marker .getDate () .getTime ());
207207 if (t != null ) {
208208 t .enteredBy = SOURCE_CARELINK_FOLLOW ;
209209 t .save ();
@@ -222,7 +222,7 @@ static synchronized void processData(final RecentData recentData, final boolean
222222 //PUMP INFO (Pump Status)
223223 if (recentData .isNGP ()) {
224224 PumpStatus .setReservoir (recentData .reservoirRemainingUnits );
225- PumpStatus .setBattery (recentData .medicalDeviceBatteryLevelPercent );
225+ PumpStatus .setBattery (recentData .getDeviceBatteryLevel () );
226226 if (recentData .activeInsulin != null )
227227 PumpStatus .setBolusIoB (recentData .activeInsulin .amount );
228228 PumpStatus .syncUpdate ();
@@ -246,13 +246,13 @@ static synchronized void processData(final RecentData recentData, final boolean
246246 //Active Notifications
247247 if (recentData .notificationHistory .activeNotifications != null ) {
248248 for (ActiveNotification activeNotification : recentData .notificationHistory .activeNotifications ) {
249- addNotification (activeNotification .dateTime , recentData .getDeviceFamily (), activeNotification .messageId , activeNotification .faultId );
249+ addNotification (activeNotification .dateTime , recentData .getDeviceFamily (), activeNotification .getMessageId () , activeNotification .faultId );
250250 }
251251 }
252252 //Cleared Notifications
253253 if (recentData .notificationHistory .clearedNotifications != null ) {
254254 for (ClearedNotification clearedNotification : recentData .notificationHistory .clearedNotifications ) {
255- addNotification (clearedNotification .triggeredDateTime , recentData .getDeviceFamily (), clearedNotification .messageId , clearedNotification .faultId );
255+ addNotification (clearedNotification .triggeredDateTime , recentData .getDeviceFamily (), clearedNotification .getMessageId () , clearedNotification .faultId );
256256 }
257257 }
258258 }
0 commit comments