summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2013-06-09 01:01:13 +0200
committerFelix Fietkau <nbd@openwrt.org>2013-06-09 01:01:13 +0200
commit517bdc9e99b8151785acfdb0ae8a0ef99e6fc0dd (patch)
tree7e4b60b6d64817bde4e12c2f66e581f094ad4cc0
parent873c7d071f1cc0fbb4c58649a55a4cf78bdd397e (diff)
implement --get-data-status
-rw-r--r--commands-wds.c29
-rw-r--r--commands-wds.h5
2 files changed, 33 insertions, 1 deletions
diff --git a/commands-wds.c b/commands-wds.c
index 2128bbf..526c1dd 100644
--- a/commands-wds.c
+++ b/commands-wds.c
@@ -65,3 +65,32 @@ cmd_wds_start_network_prepare(struct qmi_dev *qmi, struct qmi_request *req, stru
qmi_set_wds_start_network_request(msg, &wds_sn_req);
return QMI_CMD_REQUEST;
}
+
+static void
+cmd_wds_get_packet_service_status_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+ struct qmi_wds_get_packet_service_status_response res;
+ const char *data_status[] = {
+ [QMI_WDS_CONNECTION_STATUS_UNKNOWN] = "unknown",
+ [QMI_WDS_CONNECTION_STATUS_DISCONNECTED] = "disconnected",
+ [QMI_WDS_CONNECTION_STATUS_CONNECTED] = "connected",
+ [QMI_WDS_CONNECTION_STATUS_SUSPENDED] = "suspended",
+ [QMI_WDS_CONNECTION_STATUS_AUTHENTICATING] = "authenticating",
+ };
+ int s = 0;
+
+ qmi_parse_wds_get_packet_service_status_response(msg, &res);
+ if (res.set.connection_status &&
+ res.data.connection_status >= 0 &&
+ res.data.connection_status < ARRAY_SIZE(data_status))
+ s = res.data.connection_status;
+
+ blobmsg_add_string(&status, NULL, data_status[s]);
+}
+
+static enum qmi_cmd_result
+cmd_wds_get_packet_service_status_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+ qmi_set_wds_get_packet_service_status_request(msg);
+ return QMI_CMD_REQUEST;
+}
diff --git a/commands-wds.h b/commands-wds.h
index b6198c2..c205057 100644
--- a/commands-wds.h
+++ b/commands-wds.h
@@ -2,11 +2,14 @@
__uqmi_command(wds_start_network, start-network, required, QMI_SERVICE_WDS), \
__uqmi_command(wds_set_auth, auth-type, required, CMD_TYPE_OPTION), \
__uqmi_command(wds_set_username, username, required, CMD_TYPE_OPTION), \
- __uqmi_command(wds_set_password, password, required, CMD_TYPE_OPTION)
+ __uqmi_command(wds_set_password, password, required, CMD_TYPE_OPTION), \
+ __uqmi_command(wds_get_packet_service_status, get-data-status, no, CMD_TYPE_OPTION) \
+
#define wds_helptext \
" --start-network <apn>: Start network connection (use with options below)\n" \
" --auth-type pap|chap|both|none: Use network authentication type\n" \
" --username <name>: Use network username\n" \
" --password <password>: Use network password\n" \
+ " --get-data-status: Get current data access status\n" \