2323_new .argtypes = ()
2424_new .restype = QuircPointer
2525
26+
2627def new ():
2728 """Construct a new QR-code recognizer.
2829
@@ -38,6 +39,7 @@ def new():
3839_destroy .argtypes = (QuircPointer ,)
3940_destroy .restype = None
4041
42+
4143def destroy (structure ):
4244 """Destroy a QR-code recognizer.
4345
@@ -51,6 +53,7 @@ def destroy(structure):
5153_resize .argtypes = (QuircPointer , ctypes .c_int , ctypes .c_int )
5254_resize .restype = ctypes .c_int
5355
56+
5457def resize (structure , width , height ):
5558 """Resize the QR-code recognizer.
5659
@@ -66,6 +69,7 @@ def resize(structure, width, height):
6669_begin .argtypes = (QuircPointer , c_int_pointer , c_int_pointer )
6770_begin .restype = c_uint8_pointer
6871
72+
6973def begin (structure , width , height ):
7074 # TODO: docstring
7175 # TODO: parameter type check
@@ -76,6 +80,7 @@ def begin(structure, width, height):
7680_end .argtypes = (QuircPointer ,)
7781_end .restype = None
7882
83+
7984def end (structure ):
8085 # TODO: docstring
8186 # TODO: parameter type check
@@ -85,6 +90,7 @@ def end(structure):
8590_count .argtypes = (QuircPointer ,)
8691_count .restype = ctypes .c_int
8792
93+
8894def count (structure ):
8995 # TODO: docstring
9096 # TODO: parameter type check
@@ -95,18 +101,24 @@ def count(structure):
95101_extract .argtypes = (QuircPointer , ctypes .c_int , CodePointer )
96102_extract .restype = ctypes .c_int
97103
104+
98105def extract (structure , idx , code ):
99106 # TODO: doctring
100107 # TODO: parameter type check
101108 _extract (structure , idx , ctypes .byref (code ))
102109
110+
103111def _decode_errcheck (result , func , arguments ):
104112 if result :
105113 raise DecodeException (constants ._DECODE_ERRORS [result ])
106114
107115_decode = libquirc .quirc_decode
108116_decode .argtypes = (CodePointer , DataPointer )
109- _decode .restype = ctypes .c_int # TODO: return proper value
117+ _decode .restype = ctypes .c_int # TODO: return proper value
110118_decode .errcheck = _decode_errcheck
119+
120+
111121def decode (code , data ):
112- return _decode (ctypes .byref (code ), ctypes .byref (data ))
122+ # TODO: docstring
123+ # TODO: parameter type check
124+ return _decode (ctypes .byref (code ), ctypes .byref (data ))
0 commit comments