Skip to content

Commit

Permalink
Strip AT command result prefix when issued command ends with ? or % (#6)
Browse files Browse the repository at this point in the history
* Strip AT command result prefix when issued command ends with ? or %

* Simplify strip of characters from AT command result
  • Loading branch information
TomPethtel authored Jan 17, 2021
1 parent 7157d82 commit 99dde7a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions Hologram/Network/Modem/Modem.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,11 +737,14 @@ def test(self, cmd, expected=None, timeout=None, retries=DEFAULT_SERIAL_RETRIES)

#returns the raw result of a command, with the 'CMD: ' prefix stripped
def _basic_command(self, cmd, prefix=True):
base_cmd = cmd.rstrip('?%')
try:
ok, r = self.command(cmd)
if ok == ModemResult.OK:
if prefix and r.startswith(cmd+': '):
return r.lstrip(cmd + ': ')
elif prefix and r.startswith(base_cmd+': '):
return r.lstrip(base_cmd + ': ')
else:
return r
except AttributeError as e:
Expand Down

0 comments on commit 99dde7a

Please sign in to comment.