From 2d365b8602ab29fcf83d223d067a291313b84f7f Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 25 Jan 2013 10:26:24 +1100 Subject: [PATCH] Allow non-default retry count. Somethings should never be retried if they fail - so allow that to be specified. Also switch from RESET to POWERDOWN to see if it helps. Signed-off-by: NeilBrown --- gsm/gsmd.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gsm/gsmd.py b/gsm/gsmd.py index 2af2c94..9d297f7 100644 --- a/gsm/gsmd.py +++ b/gsm/gsmd.py @@ -93,7 +93,7 @@ class AtAction(Task): not_ok = re.compile("^(ERROR|\+CM[SE] ERROR:)") def __init__(self, check = None, ok = None, record = None, at = None, timeout=None, handle = None, repeat = None, arg = None, - critical = True, noreply=None): + critical = True, noreply = None, retries = 5): Task.__init__(self, repeat) self.check = check self.okstr = ok @@ -102,6 +102,7 @@ class AtAction(Task): self.record = record self.at = at self.arg = arg + self.retries = retries self.timeout_time = timeout self.handle = handle self.critical = critical @@ -146,7 +147,7 @@ class AtAction(Task): pass def timeout(self, channel): - if channel.state['retries'] >= 5: + if channel.state['retries'] >= self.retries: if self.critical: channel.force_state('reset') channel.advance() @@ -547,7 +548,8 @@ control['flight'] = [ control['reset'] = [ # turning power off just kills everything!!! - AtAction(at='_ORESET', critical = False), + #AtAction(at='_ORESET', critical = False), + AtAction(at='$QCPWRDN', critical = False, retries = 0), PowerAction('reopen'), #PowerAction('off'), AtAction(at='E0', timeout=30000), @@ -701,7 +703,7 @@ control['dtmf'] = [ ] control['hangup'] = [ - AtAction(at='+CHUP'), + AtAction(at='+CHUP', critical=False, retries=0), ChangeStateAction('idle') ] -- 2.39.5