Reputation: 1
I wanted to know if somebody would help me with a technical challange: reading the Freestyle Libre sensor data in Swift. The glucose sensor for diabetic patients uses ISO 15693 protocol for communicating with other devices by vicinity.
For now, I have already established connection with the sensor using the NFC core NFCTagReaderSession class. Also, I have pulled data successfully using ReadSingleBlock function. The device sends back 8 bytes in a Data object and is not UTF8 encoded... so I am having problems to decode those response bytes.
I've seen some people decoding sensor data in C (arduino language) and Java, but conversion to Swift seems not to be straightforward.
Arduino implementation: https://github.com/JoernL/LimiTTer/blob/master/LimiTTer.ino
Java implementation (Android): https://github.com/vicktor/FreeStyleLibre-NFC-Reader/blob/master/app/FreeStyleLibre/app/src/main/java/com/socialdiabetes/freestylelibre/Abbott.java
I would really appreciate if someone could help me :)
For now, the reading function looks like this:
case .iso15693(let tag):
// Read one block of data
tag.readSingleBlock(requestFlags: .highDataRate, blockNumber: 0, resultHandler: { result in
switch result {
case .success(let str):
print(str)
case .failure(let error):
print(error)
}
})
And response from sensor looks like this:
Upvotes: 0
Views: 380