Skip to content

Commit 99dde7a

Browse files
authored
Strip AT command result prefix when issued command ends with ? or % (#6)
* Strip AT command result prefix when issued command ends with ? or % * Simplify strip of characters from AT command result
1 parent 7157d82 commit 99dde7a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Hologram/Network/Modem/Modem.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -737,11 +737,14 @@ def test(self, cmd, expected=None, timeout=None, retries=DEFAULT_SERIAL_RETRIES)
737737

738738
#returns the raw result of a command, with the 'CMD: ' prefix stripped
739739
def _basic_command(self, cmd, prefix=True):
740+
base_cmd = cmd.rstrip('?%')
740741
try:
741742
ok, r = self.command(cmd)
742743
if ok == ModemResult.OK:
743744
if prefix and r.startswith(cmd+': '):
744745
return r.lstrip(cmd + ': ')
746+
elif prefix and r.startswith(base_cmd+': '):
747+
return r.lstrip(base_cmd + ': ')
745748
else:
746749
return r
747750
except AttributeError as e:

0 commit comments

Comments
 (0)