summaryrefslogtreecommitdiff
path: root/decoders/pan1321
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2013-08-09 20:17:03 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2013-09-02 09:05:02 +0200
commitb1f2d25f16636caa9d6a8d0715c772040b3dc68c (patch)
tree19138cfeac7131d997c69468e53f334a807addf3 /decoders/pan1321
parent2d3f496e293b85a1f702355bf7fd275ae2f31455 (diff)
downloadlibsigrokdecode-b1f2d25f16636caa9d6a8d0715c772040b3dc68c.tar.gz
libsigrokdecode-b1f2d25f16636caa9d6a8d0715c772040b3dc68c.zip
pan1321: Initial JSDA support.
Diffstat (limited to 'decoders/pan1321')
-rw-r--r--decoders/pan1321/pd.py12
1 files changed, 12 insertions, 0 deletions
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 + '"']])