summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support/freestyle.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Make HID support a "session" class rather than a base class.Diego Elio Pettenò2020-03-221-71/+92
| | | | | | 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.
* Now that Python 3.6 is the minimum supported version, use f-strings.Diego Elio Pettenò2020-03-141-8/+4
| | | | | | | | | | | 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-081-67/+80
|
* 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-181-10/+6
|
* Bugfix: get current time within the functionBen2020-02-181-1/+3
|
* 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.
* Remove try/except around typing imports.Diego Elio Pettenò2019-09-241-5/+1
| | | | 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-081-5/+2
| | | | | | | | | | 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-081-1/+1
| | | | | | | | 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.
* Fix most of the pylint output, and hide away some that is not needed.Diego Elio Pettenò2018-12-121-3/+2
| | | | Again, this is not ready for CI yet unfortunately :(
* Sprinkle more type annotations throughout the codebase.Diego Elio Pettenò2018-12-121-0/+14
|
* Experimentally start adding type annotations, and mypy configs.Diego Elio Pettenò2018-12-121-4/+4
| | | | | This cannot currently be added to CI because the lack of `construct` stubs, which cause "unsupported left operands" for /-constructed structs.
* freestyle support: add debug logging of commands sent and received.Diego Elio Pettenò2018-03-171-0/+4
|
* construct-code is (almost) uptodateArkadiusz Bulski2018-03-171-1/+1
|
* 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.
* freestyle: add some debugging information.Diego Elio Pettenò2017-06-151-0/+3
|
* Add a ne support class for HID-based devices.Diego Elio Pettenò2017-06-041-36/+4
| | | | | 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-301-0/+1
|
* 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-161-0/+5
|
* 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.