From de514133cec8d12906f19c868542b7530058a0c1 Mon Sep 17 00:00:00 2001 From: Aleksander Morgado Date: Tue, 22 May 2012 16:55:01 +0200 Subject: [PATCH] qmi-codegen: use a `common-ref' field to specify common dictionaries, like TLVs --- build-aux/qmi-codegen/Container.py | 6 +++--- data/qmi-common.json | 20 ++++++++++---------- data/qmi-service-ctl.json | 12 ++++-------- data/qmi-service-dms.json | 3 +-- data/qmi-service-wds.json | 15 +++++---------- 5 files changed, 23 insertions(+), 33 deletions(-) diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py index 8250bcd..fe81c28 100644 --- a/build-aux/qmi-codegen/Container.py +++ b/build-aux/qmi-codegen/Container.py @@ -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) diff --git a/data/qmi-common.json b/data/qmi-common.json index 6087534..9fed090 100644 --- a/data/qmi-common.json +++ b/data/qmi-common.json @@ -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" } ] } ] diff --git a/data/qmi-service-ctl.json b/data/qmi-service-ctl.json index 0bf182d..018e21b 100644 --- a/data/qmi-service-ctl.json +++ b/data/qmi-service-ctl.json @@ -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" } ] } ] diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json index 6d3892b..d02ea43 100644 --- a/data/qmi-service-dms.json +++ b/data/qmi-service-dms.json @@ -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", diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json index 1f5bceb..a6722b0 100644 --- a/data/qmi-service-wds.json +++ b/data/qmi-service-wds.json @@ -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",