From cd6d708d687a80587e666c83db51471b2a30c05b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Tue, 17 Jan 2017 00:28:44 +0000 Subject: fsprecisionneo: move the version and serial number information to the common support class. --- glucometerutils/drivers/fsprecisionneo.py | 12 ++---------- glucometerutils/support/freestyle.py | 8 ++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/glucometerutils/drivers/fsprecisionneo.py b/glucometerutils/drivers/fsprecisionneo.py index 2b5ae35..c748770 100644 --- a/glucometerutils/drivers/fsprecisionneo.py +++ b/glucometerutils/drivers/fsprecisionneo.py @@ -40,14 +40,6 @@ class Device(freestyle.FreeStyleHidDevice): 'Software version: ' + self._get_version(),), native_unit=self.get_glucose_unit()) - def _get_version(self): - """Return the software version of the device.""" - return self._send_text_command(b'$swver?').rstrip('\r\n') - - def get_serial_number(self): - """Returns the serial number of the device.""" - return self._send_text_command(b'$serlnum?').rstrip('\r\n') - def get_glucose_unit(self): """Returns the glucose unit of the device.""" return common.UNIT_MGDL @@ -58,8 +50,8 @@ class Device(freestyle.FreeStyleHidDevice): if not record or record[0] != _TYPE_GLUCOSE_READING: continue - # Build a _NeoReading object by parsing each of the entries in the - # CSV as integers. + # Build a _reading object by parsing each of the entries in the CSV + # as integers. raw_reading = _NeoReading._make([int(v) for v in record]) timestamp = datetime.datetime( diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py index b6dce38..9857086 100644 --- a/glucometerutils/support/freestyle.py +++ b/glucometerutils/support/freestyle.py @@ -152,6 +152,14 @@ class FreeStyleHidDevice(object): # Some of the commands are also shared across devices that use this HID # protocol, but not many. Only provide here those that do seep to change # between them. + def _get_version(self): + """Return the software version of the device.""" + return self._send_text_command(b'$swver?').rstrip('\r\n') + + def get_serial_number(self): + """Returns the serial number of the device.""" + return self._send_text_command(b'$serlnum?').rstrip('\r\n') + def get_datetime(self): """Gets the date and time as reported by the device. -- cgit v1.2.3