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

Change-Id: Id1aa4f1b5e35345c3faf157e623bf35b32d37181
diff --git a/configure.ac b/configure.ac
index 1a87e51..eeb9754 100644
--- a/configure.ac
+++ b/configure.ac
@@ -4,7 +4,7 @@
 dnl The QMI version number
 m4_define([qmi_major_version], [1])
 m4_define([qmi_minor_version], [21])
-m4_define([qmi_micro_version], [1])
+m4_define([qmi_micro_version], [2])
 m4_define([qmi_version],
           [qmi_major_version.qmi_minor_version.qmi_micro_version])
 
diff --git a/data/qmi-common.json b/data/qmi-common.json
index 3826e50..9f69ab8 100644
--- a/data/qmi-common.json
+++ b/data/qmi-common.json
@@ -381,6 +381,21 @@
                       { "name"          : "Max Uplink Bitrate",
                         "format"        : "guint32" } ] },
 
+    { "common-ref"    : "WDS APN Disabled Flag",
+      "name"          : "APN Disabled Flag",
+      "id"            : "0x2F",
+      "type"          : "TLV",
+      "format"        : "guint8",
+      "public-format" : "gboolean" },
+
+    { "common-ref"    : "WDS Roaming Disallowed Flag",
+      "name"          : "Roaming Disallowed Flag",
+      "id"            : "0x3E",
+      "type"          : "TLV",
+      "format"        : "guint8",
+      "public-format" : "gboolean" },
+
+
     // *********************************************************************************
     // NAS common TLVs
 
diff --git a/data/qmi-service-loc.json b/data/qmi-service-loc.json
index 8eddaf9..4e3cdff 100644
--- a/data/qmi-service-loc.json
+++ b/data/qmi-service-loc.json
@@ -636,5 +636,49 @@
                      "type"          : "TLV",
                      "since"         : "1.22",
                      "format"        : "guint32",
-                     "public-format" : "QmiLocOperationMode" } ] }
+                     "public-format" : "QmiLocOperationMode" } ] },
+
+  // *********************************************************************************
+
+  {  "name"    : "Inject Xtra Data",
+     "type"    : "Message",
+     "service" : "LOC",
+     "id"      : "0x00A7",
+     "since"   : "1.22",
+     "input"   : [ { "name"               : "Total Size",
+                     "id"                 : "0x01",
+                     "type"               : "TLV",
+                     "since"              : "1.22",
+                     "format"             : "guint32" },
+                   { "name"               : "Total Parts",
+                     "id"                 : "0x02",
+                     "type"               : "TLV",
+                     "since"              : "1.22",
+                     "format"             : "guint16" },
+                   { "name"               : "Part Number",
+                     "id"                 : "0x03",
+                     "type"               : "TLV",
+                     "since"              : "1.22",
+                     "format"             : "guint16" },
+                   { "name"               : "Part Data",
+                     "id"                 : "0x04",
+                     "type"               : "TLV",
+                     "since"              : "1.22",
+                     "format"             : "array",
+                     "array-element"      : { "format" : "guint8" },
+                     "size-prefix-format" : "guint16",
+                     "max-size"           : "1024" } ],
+     "output"  : [ { "common-ref"         : "Operation Result" } ] },
+
+  {  "name"    : "Inject Xtra Data",
+     "type"    : "Indication",
+     "service" : "LOC",
+     "id"      : "0x00A7",
+     "since"   : "1.22",
+     "output"  : [ { "common-ref" : "LOC Indication Status" },
+                   { "name"       : "Part Number",
+                     "id"         : "0x10",
+                     "type"       : "TLV",
+                     "since"      : "1.22",
+                     "format"     : "guint16" } ] }
 ]
diff --git a/data/qmi-service-wds.json b/data/qmi-service-wds.json
index 3c25d3d..d30a591 100644
--- a/data/qmi-service-wds.json
+++ b/data/qmi-service-wds.json
@@ -767,10 +767,13 @@
                      "since"         : "1.18" },
                    // 0x2D, DHCP/NAS Preference
                    { "common-ref"    : "WDS LTE QoS Parameters",
-                     "since"         : "1.18" } ],
-                   // 0x2F, APN disabled flag
+                     "since"         : "1.18" },
+                   { "common-ref"    : "WDS APN Disabled Flag",
+                     "since"         : "1.22" },
                    // 0x30, PDN inactivity timeout
                    // 0x31, APN class
