From: Uwe Hermann Date: Fri, 9 Aug 2013 18:17:03 +0000 (+0200) Subject: pan1321: Initial JSDA support. X-Git-Tag: libsigrokdecode-0.3.0~336 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=b1f2d25f16636caa9d6a8d0715c772040b3dc68c;p=libsigrokdecode.git pan1321: Initial JSDA support. --- diff --git a/decoders/pan1321/pd.py b/decoders/pan1321/pd.py index 7e3774e..a587388 100644 --- a/decoders/pan1321/pd.py +++ b/decoders/pan1321/pd.py @@ -83,6 +83,18 @@ class Decoder(srd.Decoder): return self.putx([0, ['Triggering a software reset']]) self.putx([1, ['Reset']]) + elif s.startswith('AT+JSDA'): + # AT+JSDA=l,d (l: length in bytes, d: data) + l, d = s[s.find('=') + 1:].split(',') + if not l.isnumeric(): + self.putx([2, ['Warning: Invalid data length "%s".' % l]]) + if int(l) != len(d): + self.putx([2, ['Warning: Data length mismatch (%d != %d).' % \ + (int(l), len(d))]]) + # TODO: Warn if length > MTU size (which is firmware-dependent). + b = ''.join(['%02x ' % ord(c) for c in d])[:-1] + self.putx([0, ['Sending %d data bytes: %s' % (int(l), b)]]) + self.putx([1, ['Send %d = %s' % (int(l), b)]]) elif s.startswith('AT+JSEC'): pin = s[-4:] self.putx([0, ['Host set the Bluetooth PIN to "' + pin + '"']])