GithubHelp home page GithubHelp logo

Comments (7)

JohanDegraeve avatar JohanDegraeve commented on July 20, 2024

from xdripswift.

JohanDegraeve avatar JohanDegraeve commented on July 20, 2024

I think this comment is correct. The header is in front, which is the sensor serial number https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Transmitter/CGMBluetoothTransmitter/Libre/Bubble/CGMBubbleTransmitter.swift#L170

the data is after the header : https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Transmitter/CGMBluetoothTransmitter/Libre/Bubble/CGMBubbleTransmitter.swift#L193
ibreData: (rxBuffer.subdata(in: bubbleHeaderLength..<(344 + bubbleHeaderLength)))

from xdripswift.

gui-dos avatar gui-dos commented on July 20, 2024

The patchUID, the serial number is computed from, comes with the packet whose response type is 0xC0.
The patchInfo comes with the new packet whose response type is 0xC1.
Then comes the data packet, whose response type is 0x82 and whose length is 352 byte: 344 FRAM bytes plus 8 null footer bytes.

In the xDrip sources the constant 8 is called indeed BUBBLE_FOOTER:
https://github.com/NightscoutFoundation/xDrip/blob/b7bc355cea2128f72a4e09c82ce1d937e14c81e0/app/src/main/java/com/eveningoutpost/dexdrip/Models/Bubble.java#L52s

I tested all this thoroughly with https://gist.github.com/gui-dos/83fbd9b6f3a7dfe17b2dd77a59c8ddde

The comment says "added by Bubble in front of data that is received from Libre" but Bubble instead appends a trail at the end of the data that is received from Libre. The serial is sent separately in a packet 10 bytes long, the patchInfo is extracted from its 14 byte packet.

from xdripswift.

JohanDegraeve avatar JohanDegraeve commented on July 20, 2024

The packet which starts with 0xC0 is added to the rxBuffer, at that moment the rxBuffer is still empty

https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Transmitter/CGMBluetoothTransmitter/Libre/Bubble/CGMBubbleTransmitter.swift#L160

Then come several packets 0x82, these are being appended to the rxBuffer, which means after the first packet
https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Transmitter/CGMBluetoothTransmitter/Libre/Bubble/CGMBubbleTransmitter.swift#L164

Once all packets are received, the full data is processed, starting by reading the serialnumber
https://github.com/JohanDegraeve/xdripswift/blob/master/xdrip/Transmitter/CGMBluetoothTransmitter/Libre/Bubble/CGMBubbleTransmitter.swift#L170 which is the first 8 bytes.

So i think the name and comment are correct

from xdripswift.

gui-dos avatar gui-dos commented on July 20, 2024

The newer firmwares are sending the 0xC0 patchUid packet, the 0xC1 patchInfo packet and the 0x82 data packets, in this sequence.

If you are going to accumulate also the patchInfo in the unified rxBuffer, you will have to change the bubbleHeaderLength constant. But are the patchUid and the PatchInfo really a "header"?

from xdripswift.

JohanDegraeve avatar JohanDegraeve commented on July 20, 2024

I haven't started yet with support of new firmware versions.

It's just the way it's coded. I could have processed packet 0xC0 immediately when receiving (ie decoding the sensor serial number). In that case the header length definition wouldn't be needed at all.

After all it's not a header indeed, as it's a seperate packet.
But I don't believe right now this comment or property name needs to be changed.

from xdripswift.

gui-dos avatar gui-dos commented on July 20, 2024

Unfortunately https://github.com/jizhongwen/xdripswift hasn't been updated since August even if on TestFlight there have been published more updated betas (https://testflight.apple.com/join/5DrayRKU). Curious to have a look to their implementation :).

from xdripswift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.