0

I have tried to take glucose value, by help of this Article, I came to know that freestyle liber has Trend records (8hr) and History records (24hr) will carry glucoses. I have searched for android and flutter to take the glucose value form freestyle liber, then got some GitHub links as reference lister below

  1. vicktor/FreeStyleLibre-NFC-Reader
  2. DorianScholz/OpenLibre
  3. cominixo/OpenLibreNFC
  4. creepymonster/GlucoseDirect
  5. amino-health/quantify-app

from that above GitHub reference, I have created this method but glucose value is above 1000

we need to get 70 to 240 for glucose value

List getHistoryData(memoryDatafromNFC) {
    List result = [];
    int watchTime = DateTime.now().millisecondsSinceEpoch;
    int indexTrend = memoryDatafromNFC[26];
    int sensorTime = 256 * (memoryDatafromNFC[317]) + (memoryDatafromNFC[316]);
    int sensorStartTime = watchTime - sensorTime * 60000;

    for (int index = 0; index < 32; index++) {
      int i = indexTrend - index - 1;
      if (i < 0) i += 32;
      int time = [0, (((sensorTime - 3) / 15).abs() * 15 - index * 15).round()]
          .reduce(max);
      DateTime readTime =
          DateTime.fromMillisecondsSinceEpoch(sensorStartTime + time * 60000);
      result.add(
      {
        "timeStamp":DateTime(readTime.year, readTime.month, readTime.day, readTime.hour,
              readTime.minute),
          "glucoseValue":getGlucoseValue(
            memoryDatafromNFC[(i * 6 + 125)],
            memoryDatafromNFC[(i * 6 + 124)],
          ),
      }
      );
    }
    return result;
  }

  double getGlucoseValue(int fstByte, int sndByte) {
    return (((256 * fstByte) + (sndByte)) & 0x0FFF) / 1;
  }

0 Answers0