# -*- coding: utf-8 -*- """Driver for FreeStyle Optium devices. Further information on the device protocol can be found at https://github.com/Flameeyes/glucometer-protocols/blob/master/abbott/freestyle-optium.md """ __author__ = 'Diego Elio Pettenò' __email__ = 'flameeyes@flameeyes.eu' __copyright__ = 'Copyright © 2016, Diego Elio Pettenò' __license__ = 'MIT' import datetime import re import sys import serial from glucometerutils import common from glucometerutils import exceptions class InvalidChecksum(exceptions.InvalidResponse): def __init__(self, expected, gotten): self.message = ( 'Response checksum not matching: %04x expected, %04x gotten' % (expected, gotten)) _CLOCK_RE = re.compile( r'^Clock:\t(?P[A-Z][a-z]{2}) (?P[0-9]{2}) (?P[0-9]{4})\t' r'(?P