+                   { "common-ref"    : "WDS Roaming Disallowed Flag",
+                     "since"         : "1.22" } ],
                    // 0x90, Negotiate DNS server preference
                    // 0x91, PPP session close timer for DO
                    // 0x92, PPP session close timer for 1X
@@ -872,10 +875,13 @@
                      "since"         : "1.18" },
                    // 0x2D, DHCP/NAS Preference
                    { "common-ref"    : "WDS LTE QoS Parameters",
-                     "since"         : "1.18" } ],
-                   // 0x2F, APN disabled flag
+                     "since"         : "1.18" },
+                   { "common-ref"    : "WDS APN Disabled Flag",
+                     "since"         : "1.22" },
                    // 0x30, PDN inactivity timeout
                    // 0x31, APN class
+                   { "common-ref"    : "WDS Roaming Disallowed Flag",
+                     "since"         : "1.22" } ],
                    // 0x90, Negotiate DNS server preference
                    // 0x91, PPP session close timer for DO
                    // 0x92, PPP session close timer for 1X
@@ -1056,9 +1062,14 @@
                     { "common-ref"    : "WDS LTE QoS Parameters",
                       "since"         : "1.18",
                       "prerequisites" : [ { "common-ref" : "Success" } ] },
-                    // 0x2F, APN disabled flag
+                    { "common-ref"    : "WDS APN Disabled Flag",
+                      "since"         : "1.22",
+                      "prerequisites" : [ { "common-ref" : "Success" } ] },
                     // 0x30, PDN inactivity timeout
                     // 0x31, APN class
+                    { "common-ref"    : "WDS Roaming Disallowed Flag",
+                      "since"         : "1.22",
+                      "prerequisites" : [ { "common-ref" : "Success" } ] },
                     // 0x90, Negotiate DNS server preference
                     // 0x91, PPP session close timer for DO
                     // 0x92, PPP session close timer for 1X
@@ -1546,6 +1557,61 @@
                                         "format" : "guint32" } ] } ] },
 
   // *********************************************************************************
+  {  "name"    : "Get Default Profile Num",
+     "type"    : "Message",
+     "service" : "WDS",
+     "id"      : "0x0049",
+     "version" : "1.38",
+     "since"   : "1.22",
+     "input"   : [  { "name"          : "Profile Type",
+                      "id"            : "0x01",
+                      "mandatory"     : "yes",
+                      "type"          : "TLV",
+                      "since"         : "1.22",
+                      "format"        : "sequence",
+                      "contents"  : [ { "name"          : "Profile Type",
+                                        "format"        : "guint8",
+                                        "public-format" : "QmiWdsProfileType"},
+                                      { "name"          : "Profile Family",
+                                        "format"        : "guint8",
+                                        "public-format" : "QmiWdsProfileFamily"}] }],
+     "output"  : [  { "common-ref"    : "Operation Result" },
+                    { "name"          : "Default Profile Number",
+                      "id"            : "0x01",
+                      "mandatory"     : "yes",
+                      "type"          : "TLV",
+                      "since"         : "1.22",
+                      "format"        : "guint8",
+                      "prerequisites" : [ { "common-ref" : "Success" } ] },
+                    { "common-ref"    : "WDS Extended Error Code",
+                      "since"         : "1.22" } ] },
+
+  // *********************************************************************************
+  {  "name"    : "Set Default Profile Num",
+     "type"    : "Message",
+     "service" : "WDS",
+     "id"      : "0x004A",
+     "version" : "1.38",
+     "since"   : "1.22",
+     "input"   : [  { "name"          : "Profile Identifier",
+                      "id"            : "0x01",
+                      "mandatory"     : "yes",
+                      "type"          : "TLV",
+                      "since"         : "1.22",
+                      "format"        : "sequence",
+                      "contents"  : [ { "name"          : "Profile Type",
+                                        "format"        : "guint8",
+                                        "public-format" : "QmiWdsProfileType"},
+                                      { "name"          : "Profile Family",
+                                        "format"        : "guint8",
+                                        "public-format" : "QmiWdsProfileFamily"},
+                                      { "name"          : "Profile Index",
+                                        "format"        : "guint8"}] }],
+     "output"  : [  { "common-ref"    : "Operation Result" },
+                    { "common-ref"    : "WDS Extended Error Code",
+                      "since"         : "1.22" } ] },
+
+  // *********************************************************************************
   {  "name"    : "Set IP Family",
      "type"    : "Message",
      "service" : "WDS",
@@ -1644,5 +1710,39 @@
                         "format"        : "guint32",
                         "public-format" : "QmiWdsClientType"}
                       ],
