diff options
author | Uwe Hermann <uwe@hermann-uwe.de> | 2013-08-04 14:24:40 +0200 |
---|---|---|
committer | Uwe Hermann <uwe@hermann-uwe.de> | 2013-09-02 09:05:01 +0200 |
commit | 6bbd2a8afb1daa76bc14866c2c1a345b1cea5e44 (patch) | |
tree | 0bd11d320c07096967edfe6c6a0a6335eecb2293 /decoders/pan1321 | |
parent | 5b2b0b0d88b19301e744e0a84df3bad91c5e28d5 (diff) | |
download | libsigrokdecode-6bbd2a8afb1daa76bc14866c2c1a345b1cea5e44.tar.gz libsigrokdecode-6bbd2a8afb1daa76bc14866c2c1a345b1cea5e44.zip |
pan1321: Add warnings for invalid protocol usage.
Diffstat (limited to 'decoders/pan1321')
-rw-r--r-- | decoders/pan1321/pd.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py index 241399f..50f5adf 100644 --- a/decoders/pan1321/pd.py +++ b/decoders/pan1321/pd.py @@ -41,6 +41,7 @@ class Decoder(srd.Decoder): annotations = [ ['Text (verbose)', 'Human-readable text (verbose)'], ['Text', 'Human-readable text'], + ['Warnings', 'Human-readable warnings'], ] def __init__(self, **kwargs): @@ -60,11 +61,19 @@ class Decoder(srd.Decoder): def handle_host_command(self, rxtx, s): if s.startswith('AT+JPRO'): p = s[s.find('=') + 1:] + if p not in ('0', '1'): + self.putx([2, ['Warning: Invalid JPRO parameter "%s"' % p]]) + self.cmd[rxtx] = '' + return onoff = 'off' if (p == '0') else 'on' x = 'Leaving' if (p == '0') else 'Entering' self.putx([0, ['%s production mode' % x]]) self.putx([1, ['Production mode = %s' % onoff]]) elif s.startswith('AT+JRES'): + if s != 'AT+JRES': # JRES has no params. + self.putx([2, ['Warning: Invalid JRES usage.']]) + self.cmd[rxtx] = '' + return self.putx([0, ['Triggering a software reset']]) self.putx([1, ['Reset']]) elif s.startswith('AT+JSEC'): |