react-native-mytatva-rn-sdk 1.2.50 → 1.2.52

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/android/src/main/java/cgmblelib/base/BApplication.java +57 -57
  2. package/android/src/main/java/cgmblelib/ble/BleService.java +1 -1
  3. package/android/src/main/java/cgmblelib/ble/gattcallback/BleGattCallback.java +1 -1
  4. package/android/src/main/java/cgmblelib/database/dao/DaoDevice.java +4 -0
  5. package/android/src/main/java/cgmblelib/database/dao/DaoGlucose.java +334 -332
  6. package/android/src/main/java/cgmblelib/database/repository/RepositoryDevice.java +5 -0
  7. package/android/src/main/java/cgmblelib/database/repository/RepositoryGlucose.java +167 -162
  8. package/android/src/main/java/cgmblelib/database/source/SourceDevice.java +2 -0
  9. package/android/src/main/java/cgmblelib/database/source/SourceGlucose.java +2 -0
  10. package/android/src/main/java/cgmblelib/database/source/db/DeviceDBDataSource.java +171 -165
  11. package/android/src/main/java/cgmblelib/database/source/db/GlucoseDBDataSource.java +305 -296
  12. package/android/src/main/java/cgmblelib/utils/SharedPreferencesLibraryUtil.java +66 -44
  13. package/android/src/main/java/com/mytatvarnsdk/CgmTrackyLibModule.kt +13 -9
  14. package/android/src/main/java/com/mytatvarnsdk/MainApplication.kt +2 -2
  15. package/android/src/main/java/com/mytatvarnsdk/activity/PermissionActivity.kt +10 -4
  16. package/android/src/main/java/com/mytatvarnsdk/activity/StartCGMActivity.kt +5 -1
  17. package/android/src/main/java/com/mytatvarnsdk/model/BaseViewModel.java +88 -84
  18. package/ios/Database/KLTBluetoothManager.m +4 -0
  19. package/ios/Database/KLTDatabaseHandler.m +77 -7
  20. package/ios/ViewModel/FinalViewModel.swift +6 -1
  21. package/lib/commonjs/CGMConnect.js +2 -2
  22. package/lib/commonjs/CGMConnect.js.map +1 -1
  23. package/lib/module/CGMConnect.js +3 -3
  24. package/lib/module/CGMConnect.js.map +1 -1
  25. package/lib/typescript/CGMConnect.d.ts +2 -2
  26. package/package.json +1 -1
  27. package/src/CGMConnect.ts +63 -54
@@ -20,304 +20,313 @@ import cgmblelib.utils.AppExecutors;
20
20
  */
21
21
 
