react-native-nfc-manager icon indicating copy to clipboard operation
react-native-nfc-manager copied to clipboard

usage with freestyle libre sensor

Open gabrielew opened this issue 3 years ago • 5 comments

Is it possible to read the freestyle libre sensor?

I've tried to use with this code

await NfcManager.requestTechnology(NfcTech.Iso15693IOS);
    const tag = await NfcManager.getTag();
    const handler = NfcManager.iso15693HandlerIOS;
    console.warn('Tag found', tag);
 // Tag found {"icManufacturerCode": 7, "icSerialNumber": [160, 0, 9, 53, 47, 189], "id": "E007A00009352FBD", "tech": "iso15693"}
    const response = (await handler.getSystemInfo(
      Nfc15693RequestFlagIOS.HighDataRate,
    )) as any;
    console.warn('Response found', response);
// Response found {"afi": -1, "blockCount": 244, "blockSize": 8, "dsfid": -1, "icReference": -1}

    const bytes = await handler.readSingleBlock({
      flags: Nfc15693RequestFlagIOS.HighDataRate,
      blockNumber: 0, // from 0 to 255
    });

// [76,76,16,26,3,0,0,0] => how can I covert this to readable glucose values?

gabrielew avatar Apr 18 '22 19:04 gabrielew

I am not a React Native developer but I just discovered that this new project https://github.com/ddtch/react-native-libre-manager is successfully reusing my native Swift classes.

gui-dos avatar Apr 18 '22 19:04 gui-dos

I am not a React Native developer but I just discovered that this new project https://github.com/ddtch/react-native-libre-manager is successfully reusing my native Swift classes.

@gui-dos

I already tried this lib but doesn't work.

I will look through your classes

meanwhile what number do you use in block number?

or how can I covert this to readable glucose values? [76,76,16,26,3,0,0,0]

gabrielew avatar Apr 18 '22 19:04 gabrielew

The Libre 1 stores the measured glucose and temperature data in 43 FRAM blocks divided in tre sections of 3 + 37 + 3 blocks which are prefixed by a CRC16 checksum. The first two bytes you are scanning are just the CRC of the first section (the “header”) whose fifth byte stands for the sensor status (03 = ready),

It’s just the beginning of a long story. A very detailed free technical paper on the Libre Internals is to be found on “Security analysis of a Connected Glucose Sensor for Diabetes”.

gui-dos avatar Apr 18 '22 20:04 gui-dos

@gui-dos hey there, which file has the brazil sensor functionality in diable repository?

gabrielew avatar Apr 22 '22 13:04 gabrielew

Any updates on this ? I would like to use this lib to scan Freestyle Libre Sensor. cc @gabrielew @gui-dos

matextrem avatar May 18 '22 18:05 matextrem

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 17 '22 02:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Sep 01 '22 02:09 github-actions[bot]

function toHexString(byteArray) { return Array.from(byteArray, function (byte) { return ('0' + (byte & 0xff).toString(16)).slice(-2); }); }

krazy527 avatar Sep 13 '22 06:09 krazy527