-        "output"  : [ { "common-ref" : "Operation Result" } ] }
+        "output"  : [ { "common-ref" : "Operation Result" } ] },
+
+// *********************************************************************************
+{  "name"    : "Swi Create Profile Indexed",
+   "type"    : "Message",
+   "service" : "WDS",
+   "id"      : "0x5558",
+   "version" : "1.1",
+   "since"   : "1.22",
+   "input"   : [ { "common-ref"    : "WDS Profile Identifier",
+                   "since"         : "1.22" } ,
+                 { "common-ref"    : "WDS Profile Name",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS PDP Type",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS APN Name",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS Primary IPv4 DNS Address",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS Secondary IPv4 DNS Address",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS Username",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS Password",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS Authentication",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS IPv4 Address Preference",
+                   "since"         : "1.22" },
+                 { "common-ref"    : "WDS PDP Context Number",
+                   "since"         : "1.22" } ],
+   "output"  : [ { "common-ref"    : "Operation Result" },
+                 { "common-ref"    : "WDS Profile Identifier",
+                   "since"         : "1.22",
+                   "prerequisites" : [ { "common-ref" : "Success" } ] } ] }
 ]
diff --git a/docs/reference/libqmi-glib/libqmi-glib-common.sections b/docs/reference/libqmi-glib/libqmi-glib-common.sections
index 918ac78..97e0eda 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-common.sections
+++ b/docs/reference/libqmi-glib/libqmi-glib-common.sections
@@ -481,6 +481,7 @@
 <SECTION>
 <FILE>qmi-enums-wds</FILE>
 QmiWdsIpFamily
+QmiWdsProfileFamily
 QmiWdsTechnologyPreference
 QmiWdsExtendedTechnologyPreference
 QmiWdsCallType
@@ -531,6 +532,7 @@
 QmiWdsClientType
 <SUBSECTION Methods>
 qmi_wds_ip_family_get_string
+qmi_wds_profile_family_get_string
 qmi_wds_technology_preference_build_string_from_mask
 qmi_wds_extended_technology_preference_get_string
 qmi_wds_call_type_get_string
@@ -582,6 +584,7 @@
 qmi_wds_client_type_get_string
 <SUBSECTION Private>
 qmi_wds_ip_family_build_string_from_mask
+qmi_wds_profile_family_build_string_from_mask
 qmi_wds_technology_preference_get_string
 qmi_wds_extended_technology_preference_build_string_from_mask
 qmi_wds_call_type_build_string_from_mask
@@ -641,6 +644,7 @@
 QMI_TYPE_WDS_EXTENDED_TECHNOLOGY_PREFERENCE
 QMI_TYPE_WDS_GET_CURRENT_SETTINGS_REQUESTED_SETTINGS
 QMI_TYPE_WDS_IP_FAMILY
+QMI_TYPE_WDS_PROFILE_FAMILY
 QMI_TYPE_WDS_NETWORK_TYPE
 QMI_TYPE_WDS_DATA_SYSTEM_NETWORK_TYPE
 QMI_TYPE_WDS_PDP_TYPE
@@ -690,6 +694,7 @@
 qmi_wds_extended_technology_preference_get_type
 qmi_wds_get_current_settings_requested_settings_get_type
 qmi_wds_ip_family_get_type
+qmi_wds_profile_family_get_type
 qmi_wds_network_type_get_type
 qmi_wds_data_system_network_type_get_type
 qmi_wds_pdp_type_get_type
