]> sigrok.org Git - libsigrokdecode.git/blobdiff - decoders/dcf77/dcf77.py
srd: Move all protocol docs to __init__.py files.
[libsigrokdecode.git] / decoders / dcf77 / dcf77.py
index 48b3bba174c7bc4c4b555c685612409b2b2e45ba..ab600eddff400b60ae0fab78c6bb3d8a35de67f5 100644 (file)
 ## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 ##
 
-#
 # DCF77 protocol decoder
-#
-# More information:
-# http://en.wikipedia.org/wiki/DCF77
-#
-
-#
-# Protocol output format:
-# TODO
-#
 
 import sigrokdecode as srd
 import calendar
@@ -45,6 +35,7 @@ def bcd2int(b):
     return (b & 0x0f) + ((b >> 4) * 10)
 
 class Decoder(srd.Decoder):
+    api_version = 1
     id = 'dcf77'
     name = 'DCF77'
     longname = 'DCF77 time protocol'
@@ -56,6 +47,9 @@ class Decoder(srd.Decoder):
     probes = [
         {'id': 'data', 'name': 'DATA', 'desc': 'DATA line'},
     ]
+    optional_probes = [
+        {'id': 'pon', 'name': 'PON', 'desc': 'TODO'},
+    ]
     options = {}
     annotations = [
         # ANN_ASCII
@@ -210,7 +204,7 @@ class Decoder(srd.Decoder):
             raise Exception('Invalid DCF77 bit: %d' % c)
 
     def decode(self, ss, es, data):
-        for samplenum, (pon, val) in data: # FIXME
+        for samplenum, (val) in data: # TODO: Handle optional PON.
 
             self.samplenum += 1 # FIXME. Use samplenum. Off-by-one?
 
@@ -271,7 +265,7 @@ class Decoder(srd.Decoder):
                 self.state = WAIT_FOR_RISING_EDGE
 
             else:
-                raise Exception('Invalid state: %s' % self.state)
+                raise Exception('Invalid state: %d' % self.state)
 
             self.oldval = val