From 517bdc9e99b8151785acfdb0ae8a0ef99e6fc0dd Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Sun, 9 Jun 2013 01:01:13 +0200 Subject: [PATCH] implement --get-data-status --- commands-wds.c | 29 +++++++++++++++++++++++++++++ commands-wds.h | 5 ++++- 2 files changed, 33 insertions(+), 1 deletion(-) 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 : Start network connection (use with options below)\n" \ " --auth-type pap|chap|both|none: Use network authentication type\n" \ " --username : Use network username\n" \ " --password : Use network password\n" \ + " --get-data-status: Get current data access status\n" \ -- 2.25.1