diff --git a/docs/reference/libqmi-glib/libqmi-glib-docs.xml b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
index b0bd4c1..e4a9e12 100644
--- a/docs/reference/libqmi-glib/libqmi-glib-docs.xml
+++ b/docs/reference/libqmi-glib/libqmi-glib-docs.xml
@@ -192,6 +192,8 @@
       <xi:include href="xml/qmi-message-wds-delete-profile.xml"/>
       <xi:include href="xml/qmi-message-wds-get-profile-list.xml"/>
       <xi:include href="xml/qmi-message-wds-get-profile-settings.xml"/>
+      <xi:include href="xml/qmi-message-wds-get-default-profile-num.xml"/>
+      <xi:include href="xml/qmi-message-wds-set-default-profile-num.xml"/>
       <xi:include href="xml/qmi-message-wds-get-default-settings.xml"/>
       <xi:include href="xml/qmi-message-wds-get-current-settings.xml"/>
       <xi:include href="xml/qmi-message-wds-get-dormancy-status.xml"/>
@@ -204,6 +206,7 @@
       <xi:include href="xml/qmi-message-wds-get-pdn-throttle-info.xml"/>
       <xi:include href="xml/qmi-message-wds-bind-mux-data-port.xml"/>
       <xi:include href="xml/qmi-message-wds-get-channel-rates.xml"/>
+      <xi:include href="xml/qmi-message-wds-swi-create-profile-indexed.xml"/>
     </section>
   </chapter>
 
@@ -391,6 +394,7 @@
       <xi:include href="xml/qmi-indication-loc-inject-predicted-orbits-data.xml"/>
       <xi:include href="xml/qmi-indication-loc-get-predicted-orbits-data-source.xml"/>
       <xi:include href="xml/qmi-indication-loc-delete-assistance-data.xml"/>
+      <xi:include href="xml/qmi-indication-loc-inject-xtra-data.xml"/>
     </section>
     <section>
       <title>LOC Requests</title>
@@ -404,6 +408,7 @@
       <xi:include href="xml/qmi-message-loc-inject-predicted-orbits-data.xml"/>
       <xi:include href="xml/qmi-message-loc-get-predicted-orbits-data-source.xml"/>
       <xi:include href="xml/qmi-message-loc-delete-assistance-data.xml"/>
+      <xi:include href="xml/qmi-message-loc-inject-xtra-data.xml"/>
     </section>
   </chapter>
 
diff --git a/src/libqmi-glib/qmi-enums-wds.h b/src/libqmi-glib/qmi-enums-wds.h
index f1f84c0..b0ba849 100644
--- a/src/libqmi-glib/qmi-enums-wds.h
+++ b/src/libqmi-glib/qmi-enums-wds.h
@@ -1303,6 +1303,26 @@
  * Since: 1.0
  */
 
