add a command for changing the autoconnect setting
authorFelix Fietkau <nbd@openwrt.org>
Thu, 2 Oct 2014 09:59:03 +0000 (11:59 +0200)
committerFelix Fietkau <nbd@openwrt.org>
Thu, 2 Oct 2014 09:59:03 +0000 (11:59 +0200)
Signed-off-by: Felix Fietkau <nbd@openwrt.org>
commands-wds.c
commands-wds.h
data/qmi-service-wds.json
qmi-enums-wds.h

index a1804cf51437fac3356cae47547e75bdb8fb466e..08244a8faa3d0017987629adfb038a64bcc7caf6 100644 (file)
@@ -117,6 +117,31 @@ cmd_wds_get_packet_service_status_prepare(struct qmi_dev *qmi, struct qmi_reques
        return QMI_CMD_REQUEST;
 }
 
+#define cmd_wds_set_autoconnect_setting_cb no_cb
+static enum qmi_cmd_result
+cmd_wds_set_autoconnect_setting_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       struct qmi_wds_set_autoconnect_setting_request ac_req;
+       const char *modes[] = {
+               [QMI_WDS_AUTOCONNECT_DISABLED] = "disabled",
+               [QMI_WDS_AUTOCONNECT_ENABLED] = "enabled",
+               [QMI_WDS_AUTOCONNECT_PAUSED] = "paused",
+       };
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(modes); i++) {
+               if (strcasecmp(modes[i], arg) != 0)
+                       continue;
+
+               qmi_set(&ac_req, setting, i);
+               qmi_set_wds_set_autoconnect_setting_request(msg, &ac_req);
+               return QMI_CMD_DONE;
+       }
+
+       uqmi_add_error("Invalid value (valid: disabled, enabled, paused)");
+       return QMI_CMD_EXIT;
+}
+
 #define cmd_wds_reset_cb no_cb
 static enum qmi_cmd_result
 cmd_wds_reset_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
index 60e922d71c5ddb2c254107b1022051e9612a0f20..c1985b34a99b5f1d6768897065d8b0ffa31824ed 100644 (file)
@@ -6,6 +6,7 @@
        __uqmi_command(wds_set_autoconnect, autoconnect, no, CMD_TYPE_OPTION), \
        __uqmi_command(wds_stop_network, stop-network, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_get_packet_service_status, get-data-status, no, QMI_SERVICE_WDS), \
+       __uqmi_command(wds_set_autoconnect_setting, set-autoconnect, required, QMI_SERVICE_WDS), \
        __uqmi_command(wds_reset, reset-wds, no, QMI_SERVICE_WDS) \
 
 
@@ -18,4 +19,5 @@
                "  --stop-network <pdh>:             Stop network connection (use with option below)\n" \
                "    --autoconnect:                  Disable automatic connect/reconnect\n" \
                "  --get-data-status:                Get current data access status\n" \
+               "  --set-autoconnect <val>:          Get current data access status (disabled, enabled, paused)\n" \
 
index 1788a78bc8b5e147d23460f73dfafa9ac3314cef..ab48e8a6ab5dc5d173621316cb64371d2009e9f7 100644 (file)
                       "public-format" : "QmiWdsExtendedTechnologyPreference",
                       "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
 
+  // *********************************************************************************
+  {  "name"    : "Get Autoconnect Setting",
+     "type"    : "Message",
+     "service" : "WDS",
+     "id"      : "0x0034",
+     "version" : "1.0",
+     "output"  : [  { "common-ref" : "Operation Result" },
+                    { "name"          : "Setting",
+                      "id"            : "0x01",
+                      "mandatory"     : "yes",
+                      "type"          : "TLV",
+                      "format"        : "gint8",
+                      "public-format" : "QmiWdsAutoconnectSetting",
+                      "prerequisites" : [ { "common-ref" : "Success" } ] },
+                    { "name"          : "Roaming",
+                      "id"            : "0x10",
+                      "mandatory"     : "no",
+                      "type"          : "TLV",
+                      "format"        : "gint8",
+                      "public-format" : "gboolean",
+                      "prerequisites" : [ { "common-ref" : "Success" } ] } ] },
+
   // *********************************************************************************
   {  "name"    : "Get Data Bearer Technology",
      "type"    : "Message",
                       "type"          : "TLV",
                       "format"        : "guint8",
                       "public-format" : "QmiWdsIpFamily" } ],
+     "output"  : [  { "common-ref" : "Operation Result" } ] },
+
+
+  // *********************************************************************************
+  {  "name"    : "Set Autoconnect Setting",
+     "type"    : "Message",
+     "service" : "WDS",
+     "id"      : "0x0051",
+     "version" : "1.0",
+     "input"   : [  { "name"          : "Setting",
+                      "id"            : "0x01",
+                      "mandatory"     : "yes",
+                      "type"          : "TLV",
+                      "format"        : "guint8",
+                      "public-format" : "QmiWdsAutoconnectSetting" },
+                    { "name"          : "Roaming",
+                      "id"            : "0x10",
+                      "mandatory"     : "no",
+                      "type"          : "TLV",
+                      "format"        : "guint8",
+                      "public-format" : "gboolean" } ],
      "output"  : [  { "common-ref" : "Operation Result" } ] }
 
 ]
index d9d6eb2b557e13030ab8d69fc41f58b3919e8b68..6af59363fbc1610303d926d37119acdc5763557b 100644 (file)
@@ -1002,4 +1002,16 @@ typedef enum {
     QMI_WDS_DS_PROFILE_ERROR_3GPP2_INVALID_PROFILE_ID    = 1101,
 } QmiWdsDsProfileError;
 
+/**
+ * QmiWdsAutoconnectSetting:
+ * @QMI_WDS_AUTOCONNECT_DISABLED: Disabled
+ * @QMI_WDS_AUTOCONNECT_ENABLED: Enabled
+ * @QMI_WDS_AUTOCONNECT_PAUSED: Paused (resume on power cycle)
+ */
+typedef enum {
+    QMI_WDS_AUTOCONNECT_DISABLED                         = 0,
+    QMI_WDS_AUTOCONNECT_ENABLED                          = 1,
+    QMI_WDS_AUTOCONNECT_PAUSED                           = 2,
+} QmiWdsAutoconnectSetting;
+
 #endif /* _LIBQMI_GLIB_QMI_ENUMS_WDS_H_ */