22
22
  public class GlucoseDBDataSource extends DBDataSource implements SourceGlucose {
23
- /**
24
- * 单例
25
- */
26
- private static volatile GlucoseDBDataSource INSTANCE;
27
- /**
28
- * dao
29
- */
30
- private DaoGlucose mDaoGlucose;
31
- /**
32
- * 线程池
33
- */
34
- private AppExecutors mAppExecutors;
35
-
36
-
37
- private GlucoseDBDataSource(@NonNull AppExecutors appExecutors,
38
- @NonNull DaoGlucose daoGlucose) {
39
- mAppExecutors = appExecutors;
40
- mDaoGlucose = daoGlucose;
41
- }
42
-
43
- public static GlucoseDBDataSource getInstance(@NonNull AppExecutors appExecutors, @NonNull DaoGlucose daoGlucose) {
44
- if (INSTANCE == null) {
45
- synchronized (GlucoseDBDataSource.class) {
23
+ /**
24
+ * 单例
25
+ */
26
+ private static volatile GlucoseDBDataSource INSTANCE;
27
+ /**
28
+ * dao
29
+ */
30
+ private DaoGlucose mDaoGlucose;
31
+ /**
32
+ * 线程池
33
+ */
34
+ private AppExecutors mAppExecutors;
35
+
36
+
37
+ private GlucoseDBDataSource(@NonNull AppExecutors appExecutors,
38
+ @NonNull DaoGlucose daoGlucose) {
39
+ mAppExecutors = appExecutors;
40
+ mDaoGlucose = daoGlucose;
41
+ }
42
+
43
+ public static GlucoseDBDataSource getInstance(@NonNull AppExecutors appExecutors, @NonNull DaoGlucose daoGlucose) {
46
44
  if (INSTANCE == null) {
47
- INSTANCE = new GlucoseDBDataSource(appExecutors, daoGlucose);
45
+ synchronized (GlucoseDBDataSource.class) {
46
+ if (INSTANCE == null) {
47
+ INSTANCE = new GlucoseDBDataSource(appExecutors, daoGlucose);
48
+ }
49
+ }
50
+ }
51
+ return INSTANCE;
52
+ }
53
+
54
+ @Override
55
+ public void delete(long deviceId, int glucoseId) {
56
+ mDaoGlucose.removeAll(deviceId, glucoseId);
57
+ }
58
+
59
+ @Override
60
+ public long insertGlucoseIoThread(PocGlucose glucose) {
61
+ try {
62
+ CheckIoThread();
63
+ return mDaoGlucose.insert(glucose);
64
+ } catch (Exception e) {
65
+ e.printStackTrace();
66
+ }
67
+ return -1;
68
+ }
69
+
70
+ @Override
71
+ public long[] insertGlucosesIoThread(@NonNull PocGlucose... glucose) {
72
+ try {
73
+ CheckIoThread();
74
+ return mDaoGlucose.insertAll(glucose);
75
+ } catch (Exception e) {
76
+ e.printStackTrace();
77
+ }
78
+ return null;
79
+ }
80
+
81
+ @Override
82
+ public int updateGlucosesIoThread(@NonNull PocGlucose... glucose) {
83
+ try {
84
+ CheckIoThread();
85
+ return mDaoGlucose.update(glucose);
86
+ } catch (Exception e) {
87
+ e.printStackTrace();
88
+ }
89
+ return 0;
90
+ }
91
+
92
+ @Override
93
+ public LiveData<List<PocGlucose>> getLiveDataGlucoseListByDeviceId(long deviceId) {
94
+ return mDaoGlucose.getAllLiveDataGlucosesByDeviceId(deviceId);
95
+ }
96
+
97
+ @Override
98
+ public PocGlucose getLatestGlucoseByDeviceIdIoThread(long deviceId) {
99
+ try {
100
+ CheckIoThread();
101
+ return mDaoGlucose.getLatestGlucose(deviceId);
102
+ } catch (Exception e) {
103
+ e.printStackTrace();
104
+ }
105
+ return null;
106
+ }
107
+
108
+ @Override
109
+ public List<PocGlucose> getGlucosesByIdIoThread(long deviceId) {
110
+ try {
111
+ CheckIoThread();
112
+ return mDaoGlucose.getAllGlucosesByDeviceId(deviceId);
113
+ } catch (Exception e) {
114
+ e.printStackTrace();
115
+ }
116
+ return null;
117
+ }
118
+
119
+ @Override
120
+ public List<PocGlucose> getGlucosesByIdIoThreadDesc(long deviceId) {
121
+ try {
122
+ CheckIoThread();
123
+ return mDaoGlucose.getAllGlucosesByDeviceIdDesc(deviceId);
124
+ } catch (Exception e) {
125
+ e.printStackTrace();
126
+ }
127
+ return null;
128
+ }
129
+
130
+ @Override
131
+ public List<PocGlucose> getGlucoseByTimeMillis(long startTime, long endTime) {
132
+ try {
133
+ CheckIoThread();
134
+ return mDaoGlucose.getGlucoseByTimeMillis(startTime, endTime);
135
+ } catch (Exception e) {
136
+ e.printStackTrace();
137
+ }
138
+ return null;
139
+ }
140
+
141
+ @Override
142
+ public List<PocGlucose> getEffectiveGlucosesByIdIoThread(long deviceId) {
143
+ try {
144
+ CheckIoThread();
145
+ return mDaoGlucose.getAllEffectiveGlucosesByDeviceId(deviceId);
146
+ } catch (Exception e) {
147
+ e.printStackTrace();
148
+ }
149
+ return null;
150
+ }
151
+
152
+
153
+ @Override
154
+ public PocGlucose getGlucoseByIdIoThread(long deviceId, int glucoseId) {
155
+ try {
156
+ CheckIoThread();
157
+ return mDaoGlucose.getGlucoseById(deviceId, glucoseId);
158
+ } catch (Exception e) {
159
+ e.printStackTrace();
160
+ }
161
+ return null;
162
+ }
163
+
164
+ @Override
165
+ public PocGlucose getGlucoseByTimeIoThread(long deviceId, long timeMillis) {
166
+ try {
167
+ CheckIoThread();
168
+ return mDaoGlucose.getGlucoseByTimeIoThread(deviceId, timeMillis);
169
+ } catch (Exception e) {
170
+ e.printStackTrace();
171
+ }
172
+ return null;
173
+ }
174
+
175
+ @Override
176
+ public int getMaxGlucoseIdIoThread(long deviceId) {
177
+ try {
178
+ CheckIoThread();
179
+ if (getCountGlucoseIoThread(deviceId) > 0) {
180
+ return mDaoGlucose.getMaxGlucoseId(deviceId);
181
+ } else {
182
+ return -1;
183
+ }
184
+ } catch (Exception e) {
185
+ e.printStackTrace();
186
+ }
187
+ return -1;
188
+ }
189
+
190
+
191
+ @Override
192
+ public int getCountGlucoseIoThread(long deviceId) {
193
+ try {
194
+ CheckIoThread();
195
+ return mDaoGlucose.getCountGlucose(deviceId);
196
+ } catch (Exception e) {
197
+ e.printStackTrace();
48
198
  }
49
- }
50
- }
51
- return INSTANCE;
52
- }
53
-
54
- @Override
55
- public void delete(long deviceId, int glucoseId) {
56
- mDaoGlucose.removeAll(deviceId, glucoseId);
57
- }
58
-
59
- @Override
60
- public long insertGlucoseIoThread(PocGlucose glucose) {
61
- try {
62
- CheckIoThread();
63
- return mDaoGlucose.insert(glucose);
64
- } catch (Exception e) {
65
- e.printStackTrace();
66
- }
67
- return -1;
68
- }
69
-
70
- @Override
71
- public long[] insertGlucosesIoThread(@NonNull PocGlucose... glucose) {
72
- try {
73
- CheckIoThread();
74
- return mDaoGlucose.insertAll(glucose);
75
- } catch (Exception e) {
76
- e.printStackTrace();
77
- }
78
- return null;
79
- }
80
-
81
- @Override
82
- public int updateGlucosesIoThread(@NonNull PocGlucose... glucose) {
83
- try {
84
- CheckIoThread();
85
- return mDaoGlucose.update(glucose);
86
- } catch (Exception e) {
87
- e.printStackTrace();
88
- }
89
- return 0;
90
- }
91
-
92
- @Override
93
- public LiveData<List<PocGlucose>> getLiveDataGlucoseListByDeviceId(long deviceId) {
94
- return mDaoGlucose.getAllLiveDataGlucosesByDeviceId(deviceId);
95
- }
96
-
97
- @Override
98
- public PocGlucose getLatestGlucoseByDeviceIdIoThread(long deviceId) {
99
- try {
100
- CheckIoThread();
101
- return mDaoGlucose.getLatestGlucose(deviceId);
102
- } catch (Exception e) {
103
- e.printStackTrace();
104
- }
105
- return null;
106
- }
107
-
108
- @Override
109
- public List<PocGlucose> getGlucosesByIdIoThread(long deviceId) {
110
- try {
111
- CheckIoThread();
112
- return mDaoGlucose.getAllGlucosesByDeviceId(deviceId);
113
- } catch (Exception e) {
114
- e.printStackTrace();
115
- }
116
- return null;
117
- }
118
-
119
- @Override
120
- public List<PocGlucose> getGlucosesByIdIoThreadDesc(long deviceId) {
121
- try {
122
- CheckIoThread();
123
- return mDaoGlucose.getAllGlucosesByDeviceIdDesc(deviceId);
124
- } catch (Exception e) {
125
- e.printStackTrace();
126
- }
127
- return null;
128
- }
129
-
130
- @Override
131
- public List<PocGlucose> getGlucoseByTimeMillis(long startTime, long endTime) {
132
- try {
133
- CheckIoThread();
134
- return mDaoGlucose.getGlucoseByTimeMillis(startTime, endTime);
135
- } catch (Exception e) {
136
- e.printStackTrace();
137
- }
138
- return null;
139
- }
140
-
141
- @Override
142
- public List<PocGlucose> getEffectiveGlucosesByIdIoThread(long deviceId) {
143
- try {
144
- CheckIoThread();
145
- return mDaoGlucose.getAllEffectiveGlucosesByDeviceId(deviceId);
146
- } catch (Exception e) {
147
- e.printStackTrace();
148
- }
149
- return null;
150
- }
151
-
152
-
153
- @Override
154
- public PocGlucose getGlucoseByIdIoThread(long deviceId, int glucoseId) {
155
- try {
156
- CheckIoThread();
157
- return mDaoGlucose.getGlucoseById(deviceId, glucoseId);
158
- } catch (Exception e) {
159
- e.printStackTrace();
160
- }
161
- return null;
162
- }
163
-
164
- @Override
165
- public PocGlucose getGlucoseByTimeIoThread(long deviceId, long timeMillis) {
166
- try {
167
- CheckIoThread();
168
- return mDaoGlucose.getGlucoseByTimeIoThread(deviceId, timeMillis);
169
- } catch (Exception e) {
170
- e.printStackTrace();
171
- }
172
- return null;
173
- }
174
-
175
- @Override
176
- public int getMaxGlucoseIdIoThread(long deviceId) {
177
- try {
178
- CheckIoThread();
179
- if (getCountGlucoseIoThread(deviceId) > 0) {
180
- return mDaoGlucose.getMaxGlucoseId(deviceId);
181
- } else {
182
199
  return -1;
183
- }
184
- } catch (Exception e) {
185
- e.printStackTrace();
186
- }
187
- return -1;
188
- }
189
-
190
-
191
- @Override
192
- public int getCountGlucoseIoThread(long deviceId) {
193
- try {
194
- CheckIoThread();
195
- return mDaoGlucose.getCountGlucose(deviceId);
196
- } catch (Exception e) {
197
- e.printStackTrace();
198
- }
199
- return -1;
200
- }
201
-
202
- @Override
203
- public float[] getIwsIoThread(long deviceId, float Iw) {
204
- CheckIoThread();
205
- float[] databaseIws = mDaoGlucose.getIws(deviceId);
206
- float[] Iws = Arrays.copyOfRange(databaseIws, 0, databaseIws.length + 1);
207
- Iws[databaseIws.length] = Iw;
208
- return Iws;
209
- }
210
-
211
- @Override
212
- public float[] getIbsIoThread(long deviceId, float Ib) {
213
- CheckIoThread();
214
- float[] databaseIbs = mDaoGlucose.getIbs(deviceId);
215
- float[] Ibs = Arrays.copyOfRange(databaseIbs, 0, databaseIbs.length + 1);
216
- Ibs[databaseIbs.length] = Ib;
217
- return Ibs;
218
- }
219
-
220
- @Override
221
- public float[] getTsIoThread(long deviceId, float T) {
222
- CheckIoThread();
223
- float[] databaseTs = mDaoGlucose.getTs(deviceId);
224
- float[] Ts = Arrays.copyOfRange(databaseTs, 0, databaseTs.length + 1);
225
- Ts[databaseTs.length] = T;
226
- return Ts;
227
- }
228
-
229
- @Override
230
- public List<PocGlucose> getGlucoseByDeviceIdAndTimeMillis(long deviceId, long timeMillisStart) {
231
- try {
232
- CheckIoThread();
233
- return mDaoGlucose.getGlucoseByDeviceIdAndTimeMillis(deviceId, timeMillisStart);
234
- } catch (Exception e) {
235
- e.printStackTrace();
236
- }
237
- return null;
238
- }
239
-
240
- @Override
241
- public int[] getYearsIoThread(long deviceId) {
242
- CheckIoThread();
243
- return mDaoGlucose.getYears(deviceId);
244
- }
245
-
246
- @Override
247
- public int[] getMonthsInYearIoThread(long deviceId, int year) {
248
- CheckIoThread();
249
- return mDaoGlucose.getMonths(deviceId, year);
250
- }
251
-
252
- @Override
253
- public int[] getDays(long deviceId, int year, int month) {
254
- CheckIoThread();
255
- return mDaoGlucose.getDays(deviceId, year, month);
256
- }
257
-
258
- @Override
259
- public List<PocGlucose> getEveryDays(long deviceId, int year, int month, int day) {
260
- CheckIoThread();
261
- return mDaoGlucose.getEveryDays(deviceId, year, month, day);
262
- }
263
-
264
- @Override
265
- public List<PocGlucose> getStartDayList(long deviceId, int year, int month, int day, int hour) {
266
- CheckIoThread();
267
- return mDaoGlucose.getStartDayGlucose(deviceId, year, month, day, hour);
268
- }
269
-
270
- @Override
271
- public List<PocGlucose> getEndDayList(long deviceId, int year, int month, int day, int hour) {
272
- CheckIoThread();
273
- return mDaoGlucose.getEndDayGlucose(deviceId, year, month, day, hour);
274
- }
275
-
276
- @Override
277
- public List<PocGlucose> getAllGlucoseByBetweenTime(long deviceId, Date startTime, Date endTime) {
278
- CheckIoThread();
279
- Calendar calendar = Calendar.getInstance();
280
- calendar.clear();
281
- calendar.setTime(startTime);
282
- int startYear = calendar.get(Calendar.YEAR);
283
- int startMonth = calendar.get(Calendar.MONTH);
284
- int startDay = calendar.get(Calendar.DAY_OF_MONTH);
285
- int startHour = calendar.get(Calendar.HOUR_OF_DAY);
286
-
287
- calendar.setTime(endTime);
288
-
289
- int endYear = calendar.get(Calendar.YEAR);
290
- int endMonth = calendar.get(Calendar.MONTH);
291
- int endDay = calendar.get(Calendar.DAY_OF_MONTH);
292
- int endHour = calendar.get(Calendar.HOUR_OF_DAY);
293
-
294
- int startIdBetweenTime = mDaoGlucose.getStartIdBetweenTime(deviceId, startYear, startMonth + 1, startDay, startHour);
295
- int endIdBetweenTime = mDaoGlucose.getEndIdBetweenTime(deviceId, endYear, endMonth + 1, endDay, endHour);
296
-
297
- return mDaoGlucose.getGlucoseBetweenTime(deviceId, startIdBetweenTime, endIdBetweenTime);
298
- }
299
-
300
- @Override
301
- public List<PocGlucose> getEveryPageData(long deviceId, int page, int pageSize) {
302
- int offset = (page - 1) * pageSize;
303
- return mDaoGlucose.getPageData(deviceId, pageSize, offset);
304
- }
305
-
306
- @Override
307
- public List<PocGlucose> getLatestPageData(long deviceId, int pageSize) {
308
- return mDaoGlucose.getLatestPageData(deviceId, pageSize);
309
- }
310
-
311
- @Override
312
- public List<PocGlucose> getAllGlucoseDayData(String name) {
313
- return mDaoGlucose.getGlucoseDayByName(name);
314
- }
315
-
316
- @Override
317
- public int getPageCountsIoThread(long deviceId, int pageSize) {
318
- CheckIoThread();
319
- int count = mDaoGlucose.getCountPreheatEndByDeviceIdIoThread(deviceId);
320
- return count % pageSize == 0 ? (count / pageSize) : (count / pageSize + 1);
321
- }
200
+ }
201
+
202
+ @Override
203
+ public float[] getIwsIoThread(long deviceId, float Iw) {
204
+ CheckIoThread();
205
+ float[] databaseIws = mDaoGlucose.getIws(deviceId);
206
+ float[] Iws = Arrays.copyOfRange(databaseIws, 0, databaseIws.length + 1);
207
+ Iws[databaseIws.length] = Iw;
208
+ return Iws;
209
+ }
210
+
211
+ @Override
212
+ public float[] getIbsIoThread(long deviceId, float Ib) {
213
+ CheckIoThread();
214
+ float[] databaseIbs = mDaoGlucose.getIbs(deviceId);
215
+ float[] Ibs = Arrays.copyOfRange(databaseIbs, 0, databaseIbs.length + 1);
216
+ Ibs[databaseIbs.length] = Ib;
217
+ return Ibs;
218
+ }
219
+
220
+ @Override
221
+ public float[] getTsIoThread(long deviceId, float T) {
222
+ CheckIoThread();
223
+ float[] databaseTs = mDaoGlucose.getTs(deviceId);
224
+ float[] Ts = Arrays.copyOfRange(databaseTs, 0, databaseTs.length + 1);
225
+ Ts[databaseTs.length] = T;
226
+ return Ts;
227
+ }
228
+
229
+ @Override
230
+ public List<PocGlucose> getGlucoseByDeviceIdAndTimeMillis(long deviceId, long timeMillisStart) {
231
+ try {
232
+ CheckIoThread();
233
+ return mDaoGlucose.getGlucoseByDeviceIdAndTimeMillis(deviceId, timeMillisStart);
234
+ } catch (Exception e) {
235
+ e.printStackTrace();
236
+ }
237
+ return null;
238
+ }
239
+
240
+ @Override
241
+ public int[] getYearsIoThread(long deviceId) {
242
+ CheckIoThread();
243
+ return mDaoGlucose.getYears(deviceId);
244
+ }
245
+
246
+ @Override
247
+ public int[] getMonthsInYearIoThread(long deviceId, int year) {
248
+ CheckIoThread();
249
+ return mDaoGlucose.getMonths(deviceId, year);
250
+ }
251
+
252
+ @Override
253
+ public int[] getDays(long deviceId, int year, int month) {
254
+ CheckIoThread();
255
+ return mDaoGlucose.getDays(deviceId, year, month);
256
+ }
257
+
258
+ @Override
259
+ public List<PocGlucose> getEveryDays(long deviceId, int year, int month, int day) {
260
+ CheckIoThread();
261
+ return mDaoGlucose.getEveryDays(deviceId, year, month, day);
262
+ }
263
+
264
+ @Override
265
+ public List<PocGlucose> getStartDayList(long deviceId, int year, int month, int day, int hour) {
266
+ CheckIoThread();
267
+ return mDaoGlucose.getStartDayGlucose(deviceId, year, month, day, hour);
268
+ }
269
+
270
+ @Override
271
+ public List<PocGlucose> getEndDayList(long deviceId, int year, int month, int day, int hour) {
272
+ CheckIoThread();
273
+ return mDaoGlucose.getEndDayGlucose(deviceId, year, month, day, hour);
274
+ }
275
+
276
+ @Override
277
+ public List<PocGlucose> getAllGlucoseByBetweenTime(long deviceId, Date startTime, Date endTime) {
278
+ CheckIoThread();
279
+ Calendar calendar = Calendar.getInstance();
280
+ calendar.clear();
281
+ calendar.setTime(startTime);
282
+ int startYear = calendar.get(Calendar.YEAR);
283
+ int startMonth = calendar.get(Calendar.MONTH);
284
+ int startDay = calendar.get(Calendar.DAY_OF_MONTH);
285
+ int startHour = calendar.get(Calendar.HOUR_OF_DAY);
286
+
287
+ calendar.setTime(endTime);
288
+
289
+ int endYear = calendar.get(Calendar.YEAR);
290
+ int endMonth = calendar.get(Calendar.MONTH);
291
+ int endDay = calendar.get(Calendar.DAY_OF_MONTH);
292
+ int endHour = calendar.get(Calendar.HOUR_OF_DAY);
293
+
294
+ int startIdBetweenTime = mDaoGlucose.getStartIdBetweenTime(deviceId, startYear, startMonth + 1, startDay, startHour);
295
+ int endIdBetweenTime = mDaoGlucose.getEndIdBetweenTime(deviceId, endYear, endMonth + 1, endDay, endHour);
296
+
297
+ return mDaoGlucose.getGlucoseBetweenTime(deviceId, startIdBetweenTime, endIdBetweenTime);
298
+ }
322
299
 
300
+ @Override
301
+ public List<PocGlucose> getEveryPageData(long deviceId, int page, int pageSize) {
302
+ int offset = (page - 1) * pageSize;
303
+ return mDaoGlucose.getPageData(deviceId, pageSize, offset);
304
+ }
305
+
306
+ @Override
307
+ public List<PocGlucose> getLatestPageData(long deviceId, int pageSize) {
308
+ return mDaoGlucose.getLatestPageData(deviceId, pageSize);
309
+ }
310
+
311
+ @Override
312
+ public List<PocGlucose> getAllGlucoseDayData(String name) {
313
+ return mDaoGlucose.getGlucoseDayByName(name);
314
+ }
315
+
316
+ @Override
317
+ public int getPageCountsIoThread(long deviceId, int pageSize) {
318
+ CheckIoThread();
319
+ int count = mDaoGlucose.getCountPreheatEndByDeviceIdIoThread(deviceId);
320
+ return count % pageSize == 0 ? (count / pageSize) : (count / pageSize + 1);
321
+ }
322
+
323
+ @Override
324
+ public void deleteAllGlucoseData() {
325
+ try {
326
+ Runnable deleteRunnable = () -> mDaoGlucose.clearGlucoseTable();
327
+ mAppExecutors.diskIO().execute(deleteRunnable);
328
+ } catch (Exception e) {
329
+ e.printStackTrace();
330
+ }
331
+ }
323
332
  }