add command for getting signal strength info
authorFelix Fietkau <nbd@openwrt.org>
Sun, 17 Feb 2013 15:08:52 +0000 (16:08 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Sun, 17 Feb 2013 15:08:52 +0000 (16:08 +0100)
commands-nas.c
commands-nas.h

index aef2745c69bc23e68977dceda5c2d1e66208bb45..81975b28a4d96f4d4b9825bf3db2f88e14844c48 100644 (file)
@@ -1,3 +1,5 @@
+#include "qmi-message.h"
+
 static struct qmi_nas_set_system_selection_preference_request sel_req;
 
 #define cmd_nas_set_network_modes_cb no_cb
@@ -43,3 +45,44 @@ cmd_nas_set_network_modes_prepare(struct qmi_dev *qmi, struct qmi_request *req,
        return QMI_CMD_REQUEST;
 }
 
+static void
+cmd_nas_get_signal_info_cb(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg)
+{
+       struct qmi_nas_get_signal_info_response res;
+
+       qmi_parse_nas_get_signal_info_response(msg, &res);
+
+       if (res.set.cdma_signal_strength)
+               printf("cdma_rssi=%d\ncdma_ecio=%d\n",
+                       res.data.cdma_signal_strength.rssi,
+                       res.data.cdma_signal_strength.ecio);
+
+       if (res.set.hdr_signal_strength)
+               printf("hdr_rssi=%d\nhdr_ecio=%d\nhdr_io=%d\n",
+                       res.data.hdr_signal_strength.rssi,
+                       res.data.hdr_signal_strength.ecio,
+                       res.data.hdr_signal_strength.io);
+
+       if (res.set.gsm_signal_strength)
+               printf("gsm_rssi=%d\n", res.data.gsm_signal_strength);
+
+       if (res.set.wcdma_signal_strength)
+               printf("wcdma_rssi=%d\nwcdma_ecio=%d\n",
+                       res.data.wcdma_signal_strength.rssi,
+                       res.data.wcdma_signal_strength.ecio);
+
+       if (res.set.lte_signal_strength)
+               printf("lte_rssi=%d\nlte_rsrq=%d\nlte_rsrp=%d\nlte_snr=%d\n",
+                       res.data.lte_signal_strength.rssi,
+                       res.data.lte_signal_strength.rsrq,
+                       res.data.lte_signal_strength.rsrp,
+                       res.data.lte_signal_strength.snr);
+
+}
+
+static enum qmi_cmd_result
+cmd_nas_get_signal_info_prepare(struct qmi_dev *qmi, struct qmi_request *req, struct qmi_msg *msg, char *arg)
+{
+       qmi_set_nas_get_signal_info_request(msg);
+       return QMI_CMD_REQUEST;
+}
index b3e0154ce4286e01751b335d8fb0b0be8bd8174f..0cc11a138dad27c737e4d5425a1a691dd8190d6e 100644 (file)
@@ -1,7 +1,9 @@
 #define __uqmi_nas_commands \
-       __uqmi_command(nas_set_network_modes, set-network-modes, required, QMI_SERVICE_NAS) \
+       __uqmi_command(nas_set_network_modes, set-network-modes, required, QMI_SERVICE_NAS), \
+       __uqmi_command(nas_get_signal_info, get-signal-info, no, QMI_SERVICE_NAS) \
 
 #define nas_helptext \
                "  --set-network-modes <modes>:      Set preferred network mode (Syntax: <mode1>[,<mode2>,...])\n" \
-               "                                    Available modes: all, lte, umts, gsm, cdma, td-scdma\n"
+               "                                    Available modes: all, lte, umts, gsm, cdma, td-scdma\n" \
+               "  --get-signal-info:                Get signal strength info\n"