summaryrefslogtreecommitdiffstats
path: root/freestyle_hid/_session.py (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-08-03Update typing to PEP 585 style.Diego Elio Pettenò1-4/+5
This replaces the usage of generics from `typing` with built-in or from `collections.abc` since Python 3.9 is the minimum supported version.
2023-08-03Be more verbose on error messages and parsing with construct.Diego Elio Pettenò1-42/+109
Instead of manually combining and parsing integers (particularly IV that is a 56-bit integer), use construct formats to handle the parsing.
2023-08-03Don't depend on product ID to enable encrypted protocol.Diego Elio Pettenò1-5/+6
This is a little less automatic in the way it works, but it allows the caller to decide whether to enable the encrypted protocol for the session or not. It also raises earlier in case the encryption keys are not found.
2023-08-03If present, load the actual keys from freestyle-keys package.Diego Elio Pettenò1-10/+15
2023-08-03Reformat to pass pre-commit checks.Diego Elio Pettenò1-18/+30
2023-08-03initial encrypted protocol supportMPM11071-22/+83
2021-03-03Allow selecting which encoding to use for decoding text commands.Diego Elio Pettenò1-11/+9
The FreeStyle Libre at least allows patient names and other strings to be set in UTF-8 so there is no reason to force ascii everywhere. Instead, allow the session to define an encoding for ease of integration with downstream tools.
2021-03-03Calculate multirecords checksum based on the raw bytes.Diego Elio Pettenò1-7/+14
The original FreeStyle Libre software is known for incorrectly truncating strings with UTF-8, which causes the multi-record strings not to decode correctly. But since the Libre actually sends these as they are provided, we can calculate the checksum correctly if we do that _before_ replacing the invalid codepoints. This splits the `send_text_command` method into a public and a private interface, with the public returning the expected string, while the private returns the raw bytes. It should probably be changed to always return bytes instead. This change fixes https://github.com/glucometers-tech/glucometerutils/issues/103.