qmi-codegen: use a `common-ref' field to specify common dictionaries, like TLVs

This commit is contained in:
Aleksander Morgado 2012-05-22 16:55:01 +02:00
parent 5ee73a0f3e
commit de514133ce
5 changed files with 23 additions and 33 deletions

View File

@ -52,10 +52,10 @@ class Container:
# First, look for references to common types
for field_dictionary in dictionary:
if field_dictionary['type'] == 'common-TLV':
if 'common-ref' in field_dictionary:
for common in common_objects_dictionary:
if common['name'] == field_dictionary['name'] and \
common['type'] == 'TLV':
if common['type'] == 'TLV' and \
common['common-ref'] == field_dictionary['common-ref']:
# Replace the reference with the actual common dictionary
dictionary.remove(field_dictionary)
dictionary.append(common)

View File

@ -1,12 +1,12 @@
[
{ "name" : "Result",
"id" : "0x02",
"mandatory" : "yes",
"type" : "TLV",
"format" : "struct",
"contents" : [ { "name" : "Error Status",
"type" : "guint16" },
{ "name" : "Error Code",
"type" : "guint16" } ] }
{ "common-ref" : "Operation Result",
"name" : "Result",
"id" : "0x02",
"mandatory" : "yes",
"type" : "TLV",
"format" : "struct",
"contents" : [ { "name" : "Error Status",
"type" : "guint16" },
{ "name" : "Error Code",
"type" : "guint16" } ] }
]

View File

@ -10,8 +10,7 @@
"type" : "Message",
"service" : "CTL",
"id" : "0x0021",
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Service list",
"id" : "0x01",
"mandatory" : "yes",
@ -38,8 +37,7 @@
"mandatory" : "yes",
"type" : "TLV",
"format" : "guint8" } ],
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Allocation Info",
"id" : "0x01",
"mandatory" : "yes",
@ -66,8 +64,7 @@
"type" : "guint8" },
{ "name" : "Cid",
"type" : "guint8" } ] } ],
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Release Info",
"id" : "0x01",
"mandatory" : "yes",
@ -85,6 +82,5 @@
"type" : "Message",
"service" : "CTL",
"id" : "0x0027",
"output" : [ { "name" : "Result",
"type" : "common-TLV" } ] }
"output" : [ { "common-ref" : "Operation Result" } ] }
]

View File

@ -10,8 +10,7 @@
"type" : "Message",
"service" : "DMS",
"id" : "0x0025",
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Esn",
"id" : "0x10",
"mandatory" : "no",

View File

@ -25,8 +25,7 @@
"mandatory" : "no",
"type" : "TLV",
"format" : "string" } ],
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Packet Data Handle",
"id" : "0x01",
"mandatory" : "yes",
@ -71,15 +70,13 @@
"mandatory" : "yes",
"type" : "TLV",
"format" : "guint32" } ],
"output" : [ { "name" : "Result",
"type" : "common-TLV" } ] },
"output" : [ { "common-ref" : "Operation Result" } ] },
{ "name" : "Get Packet Service Status",
"type" : "Message",
"service" : "WDS",
"id" : "0x0022",
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Connection Status",
"id" : "0x01",
"mandatory" : "yes",
@ -93,8 +90,7 @@
"type" : "Message",
"service" : "WDS",
"id" : "0x0044",
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Current",
"id" : "0x01",
"mandatory" : "yes",
@ -125,8 +121,7 @@
"type" : "Message",
"service" : "WDS",
"id" : "0x0037",
"output" : [ { "name" : "Result",
"type" : "common-TLV" },
"output" : [ { "common-ref" : "Operation Result" },
{ "name" : "Current",
"id" : "0x01",
"mandatory" : "yes",