qmi-codegen in libqmi-glib

Aleksander Morgado aleksander at lanedo.com
Wed May 23 13:21:24 PDT 2012


>>
>> I've been playing a bit more with the idea of automatically generating
>> code for message handling from input JSON files, and got already
>> something working in the 'qmi-codegen' branch of my libqmi-glib tree:
>>   git://gitorious.org/lanedo/libqmi-glib.git
>>
>> The current set of supported messages are defined in the following JSON
>> files:
>>
>> https://gitorious.org/lanedo/libqmi-glib/blobs/qmi-codegen/data/qmi-common.json
>>
>> https://gitorious.org/lanedo/libqmi-glib/blobs/qmi-codegen/data/qmi-service-ctl.json
>>
>> https://gitorious.org/lanedo/libqmi-glib/blobs/qmi-codegen/data/qmi-service-dms.json
>>
>> https://gitorious.org/lanedo/libqmi-glib/blobs/qmi-codegen/data/qmi-service-wds.json
>>
>> And adding new messages should need, ideally, just updating these JSON
>> files. I guess the qmi-codegen will need updates from time to time when
>> new basic types are found in the QMI messages. Currently the following
>> types are supported:
>>  * integers (uint8/uint16/uint32/int8/int16/int32)
>>  * strings
>>  * structs with integer contents
>>  * arrays of structs
> 
> At some point we'll need unions too, where the member of the union
> that's actually used depends on a specific value from earlier in the
> struct.  That's how stuff like "get the access technology and status"
> works where you've got a big struct like:
> 
> struct {
>     bool 3gpp;  // true = 3gpp, false = 3gpp2
>     union {
>         struct {
>             uint mcc;
>             uint mnc;
>             uint lac;
>             uint cid;
>             enum rat_type;
>         } 3gpp;
>         struct {
>             bool is_1x_or_hdr;
>             union {
>                 struct {
>                     1x junk;
>                 } 1x;
>                 struct {
>                     evdo junk;
>                 } hdr;
>             } u2;
>         } 3gpp2;
>     } u;
> }
> 
> that's some evil stuff, but basically  normal protocol packet parsing :(
> Anyway, I do like the idea of doing this with JSON.  I despair of
> actually being able to use the Gobi database except for reference since
> generating the code out of them is horrendously complicated.


I'll check that message during the next days and also try to provide
codegen for it.

Still have other fixes in mind for it, but at least as it is now it
should be equivalent feature-wise to the master branch.

-- 
Aleksander


More information about the libqmi-devel mailing list