Python bindings

Aleksander Morgado aleksander at lanedo.com
Thu Nov 15 01:18:00 PST 2012


>>>>> 	Thanks, I'm getting further now. Seems I have to fix some missing
>>>>>
>>>>> annotations now. I'll send patches later.
>>>>
>>>> Great!
>>>
>>> Hi Aleksander,
>>>
>>> 	I sent the patches, can you check patches 2 and 3 before applying, as I'm
>>>
>>> not totally confident I got the modes and value correct?
>>
>> I'll take a look at them, but I hope Dan can take a quick look at them
>> too; I'm not expert in this area.
>>
>> Just wondering, given you didn't change the autogenerated code, does it
>> mean that the introspection tags in there are actually all ok?
> 
> Hi Aleksander,
> 	The gir scanner didn't complain about anything other than the ones I 
> changed in the patches 2 / 3. As yet I haven't tested in Python, except for 
> basic import. This is mainly due to my lack of knowledge on libqmi around 
> what's needed to do a simple call like get manufacturer or model etc.
> 


For a simple call like Get Manufacturer, see e.g:
http://www.lanedo.com/~aleksander/libqmi/html/libqmi-glib-DMS-Get-Manufacturer.html

So the flow would be:
 * Create a QmiDevice.
 * Request to allocate a QmiClient for service QMI_CLIENT_DMS.
 * Call the get_manufacturer() method in the QmiClientDms.
 * Get the response with the output bundle in get_manufacturer_finish().
 * Check about errors in the bundle with output_get_result().
 * Get the final string if no errors with output_get_manufacturer().

For each async operation, both the call and finish() use bundles to pack
all possible input or output TLVs, so the bundles will also need proper
introspection data.

I guess the same flow would apply in the case of a Python client. From
what I can tell, the generated sources need additional annotations for a
proper introspection (think I added some I knew of, but probably not
all); or you won't be able to run the previous flow.

I would suggest to play with all this first, including:
 * operations that need TLVs in output bundles
 * operations that need TLVs in input bundles
 * operations with different input/output types being passed (e.g. with
integers, strings)
 * operations with different containers (e.g. structs, arrays)

-- 
Aleksander


More information about the libqmi-devel mailing list