diff --git a/decocare/commands.py b/decocare/commands.py index 24d6456..2e173fe 100644 --- a/decocare/commands.py +++ b/decocare/commands.py @@ -12,8 +12,8 @@ class BadResponse (Exception): Implementation and decoding of lots of commands. Each command inherits from :py:`BaseCommand`, which takes care of the -basic logic for informing the stick if we have recieved all the data -we expect to recieve. +basic logic for informing the stick if we have received all the data +we expect to receive. Many commands are supported by Medtronic but not listed here. Examples would include setting profiles and rates. @@ -274,7 +274,7 @@ class TempBasal(PumpCommand): def getData(self): status = { 0: 'absolute' } received = True if (len(self.data) > 0 and self.data[0] is 0) else False - return dict(recieved=received, temp=status.get(self.params[0], 'percent')) + return dict(received=received, temp=status.get(self.params[0], 'percent')) @classmethod def Program (klass, rate=None, duration=None, temp=None, **kwds): assert duration % 30 is 0, "duration {0} is not a whole multiple of 30".format(duration) @@ -308,7 +308,7 @@ class SetSuspend(PumpCommand): def getData(self): status = { 0: 'resumed', 1: 'suspended' } received = True if self.data[0] is 0 else False - return dict(recieved=received, status=status.get(self.params[0])) + return dict(received=received, status=status.get(self.params[0])) class PumpSuspend(SetSuspend): descr = "Suspend pump" @@ -475,8 +475,13 @@ class Bolus (PumpCommand): descr = "Bolus" params = [ ] def getData(self): - received = True if self.data[0] is 0x0c else False - return dict(recieved=received, _type='BolusRequest') + # received = True if self.data[0] is 0x0c else False + received = False + if bytearray(64) == self.data: + received = True + if len(self.data) and self.data[-1] == 0x0c: + received = True + return dict(received=received, _type='BolusRequest', raw=str(self.data).encode('hex')) class ReadErrorStatus(PumpCommand): diff --git a/decocare/models/__init__.py b/decocare/models/__init__.py index 25ca3d8..0048c72 100644 --- a/decocare/models/__init__.py +++ b/decocare/models/__init__.py @@ -220,7 +220,7 @@ def fmt_bolus_params (self, units): def set_temp_basal (self, rate=None, duration=None, temp=None, **kwds): basals = dict(rate=rate, duration=duration, temp=temp) result = self._set_temp_basal(**basals) - if not result.get('recieved'): + if not result.get('received'): result.update(requested=basals) result.update(**self.read_temp_basal( )) return result diff --git a/decocare/stick.py b/decocare/stick.py index d12731a..334a83d 100755 --- a/decocare/stick.py +++ b/decocare/stick.py @@ -38,7 +38,7 @@ class StickCommand(object): associated with the opcode. Altogether, the suite of opcodes that the stick responds to allows you to debug and track all packets you are sending/receiving plus - allows you to send recieve commands to the pump, by formatting your + allows you to send receive commands to the pump, by formatting your message into payloads with opcodes, and then letting the stick work on what you've given it. It's kind of like a modem with this funky binary interface and 64 byte payloads. diff --git a/setup.py b/setup.py index 237a01b..20efa27 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ def readme(): return f.read() setup(name='decocare', - version='0.0.32-dev', # http://semver.org/ + version='0.1.0-dev', # http://semver.org/ description='Audit, inspect, and command MM insulin pumps.', long_description=readme(), author="Ben West",