summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use empty `__init__.py` files.HEADmainDiego Elio Pettenò2023-08-032-6/+0
| | | | This avoids SPDX tagging files that have no useful content.
* Update typing to PEP 585 style.Diego Elio Pettenò2023-08-033-10/+12
| | | | | This replaces the usage of generics from `typing` with built-in or from `collections.abc` since Python 3.9 is the minimum supported version.
* FreeStyle Libre: implement glucose unit identificaton.Diego Elio Pettenò2023-08-031-4/+8
| | | | | The suspected `$uom?` command was finally confirmed to be the correct command to identify the unit of measure used.
* Initial import of FreeStyle Libre 2 driver.Diego Elio Pettenò2023-08-032-0/+254
| | | | | | | | | After three years, the encrypted protocol is understood and implemented, huge thanks to @MPM1107. The actual implementation of the driver is exactly the same as the one for Libre readers, besides the encryption. The two share effectively all of the driver.
* Add the handle_ attribute typing to the class.Diego Elio Pettenò2022-12-171-1/+3
| | | | | This makes sure that the import of BinaryIO is actually used in the code itself.
* serial meters support: allow selection of parity mode.Diego Elio Pettenò2021-03-271-1/+2
| | | | | While uncommon there are glucometers that don't use the default parity mode of "none". Allow the drivers to override this.
* freestyle: use freestyle-hid 1.0.2 encoding parameter.Diego Elio Pettenò2021-03-031-4/+9
| | | | | This allows FreeStyle Libre devices to use UTF-8 patient names, while not risking to brick older models that might just support ASCII.
* Add py.typed file to mark the package as typed.Diego Elio Pettenò2020-10-041-0/+3
|
* Use 0BSD instead of Unlicense for copyright disclaim.Diego Elio Pettenò2020-10-042-2/+2
|
* Depend on freestyle-hid for FreeStyle support and remove tools.Diego Elio Pettenò2020-10-042-283/+16
| | | | | | | | | Instead of maintaining the reversing tools for Abbott FreeStyle devices in this repository, they are now part of their own project (https://github.com/glucometers-tech/freestyle-hid), making it easier to split the dependencies requirements. The basic I/O of the FreeStyle session is also implemented in that library.
* Update pre-commit plugins to the latest versions as of today.Diego Elio Pettenò2020-09-074-3/+4
|
* Make use of modern Python ordered kwargs.Svetlana Pantelejeva2020-08-022-24/+21
| | | | Remove usage of overloaded division operator in construct structures.
* Add pre-commit configuration for REUSE.software.Diego Elio Pettenò2020-05-162-0/+6
| | | | | The only files that were lacking a license were the 0-sized __init__.py files — since those are not copyrighteable, make them Unlicense relesed.
* Rename driver.GlucometerDriver to driver.GlucometerDevice.Diego Elio Pettenò2020-04-092-2/+2
| | | | | The "driver" is the module — the classes need to be called Device. This allows adding further typing around this.
* Move driver_base to glucometerutils.driver instead.Diego Elio Pettenò2020-04-093-72/+6
| | | | This makes it more like the other common modules, and allows expanding the interfaces.
* Add missing SPDX-FileCopyrightText throughout the project.Diego Elio Pettenò2020-03-2711-0/+11
| | | | This is following the advice provided in https://matija.suklje.name/how-and-why-to-properly-write-copyright-statements-in-your-code
* The big typing cleanup.Diego Elio Pettenò2020-03-277-86/+92
| | | | | | | | Now that Python 3.7 is the minimum Python version, typing can be done inline, which makes it easier for mypy to know the files to check. Indeed, all the files are now typechecked, which uncovered a few minor bugs and mistakes here and there.
* Fix typing for contourusb support module.Diego Elio Pettenò2020-03-271-32/+33
| | | | | | | This replaces the definition of modes with an Enum class, which is more appropriate, and adds typing throughout the module. Text is also replaced with str since we don't support Python 2 anyway.
* Fix errors identified by flake8.Diego Elio Pettenò2020-03-262-12/+7
|
* Make HID support a "session" class rather than a base class.Diego Elio Pettenò2020-03-224-109/+132
| | | | | | This in turn allows wrapping the FreeStyle access in its own session class, which the freestyle_hid_console can use without dirty tricks, and without triggering the now-abstract class.
* Move tests to be organized within the source directory.Diego Elio Pettenò2020-03-164-0/+114
| | | | | This should simplify maintaining the tests in the long run, and allows mypy to more thoroughly check for types.
* Now that Python 3.6 is the minimum supported version, use f-strings.Diego Elio Pettenò2020-03-144-20/+14
| | | | | | | | | | | The f-strings formatted strings are generally simpler to write, read and debug, with a few exceptions. Keep the logging strings lazy, keep the CSV-building with %-formatting, as it makes it more readable. In fsoptium, keep `'$%s\r\n'` as a %-format, to avoid making it `f'${command}\r\n'` that would make it easy to mistake for a Shell variable.
* format code with blackBen2020-03-088-196/+228
|
* FreeStyle: fix keepalive message handling for non-Libre devices.Diego Elio Pettenò2020-03-061-1/+1
| | | | | | | Message type 0x22 is a keepalive message, which has usually one 0x05 or 0x03 byte. But don't expect a certain value, just ignore the message. This fixes issue #73.
* Fix typo.Diego Elio Pettenò2020-03-061-2/+2
|
* factor out common driver methodsBen2020-02-182-10/+61
|
* Bugfix: get current time within the functionBen2020-02-181-1/+3
|
* contourusb: fix mypy typing.Diego Elio Pettenò2020-01-251-6/+9
| | | | | This includes importing the right abstract classes and correcting some call typing information.
* freestyle: add some (rough) support for encrypted messages.Diego Elio Pettenò2020-01-251-17/+80
| | | | | | While the Libre 2 protocol is still not usable, this makes it possible to at least send messages to it and get a translation of what the mistake was in the first place.
* freestyle: raise exceptions if a command returned an error state.Diego Elio Pettenò2020-01-251-0/+7
| | | | | This includes both the classic "unknown message type" error, and the Libre 2 encryption error state.
* freestyle: simplify the code for initialization further.Diego Elio Pettenò2020-01-251-9/+3
| | | | | | This is not a sequence, but rather a single initialization command. Remove the loop and the long comment that no longer applies (serial numbers and all.)
* freestyle: only send command 0x01 to initialize the device.Diego Elio Pettenò2020-01-241-1/+1
| | | | | | | | This has been tested on fslibre and fsprecisionneo, but please report if this does not work with other FreeStyle devices (Insulinx?) It appears the 0x04/0x05/0x15 dance is only needed by the Abbott software to identify which model (and software version) it is talking with.
* Add driver implementation for Ascensia ContourUSB.Arvanitis Christos2019-09-251-0/+328
| | | | | | | | | | | Implemented based on the protocol documentation provide by Ascensia, with portions from glucodump by @sm6xmm (relicensed by the author under MIT license.) Squashed from pull request #62. Signed-off-by: Anders Hammarquist <iko@iko.pp.se> Signed-off-by: Diego Elio Pettenò <flameeyes@flameeyes.com>
* Remove try/except around typing imports.Diego Elio Pettenò2019-09-243-15/+3
| | | | Since Python 3.4 is no longer supported, there's no reason for typing not to be there.
* freestyle: fix return type for empty log.Diego Elio Pettenò2019-09-211-1/+1
| | | | () is not a valid Iterator[List[Text]]
* freestyle devices: don't error out if there are no readings.Diego Elio Pettenò2019-09-081-0/+4
| | | | | The multi-record format returns "Log Empty" if there's no entry in the device, catch that.
* Use the new website URL for glucometer-protocols.Diego Elio Pettenò2019-09-021-5/+4
|
* FreeStyle devices: don't error out for non-ASCII patient names.Diego Elio Pettenò2019-07-301-15/+27
| | | | | | | | | | This was brought up in issue #60. While the devices don't appear to care much for patient names, and can't be expected to support UTF-8 (the Windows software don't appear to allow that), it's worth protecting against this and just replacing the non-ASCII characters. To make this easier, the decoding is pushed down to the end of the processing of the multi-packet response, rather than being done per-packet.
* Get and set the patient name on supported meters.Diego Elio Pettenò2019-07-071-0/+9
| | | | | | This includes the command line extensions to include the get/set patient name, as well as the driver support for all FreeStyle devices with the shared HID protocol, although not all will support this properly.
* fslibre: expose patient name if the device knows it.Diego Elio Pettenò2019-07-071-1/+8
| | | | | This includes extension of the base info command to report this when asked on the command line.
* Introduce an explicit InvalidDateTime exception for meters with unset time.Diego Elio Pettenò2019-07-011-1/+7
| | | | | | | | At least the FreeStyle Precision Neo appears to be able to report an invalid date/time (255/255/255 255:255), probably when the RTC is lost (see issue #58). This returns a more precise output than N/A, and should suggest to confirm the date and time setting instead.
* fsprecisionneo: Scale ketone readings to mmol/lAndreas Sandberg2019-05-191-0/+10
| | | | | | The FreeStyle Optimum Neo reports ketones in using the same unit as FreeStyle Libre. Move the conversion function from fslibre.py to freestyle.py to facilitate sharing and do the right conversion in fsprecisionneo.py.
* freestyle support: restore correct order of parameters.Diego Elio Pettenò2019-05-161-1/+1
| | | | Also add a test so that we don't break this again in the future.
* Bug fix: incorrect argument order in call to construct.Const.André Caldas2019-05-051-1/+1
|
* Replace epydoc metadata with SPDX identifiers.Diego Elio Pettenò2019-02-086-30/+13
| | | | | | | | | | Most of the epydoc metadata (author, copyright, email) is duplicate in the package's setup.py or README. These copies are more likely to get out of date, and increase the amount of work to keep them in line. The license information should rather be provided with an SPDX identifier, which is more similar to what the Linux kernel and other projects, such as pyserial, do.
* Replace flameeyes.eu with flameeyes.com.Diego Elio Pettenò2019-02-086-6/+6
| | | | | | | | Due to EURid threatening to suspend my domain, make sure that the references are updated to point at the right stable domain. This includes changes to the files as well as a mailmap to update the author references in the log.
* hiddevice: fix support for modern hidapi.Diego Elio Pettenò2019-01-291-3/+3
| | | | | | | The value of None is not valid for current hidapi implementation, but anything below 0 is considered no timeout. Fixes issue #50.
* Fix most of the pylint output, and hide away some that is not needed.Diego Elio Pettenò2018-12-125-25/+26
| | | | Again, this is not ready for CI yet unfortunately :(
* Reindent all files to match the 4-spaces indentation.Diego Elio Pettenò2018-12-121-26/+26
|
* hiddevice: split handle_ and hidapi_handle_.Diego Elio Pettenò2018-12-121-9/+15
| | | | This avoids confusing mypy, and is also less magical.
* Sprinkle more type annotations throughout the codebase.Diego Elio Pettenò2018-12-125-2/+22
|
* Experimentally start adding type annotations, and mypy configs.Diego Elio Pettenò2018-12-123-11/+21
| | | | | This cannot currently be added to CI because the lack of `construct` stubs, which cause "unsupported left operands" for /-constructed structs.
* Don't fold the command prefix into the LifeScanPacket.Diego Elio Pettenò2018-11-161-8/+3
| | | | | | | For the otultraeasy, there is no prefix provided in the acks at all, so the previous change broke the otultraeasy. Partial revert of b5784bb35b9968bf977d1319c3301958d671f45c.
* fix invalid self-referenceNoel Cragg2018-07-241-1/+1
| | | | | | | During the structure rebuild, the 'message' key is removed before its callback is invoked, causing 'this.message' to raise a nonexistent key error. This change reverts the line in question to its pre-84aad729 logic (but leaving the variable name substitutions in place).
* freestyle support: add debug logging of commands sent and received.Diego Elio Pettenò2018-03-171-0/+4
|
* Update lifescan_binary_protocol.pyArkadiusz Bulski2018-03-171-2/+2
| | | lambdafied this expression
* SymmetricMapping was renamed to MappingArkadiusz Bulski2018-03-171-1/+1
|
* corected timestamp commentArkadiusz Bulski2018-03-171-1/+1
|
* construct code fixed improper embeddingArkadiusz Bulski2018-03-171-4/+2
|
* construct-code is (almost) uptodateArkadiusz Bulski2018-03-173-4/+4
|
* lifescan binary protocol: factor out _COMMAND_SUCCESS.Diego Elio Pettenò2018-01-071-0/+2
| | | | The success status is always %x06 if there is a message at all.
* lifescan binary protocol: make the packet generator a function.Diego Elio Pettenò2018-01-061-26/+31
| | | | | | | | | | | | | | This ensures that the command prefix is added directly into the packet structure, simplifying the rest of the code. Per driver changes: - otverio2015: command prefix is changed from 0x04 to 0x03; this ensures that all the responses share the same prefix (READ RECORD COUNT does not repeat the selected command prefix). - otverioiq: command prefix is changed from 0x04 to 0x03, to align with the otverio2015 driver and the trace from OneTouch Diabetes Management Software.
* lifescan_binary_protocol: factor out glucose unit mappings.Diego Elio Pettenò2018-01-061-0/+9
| | | | | The values are the same between all models sharing this protocol, even though the full reply message isn't.
* lifescan_binary_protocol: create a new module to support LifeScan drivers.Diego Elio Pettenò2018-01-061-0/+52
| | | | | | | | | | Both the UltraEasy and Verio 2015 use a similar protocol, with the same base packet serialised to the device. Factor the packet definition out (and make it a bit more generic). Verio IQ (Issue #30) also shares the same base protocol. Also move the definition of VERIO_TIMESTAMP to this common module as it's also shared with the Verio IQ.
* otultraeasy: factor out the construct Timestamp implementation.Diego Elio Pettenò2018-01-011-0/+33
| | | | | | | This adds tests to ensure this works right in the general case, so that it can be used with different parameters. The adapter will be reused in the otverio2015 driver.
* serial devices: disable xonxoff by default.Diego Elio Pettenò2017-12-311-1/+1
| | | | | | | | | | With 2a825fb889735fa881566d1764cc48d2814447d2 the parameters to open the serial device were lifted from the fsoptium driver, which was the only one passing xonxoff=True. The Optium device has no problem with disabling this feature, but the codefree driver hangs if this is set to True. So instead set it to False and get rid of it.
* freestyle: rename miscopied constant name.Diego Elio Pettenò2017-12-301-2/+2
|
* freestyle: replace the custom struct and bytemangling with construct.Diego Elio Pettenò2017-12-281-8/+11
| | | | | | | | This simplifies the code and enforces the validation within the format documentation too. construct can handle the full package verification, including dealing with padding.
* Fix with_ketoneLeonard Lausen2017-10-022-6/+2
|
* Fix ketone readingLeonard Lausen2017-10-022-2/+6
|
* freestyle: add some debugging information.Diego Elio Pettenò2017-06-151-0/+3
|
* hiddevice: default to no timeout, like before.Diego Elio Pettenò2017-06-151-5/+5
| | | | | This restores the original behaviour, that seems to be necessary for the FreeStyle devices.
* hiddevice: make hidapi calls take a timeout, default to 1 second.Diego Elio Pettenò2017-06-061-1/+8
| | | | | This is important for a meter I'm working on right now, as there is no obvious way to tell whether to wait for new packets or not.
* hiddevice: add a 1-second timeout to reads.Diego Elio Pettenò2017-06-051-1/+6
| | | | This is a semantics difference between hidraw and HIDAPI, cover for it.
* Add a ne support class for HID-based devices.Diego Elio Pettenò2017-06-042-36/+83
| | | | | I'm currently implementing a separate HID-based driver that does not use the Abbott protocol, so this makes my life easier.
* Abbott devices: add support for using hidapi library.Diego Elio Pettenò2017-06-031-6/+29
| | | | | | | | | This allows these drivers to be used on operating systems other than Linux, as hidapi abstracts away the access. The interface is similar enough to using hidraw that the actual code only needed minimal changes. Maintain the ability to access the devices with the hidraw path too, without forcing the dependency.
* Fix encoding info and add missing __init__.py fileDorian Scholz2017-05-303-0/+2
|
* Serial drivers: factor out opening of the serial port to a new base class.Diego Elio Pettenò2017-04-171-0/+66
| | | | | | This allows the serial support class to open the serial port without each driver having to pass the same long list of parameters, given that effectively all the meters use the same parameters, except few.
* all drivers: make --device optional at the tool level.Diego Elio Pettenò2017-04-151-0/+5
| | | | | | | | This requires the drivers to validate their device, but also means they can provide a more explicit error message for the user as to what should be passed. This is a first step to help solving Issue 9.
* freestyle: error out if hidraw device does not exist.Diego Elio Pettenò2017-01-171-0/+4
| | | | This avoids creating a binary file when running the tool as root (bad Flameeyes).
* fsprecisionneo: move the version and serial number information to the common support class.Diego Elio Pettenò2017-01-171-0/+8
|
* freestyle: improve error message on command failure, fix comment.Diego Elio Pettenò2017-01-171-2/+2
|
* freestyle: raise NotImplementedError when trying to zero-log.Diego Elio Pettenò2017-01-171-0/+4
|
* fsprecisionneo: add support for setting date and time.Diego Elio Pettenò2017-01-171-15/+29
| | | | | | There are shared commands that allow settings the date and time of the device, implement those in the freestyle support module, so that they can be re-used in implementation of the same base protocol.
* Update copyrights, cleanup whitespace where needed.Diego Elio Pettenò2017-01-162-1/+6
|
* Add new driver for the Abbott FreeStyle Precision Neo.Diego Elio Pettenò2017-01-161-0/+192
| | | | | This driver uses the HID-based protocol which is shared among different devices.
* LifeScan devices: move lifescan_common to the support directory.Diego Elio Pettenò2017-01-161-0/+51
This makes it easier to figure out which files represent drivers, and which ones are per-vendor support modules.