+ /**
+  * QmiWdsProfileFamily:
+  * @QMI_WDS_PROFILE_FAMILY_EMBEDDED: Embedded profile family.
+  * @QMI_WDS_PROFILE_FAMILY_TETHERED: Tethered profile family.
+  *
+  * Profile family.
+  *
+  * Since: 1.22
+  */
+ typedef enum { /*< underscore_name=qmi_wds_profile_family >*/
+     QMI_WDS_PROFILE_FAMILY_EMBEDDED = 0,
+     QMI_WDS_PROFILE_FAMILY_TETHERED = 1
+ } QmiWdsProfileFamily;
+
+ /**
+  * qmi_wds_profile_family_get_string:
+  *
+  * Since: 1.22
+  */
+
 /**
  * QmiWdsDeliveryOrder:
  * @QMI_WDS_QOS_DELIVERY_ORDER_SUBSCRIBE: Subscribe.
diff --git a/src/libqmi-glib/qmi-flags64-nas.h b/src/libqmi-glib/qmi-flags64-nas.h
index 8a45622..c3541cd 100644
--- a/src/libqmi-glib/qmi-flags64-nas.h
+++ b/src/libqmi-glib/qmi-flags64-nas.h
@@ -74,6 +74,8 @@
  * @QMI_NAS_BAND_PREFERENCE_WCDMA_2600: WCDMA 2600.
  * @QMI_NAS_BAND_PREFERENCE_WCDMA_900: WCDMA 900.
  * @QMI_NAS_BAND_PREFERENCE_WCDMA_1700_JAPAN: WCDMA 1700 (Japan).
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_850_JAPAN: WCDMA 850 (Japan). Since: 1.22.
+ * @QMI_NAS_BAND_PREFERENCE_WCDMA_1500: WCDMA 1500. Since: 1.22.
  *
  * Flags to specify frequency band preferences.
  *
@@ -120,8 +122,10 @@
     QMI_NAS_BAND_PREFERENCE_BC_16            = ((guint64) 1) << 56,
     QMI_NAS_BAND_PREFERENCE_BC_17            = ((guint64) 1) << 57,
     QMI_NAS_BAND_PREFERENCE_BC_18            = ((guint64) 1) << 58,
-    QMI_NAS_BAND_PREFERENCE_BC_19            = ((guint64) 1) << 59
-    /* Bits 60-63 reserved */
+    QMI_NAS_BAND_PREFERENCE_BC_19            = ((guint64) 1) << 59,
+    QMI_NAS_BAND_PREFERENCE_WCDMA_850_JAPAN  = ((guint64) 1) << 60,
+    QMI_NAS_BAND_PREFERENCE_WCDMA_1500       = ((guint64) 1) << 61
+    /* Bits 62-63 reserved */
 } QmiNasBandPreference;
 
 /**
diff --git a/src/qmicli/qmicli-dms.c b/src/qmicli/qmicli-dms.c
index 2b98a99..7143c55 100644
--- a/src/qmicli/qmicli-dms.c
+++ b/src/qmicli/qmicli-dms.c
@@ -2697,9 +2697,9 @@
 get_stored_image_result_free (GetStoredImageResult *result)
 {
     if (result) {
-        g_clear_pointer (&result->modem_unique_id, (GDestroyNotify)g_array_unref);
+        g_clear_pointer (&result->modem_unique_id, g_array_unref);
         g_free (result->modem_build_id);
-        g_clear_pointer (&result->pri_unique_id, (GDestroyNotify)g_array_unref);
+        g_clear_pointer (&result->pri_unique_id, g_array_unref);
         g_free (result->pri_build_id);
         g_slice_free (GetStoredImageResult, result);
     }
@@ -3161,10 +3161,10 @@
 static void
 set_firmware_preference_context_clear (SetFirmwarePreferenceContext *firmware_preference_ctx)
 {
-    g_clear_pointer (&firmware_preference_ctx->modem_image_id.unique_id, (GDestroyNotify) g_array_unref);
+    g_clear_pointer (&firmware_preference_ctx->modem_image_id.unique_id, g_array_unref);
     g_free (firmware_preference_ctx->modem_image_id.build_id);
 
-    g_clear_pointer (&firmware_preference_ctx->pri_image_id.unique_id, (GDestroyNotify) g_array_unref);
+    g_clear_pointer (&firmware_preference_ctx->pri_image_id.unique_id, g_array_unref);
     g_free (firmware_preference_ctx->pri_image_id.build_id);
 }
 
diff --git a/src/qmicli/qmicli-wds.c b/src/qmicli/qmicli-wds.c
index 5526782..17ce609 100644
--- a/src/qmicli/qmicli-wds.c
+++ b/src/qmicli/qmicli-wds.c
@@ -65,6 +65,8 @@
 static gboolean go_active_flag;
 static gboolean get_dormancy_status_flag;
 static gchar *get_profile_list_str;
+static gchar *get_default_profile_num_str;
+static gchar *set_default_profile_num_str;
 static gchar *get_default_settings_str;
 static gboolean get_autoconnect_settings_flag;
 static gchar *set_autoconnect_settings_str;
@@ -124,6 +126,14 @@
       "Get profile list",
       "[3gpp|3gpp2]"
     },
+    { "wds-get-default-profile-num", 0, 0, G_OPTION_ARG_STRING, &get_default_profile_num_str,
+      "Get default profile number",
+      "[3gpp|3gpp2]"
+    },
+    { "wds-set-default-profile-num", 0, 0, G_OPTION_ARG_STRING, &set_default_profile_num_str,
+      "Set default profile number",
+      "[(3gpp|3gpp2),#]"
+    },
     { "wds-get-default-settings", 0, 0, G_OPTION_ARG_STRING, &get_default_settings_str,
       "Get default settings",
       "[3gpp|3gpp2]"
@@ -200,6 +210,8 @@
                  go_active_flag +
                  get_dormancy_status_flag +
                  !!get_profile_list_str +
+                 !!get_default_profile_num_str +
+                 !!set_default_profile_num_str +
                  !!get_default_settings_str +
                  get_autoconnect_settings_flag +
                  !!set_autoconnect_settings_str +
@@ -1389,6 +1401,154 @@
 }
 
 static void
+get_default_profile_num_ready (QmiClientWds *client,
+                            GAsyncResult *res)
+{
+    QmiMessageWdsGetDefaultProfileNumOutput *output;
+    GError *error = NULL;
+    guint8 profile_num;
+
+    output = qmi_client_wds_get_default_profile_num_finish (client, res, &error);
+    if (!output) {
+        g_printerr ("error: operation failed: %s\n", error->message);
+        g_error_free (error);
+        operation_shutdown (FALSE);
+        return;
+    }
+
+    if (!qmi_message_wds_get_default_profile_num_output_get_result (output, &error)) {
+        QmiWdsDsProfileError ds_profile_error;
+
+        if (g_error_matches (error,
+                             QMI_PROTOCOL_ERROR,
+                             QMI_PROTOCOL_ERROR_EXTENDED_INTERNAL) &&
+            qmi_message_wds_get_default_profile_num_output_get_extended_error_code (
+                output,
+                &ds_profile_error,
+                NULL)) {
+            g_printerr ("error: couldn't get default settings: ds profile error: %s\n",
+                        qmi_wds_ds_profile_error_get_string (ds_profile_error));
+        } else {
+            g_printerr ("error: couldn't get default settings: %s\n",
+                        error->message);
+        }
+        g_error_free (error);
+        qmi_message_wds_get_default_profile_num_output_unref (output);
+        operation_shutdown (FALSE);
+        return;
+    }
+
+    g_print ("Default profile number retrieved:\n");
+
+    if (qmi_message_wds_get_default_profile_num_output_get_default_profile_number (output, &profile_num, NULL))
+        g_print ("\tDefault profile number: '%d'\n", profile_num);
+
+    qmi_message_wds_get_default_profile_num_output_unref (output);
+    operation_shutdown (TRUE);
+}
+
+static void
+set_default_profile_num_ready (QmiClientWds *client,
+                               GAsyncResult *res)
+{
+    QmiMessageWdsSetDefaultProfileNumOutput *output;
+    GError *error = NULL;
+
+    output = qmi_client_wds_set_default_profile_num_finish (client, res, &error);
+    if (!output) {
+        g_printerr ("error: operation failed: %s\n", error->message);
+        g_error_free (error);
+        operation_shutdown (FALSE);
+        return;
+    }
+
+    if (!qmi_message_wds_set_default_profile_num_output_get_result (output, &error)) {
+        QmiWdsDsProfileError ds_profile_error;
+
+        if (g_error_matches (error,
+                             QMI_PROTOCOL_ERROR,
+                             QMI_PROTOCOL_ERROR_EXTENDED_INTERNAL) &&
+            qmi_message_wds_set_default_profile_num_output_get_extended_error_code (
+                output,
+                &ds_profile_error,
+                NULL)) {
+            g_printerr ("error: couldn't set default settings: ds profile error: %s\n",
+                        qmi_wds_ds_profile_error_get_string (ds_profile_error));
+        } else {
+            g_printerr ("error: couldn't set default settings: %s\n",
+                        error->message);
+        }
+        g_error_free (error);
+        qmi_message_wds_set_default_profile_num_output_unref (output);
+        operation_shutdown (FALSE);
+        return;
+    }
+
+    g_print ("Default profile number updated\n");
+    qmi_message_wds_set_default_profile_num_output_unref (output);
+    operation_shutdown (TRUE);
+}
+
+static QmiMessageWdsSetDefaultProfileNumInput *
+set_default_profile_num_input_create (const gchar *str)
+{
+    QmiMessageWdsSetDefaultProfileNumInput *input;
+    GError *error = NULL;
+    gchar **split;
+    QmiWdsProfileType profile_type;
+    guint profile_num;
+
+    split = g_strsplit (str, ",", -1);
+    input = qmi_message_wds_set_default_profile_num_input_new ();
+
+    if (g_strv_length (split) != 2) {
+        g_printerr ("error: expected 2 options in default profile number settings\n");
+        goto error_out;
+    }
+
+    g_strstrip (split[0]);
+    if (g_str_equal (split[0], "3gpp"))
+        profile_type = QMI_WDS_PROFILE_TYPE_3GPP;
+    else if (g_str_equal (split[0], "3gpp2"))
+        profile_type = QMI_WDS_PROFILE_TYPE_3GPP2;
+    else {
+        g_printerr ("error: invalid profile type '%s'. Expected '3gpp' or '3gpp2'.'\n",
+                    split[0]);
+        goto error_out;
+    }
+
+    g_strstrip (split[1]);
+    profile_num = atoi (split[1]);
+    if (profile_num <= 0 || profile_num > G_MAXUINT8) {
+        g_printerr ("error: invalid or out of range profile number [1,%u]: '%s'\n",
+                    G_MAXUINT8,
+                    split[1]);
+        goto error_out;
+    }
+
+    if (!qmi_message_wds_set_default_profile_num_input_set_profile_identifier (
+			            input,
+			            profile_type,
+			            QMI_WDS_PROFILE_FAMILY_TETHERED,
+			            (guint8)profile_num,
+			            &error)) {
+        g_printerr ("error: couldn't create input bundle: '%s'\n", error->message);
+        goto error_out;
+    }
+
+    g_strfreev (split);
+    return input;
+
+error_out:
+    if (error)
+        g_error_free (error);
+    g_strfreev (split);
+    qmi_message_wds_set_default_profile_num_input_unref (input);
+    return NULL;
+}
+
+
+static void
 get_autoconnect_settings_ready (QmiClientWds *client,
                                 GAsyncResult *res)
 {
@@ -2051,6 +2211,61 @@
         return;
     }
 
+    /* Request to get currently active profile number */
+    if (get_default_profile_num_str) {
+        QmiMessageWdsGetDefaultProfileNumInput *input;
+        QmiWdsProfileType profile_type;
+
+        if (g_str_equal (get_default_profile_num_str, "3gpp"))
+            profile_type = QMI_WDS_PROFILE_TYPE_3GPP;
+        else if (g_str_equal (get_default_profile_num_str, "3gpp2"))
+            profile_type = QMI_WDS_PROFILE_TYPE_3GPP2;
+        else {
+            g_printerr ("error: invalid profile type '%s'. Expected '3gpp' or '3gpp2'.'\n",
+                        get_default_profile_num_str);
+            operation_shutdown (FALSE);
+            return;
+        }
+
+        input = qmi_message_wds_get_default_profile_num_input_new ();
+        /* always use profile family 'tethered', we don't really know what it means */
+        qmi_message_wds_get_default_profile_num_input_set_profile_type (input,
+                                                                        profile_type,
+                                                                        QMI_WDS_PROFILE_FAMILY_TETHERED,
+                                                                        NULL);
+
+        g_debug ("Asynchronously getting default profile number...");
+        qmi_client_wds_get_default_profile_num (ctx->client,
+                                                input,
+                                                10,
+                                                ctx->cancellable,
+                                                (GAsyncReadyCallback)get_default_profile_num_ready,
+                                                NULL);
+        qmi_message_wds_get_default_profile_num_input_unref (input);
+        return;
+    }
+
+    /* Request to set currently active profile number */
+    if (set_default_profile_num_str) {
+        QmiMessageWdsSetDefaultProfileNumInput *input;
+
+        input = set_default_profile_num_input_create (set_default_profile_num_str);
+        if (!input) {
+            operation_shutdown (FALSE);
+            return;
+        }
+
+        g_debug ("Asynchronously setting default profile number...");
+        qmi_client_wds_set_default_profile_num (ctx->client,
+                                                input,
+                                                10,
+                                                ctx->cancellable,
+                                                (GAsyncReadyCallback)set_default_profile_num_ready,
+                                                NULL);
+        qmi_message_wds_set_default_profile_num_input_unref (input);
+        return;
+    }
+
     /* Request to print default settings? */
     if (get_default_settings_str) {
         QmiMessageWdsGetDefaultSettingsInput *input;