diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-19 12:02:05 +0200 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-09-19 12:06:28 +0200 |
commit | 201e0cea5fa9747ebd57e7da35c91f131d51bcf8 (patch) | |
tree | e983a4a2b81e29eca8b57a00f0dac5fcb179631d | |
parent | 7345ca6aaf57c39eda83650e5d7f87e2d66f5be3 (diff) |
qmi-codegen: for strings, use 'size-prefix-format' instead of 'length-prefix-size'
Use the new 'size-prefix-format' property to specify whether the length prefix
variable is a 'guint8' or a 'guint16'.
We therefore consolidate the way how this length prefix variable is specified in
both arrays and strings.
So, instead of:
"length-prefix-size" : "16"
We now just do:
"size-prefix-format" : "guint16"
-rw-r--r-- | build-aux/qmi-codegen/VariableString.py | 11 | ||||
-rw-r--r-- | data/qmi-service-pds.json | 2 | ||||
-rw-r--r-- | data/qmi-service-wds.json | 8 |
3 files changed, 12 insertions, 9 deletions
diff --git a/build-aux/qmi-codegen/VariableString.py b/build-aux/qmi-codegen/VariableString.py index 5be84e2..7e977c2 100644 --- a/build-aux/qmi-codegen/VariableString.py +++ b/build-aux/qmi-codegen/VariableString.py @@ -53,10 +53,13 @@ class VariableString(Variable): # length prefix if 'type' in dictionary and dictionary['type'] == 'TLV': self.length_prefix_size = 0 - elif 'length-prefix-size' in dictionary: - self.length_prefix_size = dictionary['length-prefix-size'] - if self.length_prefix_size not in ['8', '16']: - raise ValueError('Invalid length prefix size %s: not 8 or 16' % self.length_prefix_size) + elif 'size-prefix-format' in dictionary: + if dictionary['size-prefix-format'] == 'guint8': + self.length_prefix_size = 8 + elif dictionary['size-prefix-format'] == 'guint16': + self.length_prefix_size = 16 + else: + raise ValueError('Invalid size prefix format (%s): not guint8 or guint16' % dictionary['size-prefix-format']) else: # Default to UINT8 self.length_prefix_size = 8 diff --git a/data/qmi-service-pds.json b/data/qmi-service-pds.json index f8f1178..c87ce7a 100644 --- a/data/qmi-service-pds.json +++ b/data/qmi-service-pds.json @@ -173,7 +173,7 @@ { "name" : "NMEA", "format" : "string", // This was supposed to be only 1 byte for length, but it seems it's not - "length-prefix-size" : "16", + "size-prefix-format" : "guint16", "max-size" : "200" } ] }, { "name" : "Position Session Status", "id" : "0x12", diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json index dc2580d..d0d64ef 100644 --- a/data/qmi-service-wds.json +++ b/data/qmi-service-wds.json @@ -304,8 +304,8 @@ "type" : "TLV", "format" : "array", "array-element" : { "name" : "FQDN", - "length-prefix-size" : "16", - "format" : "string" }, + "format" : "string", + "size-prefix-format" : "guint16" }, "prerequisites" : [ { "common-ref" : "Success" } ] }, { "name" : "IPv6 Address", "id" : "0x25", @@ -359,8 +359,8 @@ "type" : "TLV", "format" : "array", "array-element" : { "name" : "Domain Name", - "length-prefix-size" : "16", - "format" : "string" }, + "format" : "string", + "size-prefix-format" : "guint16" }, "prerequisites" : [ { "common-ref" : "Success" } ] }, { "name" : "IP Family", "id" : "0x2B", |