Add command --get-msisdn for getting phone number
authorSÅ‚awomir Demeszko <s.demeszko@wireless-instruments.com>
Tue, 18 Nov 2014 15:02:00 +0000 (15:02 +0000)
committerJohn Crispin <blogic@openwrt.org>
Tue, 18 Nov 2014 21:01:05 +0000 (22:01 +0100)
commands-dms.c
commands-dms.h

index 563321e5c76bbece2f2bc3eea3dc1c0ce57081fe..ad5c89d3ab744be07b05920478317f75e1e96d1c 100644 (file)
@@ -159,6 +159,22 @@ cmd_dms_get_imsi_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qm
        return QMI_CMD_REQUEST;
 }
 
+static void cmd_dms_get_msisdn_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+       struct qmi_dms_get_msisdn_response res;
+
+       qmi_parse_dms_get_msisdn_response(msg, &res);
+       if (res.data.msisdn)
+               blobmsg_add_string(&status, NULL, res.data.msisdn);
+}
+
+static enum qmi_cmd_result
+cmd_dms_get_msisdn_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_dms_get_msisdn_request(msg);
+       return QMI_CMD_REQUEST;
+}
+
 #define cmd_dms_reset_cb no_cb
 static enum qmi_cmd_result
 cmd_dms_reset_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
index 1f21b1361d0ad5fab4cfee8a2f900bae335774eb..c20d0070adc476c1c076d5f3eb45d33a32a549e4 100644 (file)
@@ -8,6 +8,7 @@
        __uqmi_command(dms_set_new_pin, new-pin, required, CMD_TYPE_OPTION), \
        __uqmi_command(dms_get_iccid, get-iccid, no, QMI_SERVICE_DMS), \
        __uqmi_command(dms_get_imsi, get-imsi, no, QMI_SERVICE_DMS), \
+       __uqmi_command(dms_get_msisdn, get-msisdn, no, QMI_SERVICE_DMS), \
        __uqmi_command(dms_set_operating_mode, set-device-operating-mode, required, QMI_SERVICE_DMS), \
        __uqmi_command(dms_reset, reset-dms, no, QMI_SERVICE_DMS) \
 
@@ -23,6 +24,7 @@
                "    --new-pin <new pin>:            New pin\n" \
                "  --get-iccid:                      Get the ICCID\n" \
                "  --get-imsi:                       Get International Mobile Subscriber ID\n" \
+    "  --get-msisdn:                     Get the MSISDN (telephone number)\n" \
                "  --reset-dms:                      Reset the DMS service\n" \
                "  --set-device-operating-mode <m>   Set the device operating mode\n" \
                "                                    (modes: online, low_power, factory_test, offline\n" \