From 5614d3b156ddd652eebe6ca1f5e2de5e9d8a7f9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sun, 7 Jul 2019 22:29:13 +0100 Subject: Get and set the patient name on supported meters. 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. --- glucometerutils/support/freestyle.py | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'glucometerutils/support') diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py index 4684194..13674df 100644 --- a/glucometerutils/support/freestyle.py +++ b/glucometerutils/support/freestyle.py @@ -193,6 +193,15 @@ class FreeStyleHidDevice(hiddevice.HidDevice): return None return patient_name + def set_patient_name(self, name): + # type: (Text) -> None + try: + name = name.encode('ascii') + except UnicodeDecodeError: + raise ValueError('Only ASCII-safe names are tested working') + + result = self._send_text_command(b'$ptname,' + name) + def get_datetime(self): # type: () -> datetime.datetime """Gets the date and time as reported by the device. -- cgit v1.2.3