Commit d3a0f87e authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Handle in and out parameters for procedure calls

parent 8b530c3b
......@@ -16,7 +16,7 @@
__author__ = "Maxime Perrotin"
__license__ = "LGPLv3"
__version__ = "1.0.2"
__version__ = "1.0.3"
__url__ = "http://taste.tuxfamily.org"
import sys
......
......@@ -632,11 +632,29 @@ class sdlHandler(QObject):
as_bytes.contents[idx])
setter = getattr(ASN1.DV, "SetDataFor_{}".format(typename))
setter(asn1_instance._ptr, swig_ptr)
gser = asn1_instance.GSER()
print 'Input param:', gser
interface['in'].append((spec, asn1_instance))
else:
interface['out'].append((spec, as_bytes, asn1_instance))
# HERE: make the function call
#spec_in, asn1_inst_in = interface['in'][0]
#spec_out, as_bytes, asn1_inst_out = interface['out'][0]
#asn1_inst_out.Set(asn1_inst_in.Get() + 1)
# Copy the OUT parameters back from SWIG to ctypes
for spec, as_bytes, asn1_instance in interface['out']:
# Create new SWIG byte array
swig_ptr = ASN1.DV.new_byte_SWIG_PTR(len(as_bytes.contents))
typename = spec['type'].ReferencedTypeName.replace('-', '_')
setter = getattr(ASN1.DV, "SetDataFor_{}".format(typename))
setter(swig_ptr, asn1_instance._ptr)
for idx in xrange(len(as_bytes.contents)):
as_bytes.contents[idx] = \
ASN1.DV.byte_SWIG_PTR_getitem(swig_ptr, idx)
# At the end, delete allocated buffers
for _, asn1_instance in interface['in']:
del(asn1_instance)
for _, _, asn1_instance in interface['out']:
del(asn1_instance)
def set_timer(self, name, duration):
''' Callback function when the SDL model sets a timer '''
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment