Merge remote-tracking branch 'cros/upstream' into 'cros/master'

Change-Id: Ic94301549785204f75f930a24d38ce2d7e550f53
diff --git a/.gitignore b/.gitignore
index f136751..9f6c3a7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -54,6 +54,8 @@
 libqmi-glib/qmi-nas.c
 libqmi-glib/qmi-wms.h
 libqmi-glib/qmi-wms.c
+libqmi-glib/qmi-pds.h
+libqmi-glib/qmi-pds.c
 libqmi-glib/*.stamp
 
 libqmi-glib/test/.libs
diff --git a/TODO b/TODO
index aef401d..7f089f7 100644
--- a/TODO
+++ b/TODO
@@ -43,3 +43,5 @@
 
  * nas: Define the 'QmiNasRegistrationRejectCause' enum for the "Event Report"
    indication and "Get System Info" response.
+
+ * pds: Parse all possible TLVs in the Event Report indications
diff --git a/build-aux/qmi-codegen/Container.py b/build-aux/qmi-codegen/Container.py
index 3de932a..4b9e2f9 100644
--- a/build-aux/qmi-codegen/Container.py
+++ b/build-aux/qmi-codegen/Container.py
@@ -210,14 +210,13 @@
             '    g_return_if_fail (self != NULL);\n'
             '\n'
             '    if (g_atomic_int_dec_and_test (&self->ref_count)) {\n')
-        cfile.write(string.Template(template).substitute(translations))
 
         if self.fields is not None:
             for field in self.fields:
                 if field.variable is not None and field.variable.needs_dispose is True:
                     template += field.variable.build_dispose('        ', 'self->' + field.variable_name)
 
-        template = (
+        template += (
             '        g_slice_free (${camelcase}, self);\n'
             '    }\n'
             '}\n')
diff --git a/build-aux/qmi-codegen/Message.py b/build-aux/qmi-codegen/Message.py
index b5cf809..016c416 100644
--- a/build-aux/qmi-codegen/Message.py
+++ b/build-aux/qmi-codegen/Message.py
@@ -286,31 +286,36 @@
                 '{\n'
                 '    const gchar *tlv_type_str = NULL;\n'
                 '    gchar *translated_value;\n'
-                '\n'
-                '    if (!qmi_message_is_response (ctx->self)) {\n'
-                '        switch (type) {\n')
+                '\n')
 
-            if self.input is not None and self.input.fields is not None:
-                for field in self.input.fields:
-                    translations['underscore_field'] = utils.build_underscore_name(field.fullname)
-                    translations['field_enum'] = field.id_enum_name
-                    translations['field_name'] = field.name
-                    field_template = (
-                        '        case ${field_enum}:\n'
-                        '            tlv_type_str = "${field_name}";\n'
-                        '            translated_value = ${underscore_field}_get_printable (\n'
-                        '                                   ctx->self,\n'
-                        '                                   ctx->line_prefix);\n'
-                        '            break;\n')
-                    template += string.Template(field_template).substitute(translations)
+            if self.type == 'Message':
+                template += (
+                    '    if (!qmi_message_is_response (ctx->self)) {\n'
+                    '        switch (type) {\n')
 
-            template += (
-                '        default:\n'
-                '            break;\n'
-                '        }\n'
-                '    } else {\n'
-                '        switch (type) {\n')
+                if self.input is not None and self.input.fields is not None:
+                    for field in self.input.fields:
+                        translations['underscore_field'] = utils.build_underscore_name(field.fullname)
+                        translations['field_enum'] = field.id_enum_name
+                        translations['field_name'] = field.name
+                        field_template = (
+                            '        case ${field_enum}:\n'
+                            '            tlv_type_str = "${field_name}";\n'
+                            '            translated_value = ${underscore_field}_get_printable (\n'
+                            '                                   ctx->self,\n'
+                            '                                   ctx->line_prefix);\n'
+                            '            break;\n')
+                        template += string.Template(field_template).substitute(translations)
 
+                template += (
+                    '        default:\n'
+                    '            break;\n'
+                    '        }\n'
+                    '    } else {\n')
+            else:
+                template += ('    {\n')
+
+            template += ('        switch (type) {\n')
             if self.output is not None and self.output.fields is not None:
                 for field in self.output.fields:
                     translations['underscore_field'] = utils.build_underscore_name(field.fullname)
diff --git a/build-aux/qmi-codegen/VariableArray.py b/build-aux/qmi-codegen/VariableArray.py
index 4911111..9a647bf 100644
--- a/build-aux/qmi-codegen/VariableArray.py
+++ b/build-aux/qmi-codegen/VariableArray.py
@@ -51,11 +51,12 @@
             self.array_element = VariableFactory.create_variable(dictionary['array-element'], '')
 
         # Load variable type for the array size prefix
-        if 'array-size' in dictionary:
-            # We do NOT allow 64-bit types as array sizes
-            if dictionary['array-size'] == 'guint64' or dictionary['array-size'] == 'gint64':
-                raise RuntimeError('Array size should not be given with a 64-bit value (unsupported)')
-            self.array_size_element = VariableFactory.create_variable(dictionary['array-size'], '')
+        if 'size-prefix-format' in dictionary:
+            # We do NOT allow 64-bit types as array sizes (GArray won't support them)
+            if dictionary['size-prefix-format'] not in [ 'guint8', 'guint16', 'guint32' ]:
+                raise ValueError('Invalid size prefix format (%s): not guint8 or guint16 or guint32' % dictionary['size-prefix-format'])
+            default_array_size = { 'format' : dictionary['size-prefix-format'] }
+            self.array_size_element = VariableFactory.create_variable(default_array_size, '')
         elif 'fixed-size' in dictionary:
             # fixed-size arrays have no size element, obviously
             self.fixed_size = dictionary['fixed-size']
@@ -113,36 +114,38 @@
     read every array element one by one.
     """
     def emit_buffer_read(self, f, line_prefix, variable_name, buffer_name, buffer_len):
+        common_var_prefix = utils.build_underscore_name(self.name)
         translations = { 'lp'             : line_prefix,
                          'private_format' : self.private_format,
                          'public_array_element_format' : self.array_element.public_format,
                          'underscore'     : self.clear_func_name(),
                          'variable_name'  : variable_name,
                          'buffer_name'    : buffer_name,
-                         'buffer_len'     : buffer_len }
+                         'buffer_len'     : buffer_len,
+                         'common_var_prefix' : common_var_prefix }
 
         template = (
             '${lp}{\n'
-            '${lp}    guint i;\n')
+            '${lp}    guint ${common_var_prefix}_i;\n')
         f.write(string.Template(template).substitute(translations))
 
         if self.fixed_size:
             translations['fixed_size'] = self.fixed_size
 
             template = (
-                '${lp}    guint16 n_items = ${fixed_size};\n'
+                '${lp}    guint16 ${common_var_prefix}_n_items = ${fixed_size};\n'
                 '\n')
             f.write(string.Template(template).substitute(translations))
         else:
             translations['array_size_element_format'] = self.array_size_element.public_format
 
             template = (
-                '${lp}    ${array_size_element_format} n_items;\n'
+                '${lp}    ${array_size_element_format} ${common_var_prefix}_n_items;\n'
                 '\n'
                 '${lp}    /* Read number of items in the array */\n')
             f.write(string.Template(template).substitute(translations))
 
-            self.array_size_element.emit_buffer_read(f, line_prefix + '    ', 'n_items', buffer_name, buffer_len)
+            self.array_size_element.emit_buffer_read(f, line_prefix + '    ', common_var_prefix + '_n_items', buffer_name, buffer_len)
 
         template = (
             '\n'
@@ -150,7 +153,7 @@
             '${lp}        FALSE,\n'
             '${lp}        FALSE,\n'
             '${lp}        sizeof (${public_array_element_format}),\n'
-            '${lp}        (guint)n_items);\n'
+            '${lp}        (guint)${common_var_prefix}_n_items);\n'
             '\n')
 
         if self.array_element.needs_dispose == True:
@@ -160,15 +163,15 @@
                 '\n')
 
         template += (
-            '${lp}    for (i = 0; i < n_items; i++) {\n'
-            '${lp}        ${public_array_element_format} aux;\n'
+            '${lp}    for (${common_var_prefix}_i = 0; ${common_var_prefix}_i < ${common_var_prefix}_n_items; ${common_var_prefix}_i++) {\n'
+            '${lp}        ${public_array_element_format} ${common_var_prefix}_aux;\n'
             '\n')
         f.write(string.Template(template).substitute(translations))
 
-        self.array_element.emit_buffer_read(f, line_prefix + '        ', 'aux', buffer_name, buffer_len)
+        self.array_element.emit_buffer_read(f, line_prefix + '        ', common_var_prefix + '_aux', buffer_name, buffer_len)
 
         template = (
-            '${lp}        g_array_insert_val (${variable_name}, i, aux);\n'
+            '${lp}        g_array_insert_val (${variable_name}, ${common_var_prefix}_i, ${common_var_prefix}_aux);\n'
             '${lp}    }\n'
             '${lp}}\n')
         f.write(string.Template(template).substitute(translations))
@@ -179,34 +182,36 @@
     write every array element one by one.
     """
     def emit_buffer_write(self, f, line_prefix, variable_name, buffer_name, buffer_len):
+        common_var_prefix = utils.build_underscore_name(self.name)
         translations = { 'lp'             : line_prefix,
                          'variable_name'  : variable_name,
                          'buffer_name'    : buffer_name,
-                         'buffer_len'     : buffer_len }
+                         'buffer_len'     : buffer_len,
+                         'common_var_prefix' : common_var_prefix }
 
         template = (
             '${lp}{\n'
-            '${lp}    guint i;\n')
+            '${lp}    guint ${common_var_prefix}_i;\n')
         f.write(string.Template(template).substitute(translations))
 
         if self.fixed_size == 0:
             translations['array_size_element_format'] = self.array_size_element.private_format
 
             template = (
-                '${lp}    ${array_size_element_format} n_items;\n'
+                '${lp}    ${array_size_element_format} ${common_var_prefix}_n_items;\n'
                 '\n'
                 '${lp}    /* Write the number of items in the array first */\n'
-                '${lp}    n_items = (${array_size_element_format}) ${variable_name}->len;\n')
+                '${lp}    ${common_var_prefix}_n_items = (${array_size_element_format}) ${variable_name}->len;\n')
             f.write(string.Template(template).substitute(translations))
 
-            self.array_size_element.emit_buffer_write(f, line_prefix + '    ', 'n_items', buffer_name, buffer_len)
+            self.array_size_element.emit_buffer_write(f, line_prefix + '    ', common_var_prefix + '_n_items', buffer_name, buffer_len)
 
         template = (
             '\n'
-            '${lp}    for (i = 0; i < ${variable_name}->len; i++) {\n')
+            '${lp}    for (${common_var_prefix}_i = 0; ${common_var_prefix}_i < ${variable_name}->len; ${common_var_prefix}_i++) {\n')
         f.write(string.Template(template).substitute(translations))
 
-        self.array_element.emit_buffer_write(f, line_prefix + '        ', 'g_array_index (' + variable_name + ', ' + self.array_element.public_format + ', i)', buffer_name, buffer_len)
+        self.array_element.emit_buffer_write(f, line_prefix + '        ', 'g_array_index (' + variable_name + ', ' + self.array_element.public_format + ',' + common_var_prefix + '_i)', buffer_name, buffer_len)
 
         template = (
             '${lp}    }\n'
@@ -219,40 +224,42 @@
     brackets
     """
     def emit_get_printable(self, f, line_prefix, printable, buffer_name, buffer_len):
+        common_var_prefix = utils.build_underscore_name(self.name)
         translations = { 'lp'          : line_prefix,
                          'printable'   : printable,
                          'buffer_name' : buffer_name,
-                         'buffer_len'  : buffer_len }
+                         'buffer_len'  : buffer_len,
+                         'common_var_prefix' : common_var_prefix }
 
         template = (
             '${lp}{\n'
-            '${lp}    guint i;\n')
+            '${lp}    guint ${common_var_prefix}_i;\n')
         f.write(string.Template(template).substitute(translations))
 
         if self.fixed_size:
             translations['fixed_size'] = self.fixed_size
 
             template = (
-                '${lp}    guint16 n_items = ${fixed_size};\n'
+                '${lp}    guint16 ${common_var_prefix}_n_items = ${fixed_size};\n'
                 '\n')
             f.write(string.Template(template).substitute(translations))
         else:
             translations['array_size_element_format'] = self.array_size_element.public_format
 
             template = (
-                '${lp}    ${array_size_element_format} n_items;\n'
+                '${lp}    ${array_size_element_format} ${common_var_prefix}_n_items;\n'
                 '\n'
                 '${lp}    /* Read number of items in the array */\n')
             f.write(string.Template(template).substitute(translations))
 
-            self.array_size_element.emit_buffer_read(f, line_prefix + '    ', 'n_items', buffer_name, buffer_len)
+            self.array_size_element.emit_buffer_read(f, line_prefix + '    ', common_var_prefix + '_n_items', buffer_name, buffer_len)
 
         template = (
             '\n'
             '${lp}    g_string_append (${printable}, "{");\n'
             '\n'
-            '${lp}    for (i = 0; i < n_items; i++) {\n'
-            '${lp}        g_string_append_printf (${printable}, " [%u] = \'", i);\n')
+            '${lp}    for (${common_var_prefix}_i = 0; ${common_var_prefix}_i < ${common_var_prefix}_n_items; ${common_var_prefix}_i++) {\n'
+            '${lp}        g_string_append_printf (${printable}, " [%u] = \'", ${common_var_prefix}_i);\n')
         f.write(string.Template(template).substitute(translations))
 
         self.array_element.emit_get_printable(f, line_prefix + '        ', printable, buffer_name, buffer_len);
@@ -370,5 +377,6 @@
                          'variable_name' : variable_name }
 
         template = (
-            '${lp}g_array_unref (${variable_name});\n')
+            '${lp}if (${variable_name})\n'
+            '${lp}    g_array_unref (${variable_name});\n')
         return string.Template(template).substitute(translations)
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 @@
             # 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/build-aux/qmi-codegen/utils.py b/build-aux/qmi-codegen/utils.py
index 5f37d31..a2a94db 100644
--- a/build-aux/qmi-codegen/utils.py
+++ b/build-aux/qmi-codegen/utils.py
@@ -74,8 +74,8 @@
     if service != 'CTL':
         template += (
             "#include \"qmi-enums-${service}.h\"\n")
-    # CTL, WDS and WMS don't have flags64
-    if service != 'CTL' and service != 'WDS' and service != 'WMS':
+    # CTL, WDS, WMS and PDS don't have flags64
+    if service != 'CTL' and service != 'WDS' and service != 'WMS' and service != 'PDS':
         template += (
             "#include \"qmi-flags64-${service}.h\"\n")
     template += (
diff --git a/data/Makefile.am b/data/Makefile.am
index a9890e8..458dda5 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -6,4 +6,5 @@
 	qmi-service-dms.json \
 	qmi-service-wds.json \
 	qmi-service-nas.json \
-	qmi-service-wms.json
+	qmi-service-wms.json \
+	qmi-service-pds.json
diff --git a/data/qmi-service-dms.json b/data/qmi-service-dms.json
index 9b407d2..f14685a 100644
--- a/data/qmi-service-dms.json
+++ b/data/qmi-service-dms.json
@@ -668,14 +668,14 @@
      "id"      : "0x0037",
      "version" : "1.6",
      "output"  : [  { "common-ref" : "Operation Result" },
-                    { "name"          : "User Data",
-                      "id"            : "0x01",
-                      "mandatory"     : "yes",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "format" : "guint8" },
-                      "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+                    { "name"               : "User Data",
+                      "id"                 : "0x01",
+                      "mandatory"          : "yes",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "format" : "guint8" },
+                      "prerequisites"      : [ { "common-ref" : "Success" } ] } ] },
 
   // *********************************************************************************
   {  "name"    : "Write User Data",
@@ -683,14 +683,14 @@
      "service" : "DMS",
      "id"      : "0x0038",
      "version" : "1.6",
-     "input"   : [  { "name"          : "User Data",
-                      "id"            : "0x01",
-                      "mandatory"     : "yes",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "format" : "guint8" },
-                      "prerequisites": [ { "common-ref" : "Success" } ] } ],
+     "input"   : [  { "name"               : "User Data",
+                      "id"                 : "0x01",
+                      "mandatory"          : "yes",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "format" : "guint8" },
+                      "prerequisites"      : [ { "common-ref" : "Success" } ] } ],
      "output"  : [  { "common-ref" : "Operation Result" } ] },
 
   // *********************************************************************************
@@ -700,14 +700,14 @@
      "id"      : "0x0039",
      "version" : "1.6",
      "output"  : [  { "common-ref" : "Operation Result" },
-                    { "name"          : "ERI File",
-                      "id"            : "0x01",
-                      "mandatory"     : "yes",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "format" : "guint8" },
-                      "prerequisites": [ { "common-ref" : "Success" } ] } ] },
+                    { "name"               : "ERI File",
+                      "id"                 : "0x01",
+                      "mandatory"          : "yes",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "format" : "guint8" },
+                      "prerequisites"      : [ { "common-ref" : "Success" } ] } ] },
 
   // *********************************************************************************
   {  "name"    : "Restore Factory Defaults",
diff --git a/data/qmi-service-nas.json b/data/qmi-service-nas.json
index 7e34643..d76b73c 100644
--- a/data/qmi-service-nas.json
+++ b/data/qmi-service-nas.json
@@ -157,22 +157,21 @@
                                       { "name"          : "Radio Interface",
                                         "format"        : "gint8",
                                         "public-format" : "QmiNasRadioInterface" } ] },
-                    { "name"          : "RF Band Information",
-                      "id"            : "0x11",
-                      "mandatory"     : "no",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint8" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" },
-                                                         { "name"          : "Active Band Class",
-                                                           "format"        : "guint16",
-                                                           "public-format" : "QmiNasActiveBand" },
-                                                         { "name"          : "Active Channel",
-                                                           "format"        : "guint16" } ] } },
+                    { "name"               : "RF Band Information",
+                      "id"                 : "0x11",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" },
+                                                              { "name"          : "Active Band Class",
+                                                                "format"        : "guint16",
+                                                                "public-format" : "QmiNasActiveBand" },
+                                                              { "name"          : "Active Channel",
+                                                                "format"        : "guint16" } ] } },
                     { "name"      : "Registration Reject Reason",
                       "id"        : "0x12",
                       "mandatory" : "no",
@@ -367,45 +366,45 @@
                                         "format"        : "gint8",
                                         "public-format" : "QmiNasRadioInterface" } ],
                       "prerequisites": [ { "common-ref" : "Success" } ] },
-                    { "name"          : "Strength List",
-                      "id"            : "0x10",
-                      "mandatory"     : "no",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name" : "Strength",
-                                                           "format" : "gint8" },
-                                                         { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" } ] } },
-                    { "name"          : "RSSI List",
-                      "id"            : "0x11",
-                      "mandatory"     : "no",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "RSSI",
-                                                           "format" : "guint8" },
-                                                         { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" } ] } },
-                    { "name"          : "ECIO List",
-                      "id"            : "0x12",
-                      "mandatory"     : "no",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "ECIO",
-                                                           "format" : "guint8" },
-                                                         { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" } ] } },
+                    { "name"               : "Strength List",
+                      "id"                 : "0x10",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name" : "Strength",
+                                                                "format" : "gint8" },
+                                                              { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" } ] } },
+                    { "name"               : "RSSI List",
+                      "id"                 : "0x11",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "RSSI",
+                                                                "format" : "guint8" },
+                                                              { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" } ] } },
+                    { "name"               : "ECIO List",
+                      "id"                 : "0x12",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "ECIO",
+                                                                "format" : "guint8" },
+                                                              { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" } ] } },
                     { "name"      : "IO",
                       "id"        : "0x13",
                       "mandatory" : "no",
@@ -417,19 +416,19 @@
                       "type"          : "TLV",
                       "format"        : "guint8",
                       "public-format" : "QmiNasEvdoSinrLevel" },
-                    { "name"      : "Error Rate List",
-                      "id"        : "0x15",
-                      "mandatory" : "no",
-                      "type"      : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "Rate",
-                                                           "format" : "guint16" },
-                                                         { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" } ] } },
+                    { "name"               : "Error Rate List",
+                      "id"                 : "0x15",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "Rate",
+                                                                "format" : "guint16" },
+                                                              { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" } ] } },
                     { "name"      : "RSRQ",
                       "id"        : "0x16",
                       "mandatory" : "no",
@@ -464,53 +463,53 @@
                       "format"        : "guint8",
                       "public-format" : "QmiNasNetworkScanType" } ],
      "output"  : [  { "common-ref" : "Operation Result" },
-                    { "name"      : "Network Information",
-                      "id"        : "0x10",
-                      "mandatory" : "no",
-                      "type"      : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "MCC",
-                                                           "format" : "guint16" },
-                                                         { "name"   : "MNC",
-                                                           "format" : "guint16" },
-                                                         { "name"          : "Network Status",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiNasNetworkStatus" },
-                                                         { "name"   : "Description",
-                                                           "format" : "string" } ] } },
-                    { "name"      : "Radio Access Technology",
-                      "id"        : "0x11",
-                      "mandatory" : "no",
-                      "type"      : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "MCC",
-                                                           "format" : "guint16" },
-                                                         { "name"   : "MNC",
-                                                           "format" : "guint16" },
-                                                         { "name"          : "Radio Interface",
-                                                           "format"        : "gint8",
-                                                           "public-format" : "QmiNasRadioInterface" } ] } },
-                    { "name"      : "MNC PCS Digit Include Status",
-                      "id"        : "0x12",
-                      "mandatory" : "no",
-                      "type"      : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "MCC",
-                                                           "format" : "guint16" },
-                                                         { "name"   : "MNC",
-                                                           "format" : "guint16" },
-                                                         { "name"          : "Includes PCS Digit",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "gboolean" } ] } } ] },
+                    { "name"               : "Network Information",
+                      "id"                 : "0x10",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "MCC",
+                                                                "format" : "guint16" },
+                                                              { "name"   : "MNC",
+                                                                "format" : "guint16" },
+                                                              { "name"          : "Network Status",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiNasNetworkStatus" },
+                                                              { "name"   : "Description",
+                                                                "format" : "string" } ] } },
+                    { "name"               : "Radio Access Technology",
+                      "id"                 : "0x11",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "MCC",
+                                                                "format" : "guint16" },
+                                                              { "name"   : "MNC",
+                                                                "format" : "guint16" },
+                                                              { "name"          : "Radio Interface",
+                                                                "format"        : "gint8",
+                                                                "public-format" : "QmiNasRadioInterface" } ] } },
+                    { "name"               : "MNC PCS Digit Include Status",
+                      "id"                 : "0x12",
+                      "mandatory"          : "no",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "MCC",
+                                                                "format" : "guint16" },
+                                                              { "name"   : "MNC",
+                                                                "format" : "guint16" },
+                                                              { "name"          : "Includes PCS Digit",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "gboolean" } ] } } ] },
 
   // *********************************************************************************
   {  "name"    : "Initiate Network Register",
@@ -1113,7 +1112,6 @@
                       "mandatory"     : "no",
                       "type"          : "TLV",
                       "format"        : "array",
-                      "array-size"    : { "format" : "guint8" },
                       "array-element" : { "name"     : "Element",
                                           "format"   : "struct",
                                           "contents" : [ { "name"          : "Radio Interface",
diff --git a/data/qmi-service-pds.json b/data/qmi-service-pds.json
new file mode 100644
index 0000000..c87ce7a
--- /dev/null
+++ b/data/qmi-service-pds.json
@@ -0,0 +1,330 @@
+
+[
+  // *********************************************************************************
+  {  "name"    : "PDS",
+     "type"    : "Service" },
+
+  // *********************************************************************************
+  {  "name"    : "QMI Client PDS",
+     "type"    : "Client" },
+
+  // *********************************************************************************
+  {  "name"    : "QMI Message PDS",
+     "type"    : "Message-ID-Enum" },
+
+  // *********************************************************************************
+  {  "name"    : "QMI Indication PDS",
+     "type"    : "Indication-ID-Enum" },
+
+  // *********************************************************************************
+  {  "name"    : "Reset",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0000",
+     "version" : "1.0",
+     "output"  : [ { "common-ref" : "Operation Result" } ] },
+
+  // *********************************************************************************
+  {  "name"    : "Set Event Report",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0001",
+     "version" : "1.0",
+     "input"   : [ { "name"          : "NMEA Position Reporting",
+                     "id"            : "0x10",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Extended NMEA Position Reporting",
+                     "id"            : "0x11",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Parsed Position Reporting",
+                     "id"            : "0x12",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "External XTRA Data Request Reporting",
+                     "id"            : "0x13",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "External Time Injection Request Reporting",
+                     "id"            : "0x14",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "External WIFI Position Request Reporting",
+                     "id"            : "0x15",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Satellite Information Reporting",
+                     "id"            : "0x16",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "VX Network Initiated Request Reporting",
+                     "id"            : "0x17",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "SUPL Network Initiated Prompt Reporting",
+                     "id"            : "0x18",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "UMTS CP Network Initiated Prompt Reporting",
+                     "id"            : "0x19",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "PDS Comm Event Reporting",
+                     "id"            : "0x1A",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Accelerometer Data Streaming Ready Reporting",
+                     "id"            : "0x1B",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Gyro Data Streaming Ready Reporting",
+                     "id"            : "0x1C",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Time Sync Request Reporting",
+                     "id"            : "0x1D",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Position Reliability Indicator Reporting",
+                     "id"            : "0x1E",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Sensor Data Usage Indicator Reporting",
+                     "id"            : "0x1F",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Time Source Information Reporting",
+                     "id"            : "0x20",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Heading Uncertainty Reporting",
+                     "id"            : "0x21",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "NMEA Debug Strings Reporting",
+                     "id"            : "0x22",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" },
+                   { "name"          : "Extended External XTRA Data Request Reporting",
+                     "id"            : "0x23",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "gboolean" } ],
+     "output"  : [ { "common-ref" : "Operation Result" } ] },
+
+  {  "name"    : "Event Report",
+     "type"    : "Indication",
+     "service" : "PDS",
+     "id"      : "0x0001",
+     "output"  : [ { "name"      : "NMEA Position",
+                     "id"        : "0x10",
+                     "mandatory" : "no",
+                     "type"      : "TLV",
+                     "format"    : "string",
+                     "max-size"  : "200" },
+                   { "name"      : "Extended NMEA Position",
+                     "id"        : "0x11",
+                     "mandatory" : "no",
+                     "type"      : "TLV",
+                     "format"    : "sequence",
+                     "contents"  : [ { "name"          : "Operation Mode",
+                                       "format"        : "gint8",
+                                       "public-format" : "QmiPdsOperationMode" },
+                                     { "name"     : "NMEA",
+                                       "format"   : "string",
+                                       // This was supposed to be only 1 byte for length, but it seems it's not
+                                       "size-prefix-format" : "guint16",
+                                       "max-size" : "200" } ] },
+                   { "name"          : "Position Session Status",
+                     "id"            : "0x12",
+                     "mandatory"     : "no",
+                     "type"          : "TLV",
+                     "format"        : "guint8",
+                     "public-format" : "QmiPdsPositionSessionStatus" } ] },
+
+                   // TODO: parse all TLVs of this indication
+                   // Reading gfloat/gdouble is still missing
+                   //{ "name"         : "Parsed Position",
+                   //  "id"           : "0x13",
+                   //  "mandatory"    : "no",
+                   //  "type"         : "TLV",
+                   //  "format"       : "sequence",
+                   //  "contents"     : [ { "name"   : "Valid Mask",
+                   //                       "format" : "gint8" },
+                   //                     { "name"     : "Timestamp Calendar",
+                   //                       "format"   : "struct",
+                   //                       "contents" : [ { "name"   : "Year",
+                   //                                        "format" : "guint16" },
+                   //                                      { "name"   : "Month",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Day Of Week",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Day of Month",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Hour",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Minute",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Second",
+                   //                                        "format" : "guint8" },
+                   //                                      { "name"   : "Millisecond",
+                   //                                        "format" : "guint16" } ] },
+                   //                     { "name"   : "Leap Seconds",
+                   //                       "format" : "guint8" },
+                   //                     { "name"   : "Timestamp UTC",
+                   //                       "format" : "guint64" },
+                   //                     { "name"   : "Time Uncertainty",
+                   //                       "format" : "guint32" },
+                   //                     { "name"   : "Latitude",
+                   //                       "format" : "gdouble" },
+                   //                     { "name"   : "Longitude",
+                   //                       "format" : "gdouble" },
+                   //                     { "name"   : "Altitude Ellipsoid",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Altitude Sea Level",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Speed",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Vertical Speed",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Heading",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Uncertainty Circular",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Uncertainty Ellipse Semi Major",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Uncertainty Ellipse Semi Minor",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Uncertainty Ellipse Orient Azimuth",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Vertical Uncertainty",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal Velocity Uncertainty",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Vertical Velocity Uncertainty",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal confidence",
+                   //                       "format" : "guint8" },
+                   //                     { "name"   : "Position DOP",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Horizontal DOP",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"   : "Vertical DOP",
+                   //                       "format" : "gfloat" },
+                   //                     { "name"          : "Operation Mode",
+                   //                       "format"        : "gint8",
+                   //                       "public-format" : "QmiPdsOperationMode" } ],
+                   //  "prerequisites": [ { "field"     : "Position Session Status",
+                   //                       "operation" : "<=",
+                   //                       "value"     : "QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS" } ] } ] }
+
+  // *********************************************************************************
+  {  "name"    : "Get GPS Service State",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0020",
+     "version" : "1.0",
+     "output"  : [ { "common-ref" : "Operation Result" },
+                   { "name"      : "State",
+                     "id"        : "0x01",
+                     "mandatory" : "yes",
+                     "type"      : "TLV",
+                     "format"    : "sequence",
+                     "contents"  : [ { "name"          : "GPS Service State",
+                                       "format"        : "guint8",
+                                       "public-format" : "gboolean" },
+                                     { "name"          : "Tracking Session State",
+                                       "format"        : "guint8",
+                                       "public-format" : "QmiPdsTrackingSessionState" } ],
+                     "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+  // *********************************************************************************
+  {  "name"    : "Set GPS Service State",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0021",
+     "version" : "1.0",
+     "input"   : [ { "name"      : "State",
+                     "id"        : "0x01",
+                     "mandatory" : "yes",
+                     "type"      : "TLV",
+                     "format"    : "sequence",
+                     "contents"  : [ { "name"          : "GPS Service State",
+                                       "format"        : "guint8",
+                                       "public-format" : "gboolean" } ] } ],
+     "output"  : [ { "common-ref" : "Operation Result" } ] },
+
+  // *********************************************************************************
+  {  "name"    : "Get Auto Tracking State",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0030",
+     "version" : "1.0",
+     "output"  : [ { "common-ref" : "Operation Result" },
+                   { "name"      : "State",
+                     "id"        : "0x01",
+                     "mandatory" : "yes",
+                     "type"      : "TLV",
+                     "format"    : "sequence",
+                     "contents"  : [ { "name"          : "Auto Tracking State",
+                                       "format"        : "guint8",
+                                       "public-format" : "gboolean" } ],
+                     "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
+  // *********************************************************************************
+  {  "name"    : "Set Auto Tracking State",
+     "type"    : "Message",
+     "service" : "PDS",
+     "id"      : "0x0031",
+     "version" : "1.0",
+     "input"   : [ { "name"      : "State",
+                     "id"        : "0x01",
+                     "mandatory" : "yes",
+                     "type"      : "TLV",
+                     "format"    : "sequence",
+                     "contents"  : [ { "name"          : "Auto Tracking State",
+                                       "format"        : "guint8",
+                                       "public-format" : "gboolean" } ] } ],
+     "output"  : [ { "common-ref" : "Operation Result" } ] }
+
+]
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
index 6b15f95..d0d64ef 100644
--- a/data/qmi-service-wds.json
+++ b/data/qmi-service-wds.json
@@ -295,7 +295,6 @@
                       "mandatory" : "no",
                       "type"      : "TLV",
                       "format"        : "array",
-                      "array-size"    : { "format" : "guint8" },
                       "array-element" : { "name"     : "IPv4 Address",
                                           "format"   : "guint32" },
                       "prerequisites" : [ { "common-ref" : "Success" } ] },
@@ -304,10 +303,9 @@
                       "mandatory" : "no",
                       "type"      : "TLV",
                       "format"        : "array",
-                      "array-size"    : { "format"             : "guint8" },
                       "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",
@@ -360,10 +358,9 @@
                       "mandatory" : "no",
                       "type"      : "TLV",
                       "format"        : "array",
-                      "array-size"    : { "format"             : "guint8" },
                       "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",
diff --git a/data/qmi-service-wms.json b/data/qmi-service-wms.json
index 7dfe3bc..75accd4 100644
--- a/data/qmi-service-wms.json
+++ b/data/qmi-service-wms.json
@@ -67,10 +67,10 @@
                                      { "name"          : "Format",
                                        "format"        : "guint8",
                                        "public-format" : "QmiWmsMessageFormat" },
-                                     { "name"          : "Raw Data",
-                                       "format"        : "array",
-                                       "array-size"    : { "format" : "guint16" },
-                                       "array-element" : { "format" : "guint8" } } ] },
+                                     { "name"               : "Raw Data",
+                                       "format"             : "array",
+                                       "size-prefix-format" : "guint16",
+                                       "array-element"      : { "format" : "guint8" } } ] },
                    { "name"          : "Message Mode",
                      "id"            : "0x12",
                      "mandatory"     : "no",
@@ -85,10 +85,10 @@
                      "contents"  : [ { "name"          : "Notification Type",
                                        "format"        : "guint8",
                                        "public-format" : "QmiWmsNotificationType" },
-                                     { "name"          : "Raw Data",
-                                       "format"        : "array",
-                                       "array-size"    : { "format" : "guint16" },
-                                       "array-element" : { "format" : "guint8" } } ] },
+                                     { "name"               : "Raw Data",
+                                       "format"             : "array",
+                                       "size-prefix-format" : "guint16",
+                                       "array-element"      : { "format" : "guint8" } } ] },
                    { "name"      : "ETWS PLMN Information",
                      "id"        : "0x14",
                      "mandatory" : "no",
@@ -124,10 +124,10 @@
                      "contents"  : [ { "name"          : "Format",
                                        "format"        : "guint8",
                                        "public-format" : "QmiWmsMessageFormat" },
-                                     { "name"          : "Raw Data",
-                                       "format"        : "array",
-                                       "array-size"    : { "format" : "guint16" },
-                                       "array-element" : { "format" : "guint8" } } ] },
+                                     { "name"               : "Raw Data",
+                                       "format"             : "array",
+                                       "size-prefix-format" : "guint16",
+                                       "array-element"      : { "format" : "guint8" } } ] },
                    { "name"      : "CDMA Force On DC",
                      "id"        : "0x10",
                      "mandatory" : "no",
@@ -237,10 +237,10 @@
                                      { "name"          : "Format",
                                        "format"        : "guint8",
                                        "public-format" : "QmiWmsMessageFormat" },
-                                     { "name"          : "Raw Data",
-                                       "format"        : "array",
-                                       "array-size"    : { "format" : "guint16" },
-                                       "array-element" : { "format" : "guint8" } } ] } ],
+                                     { "name"               : "Raw Data",
+                                       "format"             : "array",
+                                       "size-prefix-format" : "guint16",
+                                       "array-element"      : { "format" : "guint8" } } ] } ],
      "output"  : [ { "common-ref" : "Operation Result" },
                    { "name"          : "Memory Index",
                      "id"            : "0x01",
@@ -289,10 +289,10 @@
                                       { "name"          : "Format",
                                         "format"        : "guint8",
                                         "public-format" : "QmiWmsMessageFormat" },
-                                      { "name"          : "Raw Data",
-                                        "format"        : "array",
-                                        "array-size"    : { "format" : "guint16" },
-                                        "array-element" : { "format" : "guint8" } } ],
+                                      { "name"               : "Raw Data",
+                                        "format"             : "array",
+                                        "size-prefix-format" : "guint16",
+                                        "array-element"      : { "format" : "guint8" } } ],
                       "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
 
   // *********************************************************************************
@@ -393,20 +393,20 @@
                      "format"        : "guint8",
                      "public-format" : "QmiWmsMessageMode" } ],
      "output"   : [ { "common-ref" : "Operation Result" },
-                    { "name"          : "Message List",
-                      "id"            : "0x01",
-                      "mandatory"     : "yes",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint32" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"   : "Memory Index",
-                                                           "format" : "guint32" },
-                                                         { "name"          : "Message Tag",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiWmsMessageTagType" } ] },
-                      "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+                    { "name"               : "Message List",
+                      "id"                 : "0x01",
+                      "mandatory"          : "yes",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint32" ,
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"   : "Memory Index",
+                                                                "format" : "guint32" },
+                                                              { "name"          : "Message Tag",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiWmsMessageTagType" } ] },
+                      "prerequisites"      : [ { "common-ref" : "Success" } ] } ] },
 
   // *********************************************************************************
   {  "name"    : "Set Routes",
@@ -414,26 +414,26 @@
      "service" : "WMS",
      "id"      : "0x0032",
      "version" : "1.0",
-     "input"   : [ { "name"          : "Route List",
-                     "id"            : "0x01",
-                     "mandatory"     : "yes",
-                     "type"          : "TLV",
-                     "format"        : "array",
-                     "array-size"    : { "format" : "guint16" },
-                     "array-element" : { "name"     : "Element",
-                                         "format"   : "struct",
-                                         "contents" : [ { "name"          : "Message Type",
-                                                          "format"        : "guint8",
-                                                          "public-format" : "QmiWmsMessageType" },
-                                                        { "name"          : "Message Class",
-                                                          "format"        : "guint8",
-                                                          "public-format" : "QmiWmsMessageClass" },
-                                                        { "name"          : "Storage",
-                                                          "format"        : "guint8",
-                                                          "public-format" : "QmiWmsStorageType" },
-                                                        { "name"          : "Receipt Action",
-                                                          "format"        : "guint8",
-                                                          "public-format" : "QmiWmsReceiptAction" } ] } },
+     "input"   : [ { "name"               : "Route List",
+                     "id"                 : "0x01",
+                     "mandatory"          : "yes",
+                     "type"               : "TLV",
+                     "format"             : "array",
+                     "size-prefix-format" : "guint16",
+                     "array-element"      : { "name"     : "Element",
+                                              "format"   : "struct",
+                                              "contents" : [ { "name"          : "Message Type",
+                                                               "format"        : "guint8",
+                                                               "public-format" : "QmiWmsMessageType" },
+                                                             { "name"          : "Message Class",
+                                                               "format"        : "guint8",
+                                                               "public-format" : "QmiWmsMessageClass" },
+                                                             { "name"          : "Storage",
+                                                               "format"        : "guint8",
+                                                               "public-format" : "QmiWmsStorageType" },
+                                                             { "name"          : "Receipt Action",
+                                                               "format"        : "guint8",
+                                                               "public-format" : "QmiWmsReceiptAction" } ] } },
                    { "name"          : "Transfer Status Report",
                      "id"            : "0x10",
                      "mandatory"     : "no",
@@ -449,27 +449,27 @@
      "id"      : "0x0033",
      "version" : "1.0",
      "output"   : [ { "common-ref" : "Operation Result" },
-                    { "name"          : "Route List",
-                      "id"            : "0x01",
-                      "mandatory"     : "yes",
-                      "type"          : "TLV",
-                      "format"        : "array",
-                      "array-size"    : { "format" : "guint16" },
-                      "array-element" : { "name"     : "Element",
-                                          "format"   : "struct",
-                                          "contents" : [ { "name"          : "Message Type",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiWmsMessageType" },
-                                                         { "name"          : "Message Class",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiWmsMessageClass" },
-                                                         { "name"          : "Storage",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiWmsStorageType" },
-                                                         { "name"          : "Receipt Action",
-                                                           "format"        : "guint8",
-                                                           "public-format" : "QmiWmsReceiptAction" } ] },
-                      "prerequisites" : [ { "common-ref" : "Success" } ] },
+                    { "name"               : "Route List",
+                      "id"                 : "0x01",
+                      "mandatory"          : "yes",
+                      "type"               : "TLV",
+                      "format"             : "array",
+                      "size-prefix-format" : "guint16",
+                      "array-element"      : { "name"     : "Element",
+                                               "format"   : "struct",
+                                               "contents" : [ { "name"          : "Message Type",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiWmsMessageType" },
+                                                              { "name"          : "Message Class",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiWmsMessageClass" },
+                                                              { "name"          : "Storage",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiWmsStorageType" },
+                                                              { "name"          : "Receipt Action",
+                                                                "format"        : "guint8",
+                                                                "public-format" : "QmiWmsReceiptAction" } ] },
+                      "prerequisites"      : [ { "common-ref" : "Success" } ] },
                     { "name"          : "Transfer Status Report",
                       "id"            : "0x10",
                       "mandatory"     : "no",
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index b9ff1bd..02d5394 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -81,6 +81,12 @@
     <xi:include href="xml/qmi-enums-wms.xml"/>
   </chapter>
 
+  <chapter>
+    <title>Position Determination Service (PDS)</title>
+    <xi:include href="xml/qmi-pds.xml"/>
+    <xi:include href="xml/qmi-enums-pds.xml"/>
+  </chapter>
+
   <chapter id="object-tree">
     <title>Object Hierarchy</title>
      <xi:include href="xml/tree_index.sgml"/>
diff --git a/libqmi-glib/Makefile.am b/libqmi-glib/Makefile.am
index 69b84ef..b4e57c7 100644
--- a/libqmi-glib/Makefile.am
+++ b/libqmi-glib/Makefile.am
@@ -31,10 +31,10 @@
 		qmi-errors.h > $@
 
 # Enum/Flag types
-ENUMS = qmi-enums.h qmi-enums-wds.h qmi-enums-dms.h qmi-enums-nas.h qmi-enums-wms.h
+ENUMS = qmi-enums.h qmi-enums-wds.h qmi-enums-dms.h qmi-enums-nas.h qmi-enums-wms.h qmi-enums-pds.h
 qmi-enum-types.h:  $(ENUMS) $(top_srcdir)/build-aux/templates/qmi-enum-types-template.h
 	$(AM_V_GEN) $(GLIB_MKENUMS) \
-		--fhead "#ifndef __LIBQMI_GLIB_ENUM_TYPES_H__\n#define __LIBQMI_GLIB_ENUM_TYPES_H__\n#include \"qmi-enums.h\"\n#include \"qmi-enums-wds.h\"\n#include \"qmi-enums-dms.h\"\n#include \"qmi-enums-nas.h\"\n#include \"qmi-enums-wms.h\"\n" \
+		--fhead "#ifndef __LIBQMI_GLIB_ENUM_TYPES_H__\n#define __LIBQMI_GLIB_ENUM_TYPES_H__\n#include \"qmi-enums.h\"\n#include \"qmi-enums-wds.h\"\n#include \"qmi-enums-dms.h\"\n#include \"qmi-enums-nas.h\"\n#include \"qmi-enums-wms.h\"\n#include \"qmi-enums-pds.h\"\n" \
 		--template $(top_srcdir)/build-aux/templates/qmi-enum-types-template.h \
 		--ftail "#endif /* __LIBQMI_GLIB_ENUM_TYPES_H__ */\n" \
 		$(ENUMS) > $@
@@ -115,10 +115,21 @@
 			--output qmi-wms && \
 		touch $@
 
+# PDS service
+qmi-pds.stamp: $(top_srcdir)/data/qmi-service-pds.json $(top_srcdir)/build-aux/qmi-codegen/*.py $(top_srcdir)/build-aux/qmi-codegen/qmi-codegen
+	$(AM_V_GEN) \
+		rm -f qmi-pds.h && \
+		rm -f qmi-pds.c && \
+		$(top_srcdir)/build-aux/qmi-codegen/qmi-codegen \
+			--input $(top_srcdir)/data/qmi-service-pds.json \
+			--include $(top_srcdir)/data/qmi-common.json \
+			--output qmi-pds && \
+		touch $@
+
 # Additional dependencies
-qmi-device.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.h qmi-dms.h qmi-wds.h qmi-nas.h qmi-wms.h
+qmi-device.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.h qmi-dms.h qmi-wds.h qmi-nas.h qmi-wms.h qmi-pds.h
 qmi-client.c: qmi-error-types.h qmi-enum-types.h
-qmi-message.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.h qmi-dms.h qmi-wds.h qmi-nas.h qmi-wms.h
+qmi-message.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.h qmi-dms.h qmi-wds.h qmi-nas.h qmi-wms.h qmi-pds.h
 qmi-ctl.h: qmi-ctl.stamp
 qmi-ctl.c: qmi-error-types.h qmi-enum-types.h qmi-ctl.h
 qmi-dms.h: qmi-dms.stamp qmi-enums-dms.h
@@ -130,6 +141,8 @@
 qmi-nas.c: qmi-error-types.h qmi-enum-types.h qmi-flags64-types.h qmi-nas.h
 qmi-wms.h: qmi-wms.stamp qmi-enums-wms.h
 qmi-wms.c: qmi-error-types.h qmi-enum-types.h qmi-wms.h
+qmi-pds.h: qmi-pds.stamp qmi-enums-pds.h
+qmi-pds.c: qmi-error-types.h qmi-enum-types.h qmi-pds.h
 
 libqmi_glib_la_SOURCES = \
 	libqmi-glib.h \
@@ -138,6 +151,7 @@
 	qmi-enums-dms.h \
 	qmi-enums-nas.h \
 	qmi-enums-wms.h \
+	qmi-enums-pds.h \
 	qmi-enums.h qmi-enum-types.h qmi-enum-types.c qmi-flags64-types.h qmi-flags64-types.c \
 	qmi-utils.h qmi-utils.c \
 	qmi-message.h qmi-message.c \
@@ -149,7 +163,8 @@
 	qmi-dms.c qmi-dms.h \
 	qmi-wds.c qmi-wds.h \
 	qmi-nas.c qmi-nas.h \
-	qmi-wms.c qmi-wms.h
+	qmi-wms.c qmi-wms.h \
+	qmi-pds.c qmi-pds.h
 
 libqmi_glib_la_LIBADD = \
 	$(LIBQMI_GLIB_LIBS)
@@ -166,11 +181,13 @@
 	qmi-enums-dms.h qmi-flags64-dms.h qmi-dms.h \
 	qmi-enums-wds.h qmi-wds.h \
 	qmi-enums-nas.h qmi-flags64-nas.h qmi-nas.h \
-	qmi-enums-wms.h qmi-wms.h
+	qmi-enums-wms.h qmi-wms.h \
+	qmi-enums-pds.h qmi-pds.h
 
 CLEANFILES = \
 	qmi-ctl.h qmi-ctl.c qmi-ctl.stamp \
 	qmi-dms.h qmi-dms.c qmi-dms.stamp \
 	qmi-wds.h qmi-wds.c qmi-wds.stamp \
 	qmi-nas.h qmi-nas.c qmi-nas.stamp \
-	qmi-wms.h qmi-wms.c qmi-wms.stamp
+	qmi-wms.h qmi-wms.c qmi-wms.stamp \
+	qmi-pds.h qmi-pds.c qmi-pds.stamp
diff --git a/libqmi-glib/libqmi-glib.h b/libqmi-glib/libqmi-glib.h
index 73d4999..23b9738 100644
--- a/libqmi-glib/libqmi-glib.h
+++ b/libqmi-glib/libqmi-glib.h
@@ -33,5 +33,6 @@
 #include "qmi-wds.h"
 #include "qmi-nas.h"
 #include "qmi-wms.h"
+#include "qmi-pds.h"
 
 #endif /* _LIBQMI_GLIB_H_ */
diff --git a/libqmi-glib/qmi-device.c b/libqmi-glib/qmi-device.c
index 46dcdec..04b963d 100644
--- a/libqmi-glib/qmi-device.c
+++ b/libqmi-glib/qmi-device.c
@@ -34,6 +34,7 @@
 #include "qmi-wds.h"
 #include "qmi-nas.h"
 #include "qmi-wms.h"
+#include "qmi-pds.h"
 #include "qmi-utils.h"
 #include "qmi-error-types.h"
 #include "qmi-enum-types.h"
@@ -700,6 +701,10 @@
         ctx->client_type = QMI_TYPE_CLIENT_WMS;
         break;
 
+    case QMI_SERVICE_PDS:
+        ctx->client_type = QMI_TYPE_CLIENT_PDS;
+        break;
+
     default:
         g_simple_async_result_set_error (ctx->result,
                                          QMI_CORE_ERROR,
@@ -1532,6 +1537,7 @@
                                         NULL,
                                         (GAsyncReadyCallback)ctl_set_data_format_ready,
                                         ctx);
+        qmi_message_ctl_set_data_format_input_unref (input);
         return;
     }
 
diff --git a/libqmi-glib/qmi-enums-pds.h b/libqmi-glib/qmi-enums-pds.h
new file mode 100644
index 0000000..bed6b26
--- /dev/null
+++ b/libqmi-glib/qmi-enums-pds.h
@@ -0,0 +1,142 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * libqmi-glib -- GLib/GIO based library to control QMI devices
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA.
+ *
+ * Copyright (C) 2012 Google Inc.
+ */
+
+#ifndef _LIBQMI_GLIB_QMI_ENUMS_PDS_H_
+#define _LIBQMI_GLIB_QMI_ENUMS_PDS_H_
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI PDS Event Report' indication */
+
+/**
+ * QmiPdsOperationMode:
+ * @QMI_PDS_OPERATION_MODE_UNKNOWN: Unknown (position not fixed yet).
+ * @QMI_PDS_OPERATION_MODE_STANDALONE: Standalone.
+ * @QMI_PDS_OPERATION_MODE_MS_BASED: MS based.
+ * @QMI_PDS_OPERATION_MODE_MS_ASSISTED: MS assisted.
+ *
+ * Operation mode used to compute the position.
+ */
+typedef enum {
+    QMI_PDS_OPERATION_MODE_UNKNOWN     = -1,
+    QMI_PDS_OPERATION_MODE_STANDALONE  =  0,
+    QMI_PDS_OPERATION_MODE_MS_BASED    =  1,
+    QMI_PDS_OPERATION_MODE_MS_ASSISTED =  2
+} QmiPdsOperationMode;
+
+/**
+ * QmiPdsPositionSessionStatus:
+ * @QMI_PDS_POSITION_SESSION_STATUS_SUCCESS: Success.
+ * @QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS: In progress.
+ * @QMI_PDS_POSITION_SESSION_STATUS_GENERAL_FAILURE: General failure.
+ * @QMI_PDS_POSITION_SESSION_STATUS_TIMEOUT: Timeout.
+ * @QMI_PDS_POSITION_SESSION_STATUS_USER_ENDED_SESSION: User ended session.
+ * @QMI_PDS_POSITION_SESSION_STATUS_BAD_PARAMETER: Bad parameter.
+ * @QMI_PDS_POSITION_SESSION_STATUS_PHONE_OFFLINE: Phone is offline.
+ * @QMI_PDS_POSITION_SESSION_STATUS_ENGINE_LOCKED: Engine locked.
+ * @QMI_PDS_POSITION_SESSION_STATUS_E911_SESSION_IN_PROGRESS: Emergency call in progress.
+ *
+ * Status of the positioning session.
+ */
+typedef enum {
+    QMI_PDS_POSITION_SESSION_STATUS_SUCCESS                  = 0x00,
+    QMI_PDS_POSITION_SESSION_STATUS_IN_PROGRESS              = 0x01,
+    QMI_PDS_POSITION_SESSION_STATUS_GENERAL_FAILURE          = 0x02,
+    QMI_PDS_POSITION_SESSION_STATUS_TIMEOUT                  = 0x03,
+    QMI_PDS_POSITION_SESSION_STATUS_USER_ENDED_SESSION       = 0x04,
+    QMI_PDS_POSITION_SESSION_STATUS_BAD_PARAMETER            = 0x05,
+    QMI_PDS_POSITION_SESSION_STATUS_PHONE_OFFLINE            = 0x06,
+    QMI_PDS_POSITION_SESSION_STATUS_ENGINE_LOCKED            = 0x07,
+    QMI_PDS_POSITION_SESSION_STATUS_E911_SESSION_IN_PROGRESS = 0x08
+} QmiPdsPositionSessionStatus;
+
+/**
+ * QmiPdsDataValid:
+ * @QMI_PDS_DATA_VALID_TIMESTAMP_CALENDAR: Timestamp calendar (GPS time).
+ * @QMI_PDS_DATA_VALID_TIMESTAMP_UTC: Timestamp (UTC).
+ * @QMI_PDS_DATA_VALID_LEAP_SECONDS: Leap seconds.
+ * @QMI_PDS_DATA_VALID_TIME_UNCERTAINTY: Time uncertainty.
+ * @QMI_PDS_DATA_VALID_LATITUDE: Latitude.
+ * @QMI_PDS_DATA_VALID_LONGITUDE: Longitude.
+ * @QMI_PDS_DATA_VALID_ELLIPSOID_ALTITUDE: Ellipsoid altitude.
+ * @QMI_PDS_DATA_VALID_MEAN_SEA_LEVEL_ALTITUDE: Mean sea level altitude.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_SPEED: Horizontal speed.
+ * @QMI_PDS_DATA_VALID_VERTICAL_SPEED: Vertical speed.
+ * @QMI_PDS_DATA_VALID_HEADING: Heading.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_CIRCULAR: Horizontal uncertainty circular.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MAJOR: Horizontal uncertainty ellipse semi-major.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MINOR: Horizontal uncertainty ellipse semi-minor.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_ORIENT_AZIMUTH: Horizontal uncertainty ellipse orient azimuth.
+ * @QMI_PDS_DATA_VALID_VERTICAL_UNCERTAINTY: Vertical uncertainty.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_VELOCITY_UNCERTAINTY: Horizontal velocity uncertainty.
+ * @QMI_PDS_DATA_VALID_VERTICAL_VELOCITY_UNCERTAINTY: Vertical velocity uncertainty.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_CONFIDENCE: Horizontal confidence.
+ * @QMI_PDS_DATA_VALID_POSITION_DOP: Position dillution of precision.
+ * @QMI_PDS_DATA_VALID_HORIZONTAL_DOP: Horizontal dillution of precision.
+ * @QMI_PDS_DATA_VALID_VERTICAL_DOP: Vertical dillution of precision.
+ * @QMI_PDS_DATA_VALID_OPERATING_MODE: Operating mode.
+ *
+ * Flags to indicate which position data parameters are valid.
+ */
+typedef enum {
+    QMI_PDS_DATA_VALID_TIMESTAMP_CALENDAR      = 1 << 0,
+    QMI_PDS_DATA_VALID_TIMESTAMP_UTC           = 1 << 1,
+    QMI_PDS_DATA_VALID_LEAP_SECONDS            = 1 << 2,
+    QMI_PDS_DATA_VALID_TIME_UNCERTAINTY        = 1 << 3,
+    QMI_PDS_DATA_VALID_LATITUDE                = 1 << 4,
+    QMI_PDS_DATA_VALID_LONGITUDE               = 1 << 5,
+    QMI_PDS_DATA_VALID_ELLIPSOID_ALTITUDE      = 1 << 6,
+    QMI_PDS_DATA_VALID_MEAN_SEA_LEVEL_ALTITUDE = 1 << 7,
+    QMI_PDS_DATA_VALID_HORIZONTAL_SPEED        = 1 << 8,
+    QMI_PDS_DATA_VALID_VERTICAL_SPEED          = 1 << 9,
+    QMI_PDS_DATA_VALID_HEADING                 = 1 << 10,
+    QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_CIRCULAR               = 1 << 11,
+    QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MAJOR     = 1 << 12,
+    QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_SEMI_MINOR     = 1 << 13,
+    QMI_PDS_DATA_VALID_HORIZONTAL_UNCERTAINTY_ELLIPSE_ORIENT_AZIMUTH = 1 << 14,
+    QMI_PDS_DATA_VALID_VERTICAL_UNCERTAINTY                          = 1 << 15,
+    QMI_PDS_DATA_VALID_HORIZONTAL_VELOCITY_UNCERTAINTY               = 1 << 16,
+    QMI_PDS_DATA_VALID_VERTICAL_VELOCITY_UNCERTAINTY                 = 1 << 17,
+    QMI_PDS_DATA_VALID_HORIZONTAL_CONFIDENCE   = 1 << 18,
+    QMI_PDS_DATA_VALID_POSITION_DOP            = 1 << 19,
+    QMI_PDS_DATA_VALID_HORIZONTAL_DOP          = 1 << 20,
+    QMI_PDS_DATA_VALID_VERTICAL_DOP            = 1 << 21,
+    QMI_PDS_DATA_VALID_OPERATING_MODE          = 1 << 22
+} QmiPdsDataValid;
+
+/*****************************************************************************/
+/* Helper enums for the 'QMI PDS Get GPS Service State' request/response */
+
+/**
+ * QmiPdsTrackingSessionState:
+ * @QMI_PDS_TRACKING_SESSION_STATE_UNKNOWN: Unknown state.
+ * @QMI_PDS_TRACKING_SESSION_STATE_INACTIVE: Session inactive.
+ * @QMI_PDS_TRACKING_SESSION_STATE_ACTIVE: Session active.
+ *
+ * State of the tracking session.
+ */
+typedef enum {
+    QMI_PDS_TRACKING_SESSION_STATE_UNKNOWN  = 0,
+    QMI_PDS_TRACKING_SESSION_STATE_INACTIVE = 1,
+    QMI_PDS_TRACKING_SESSION_STATE_ACTIVE   = 2
+} QmiPdsTrackingSessionState;
+
+#endif /* _LIBQMI_GLIB_QMI_ENUMS_PDS_H_ */
diff --git a/libqmi-glib/qmi-enums.h b/libqmi-glib/qmi-enums.h
index 4a3476a..755fee4 100644
--- a/libqmi-glib/qmi-enums.h
+++ b/libqmi-glib/qmi-enums.h
@@ -17,7 +17,7 @@
  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  * Boston, MA 02110-1301 USA.
  *
- * Copyright (C) 2012 Aleksander Morgado <aleksander@lanedo.com>
+ * Copyright (C) 2012 Google, Inc.
  */
 
 #include "qmi-enums-wds.h"
@@ -48,14 +48,18 @@
 	QMI_SERVICE_AT = 0x08,
     /* Voice service */
     QMI_SERVICE_VOICE = 0x09,
-
+    /* Card Application Toolkit service (major version 2) */
 	QMI_SERVICE_CAT2 = 0x0A,
+    /* User Identity Module service */
 	QMI_SERVICE_UIM = 0x0B,
+    /* Phonebook Management service */
 	QMI_SERVICE_PBM = 0x0C,
+    /* Location service (~ PDS major version 2) */
 	QMI_SERVICE_LOC = 0x10,
+    /* No idea what this one means.. Search And Rescue? */
 	QMI_SERVICE_SAR = 0x11,
+    /* Remote Filesystem service */
 	QMI_SERVICE_RMTFS = 0x14,
-
     /* Card Application Toolkit service */
     QMI_SERVICE_CAT = 0xE0,
     /* Remote Management Service */
diff --git a/libqmi-glib/qmi-message.c b/libqmi-glib/qmi-message.c
index c3ebb08..6d4e58b 100644
--- a/libqmi-glib/qmi-message.c
+++ b/libqmi-glib/qmi-message.c
@@ -43,6 +43,7 @@
 #include "qmi-wds.h"
 #include "qmi-nas.h"
 #include "qmi-wms.h"
+#include "qmi-pds.h"
 
 #define PACKED __attribute__((packed))
 
@@ -702,6 +703,9 @@
     case QMI_SERVICE_WMS:
         contents = qmi_message_wms_get_printable (self, line_prefix);
         break;
+    case QMI_SERVICE_PDS:
+        contents = qmi_message_pds_get_printable (self, line_prefix);
+        break;
     default:
         break;
     }
@@ -738,6 +742,9 @@
     case QMI_SERVICE_WMS:
         return qmi_message_wms_get_version_introduced (self, major, minor);
 
+    case QMI_SERVICE_PDS:
+        return qmi_message_pds_get_version_introduced (self, major, minor);
+
     default:
         /* For the still unsupported services, cannot do anything */
         return FALSE;