qcdm: add command to get MDN (ie, phone number)

This commit is contained in:
Dan Williams
2010-02-22 12:17:27 -08:00
parent 7d151e6ae0
commit 3d617b7bf6
5 changed files with 130 additions and 2 deletions
+27 -2
View File
@@ -204,7 +204,7 @@ test_com (void *f, void *data)
TestComData *d = data;
gboolean success;
GError *error = NULL;
char buf[100];
char buf[512];
const char *str;
gint len;
QCDMResult *result;
@@ -219,6 +219,8 @@ test_com (void *f, void *data)
}
g_assert (success);
/*** Get the device's firmware version information ***/
len = qcdm_cmd_version_info_new (buf, sizeof (buf), NULL);
g_assert (len == 4);
@@ -255,7 +257,7 @@ test_com (void *f, void *data)
qcdm_result_unref (result);
/* Get the device's ESN */
/*** Get the device's ESN ***/
len = qcdm_cmd_esn_new (buf, sizeof (buf), NULL);
g_assert (len == 4);
@@ -276,5 +278,28 @@ test_com (void *f, void *data)
g_message ("%s: ESN: %s", __func__, str);
qcdm_result_unref (result);
/*** Get the device's phone number ***/
len = qcdm_cmd_nv_get_mdn_new (buf, sizeof (buf), 0, NULL);
g_assert (len > 0);
/* Send the command */
success = send_command (d, buf, len);
g_assert (success);
/* Get a response */
reply_len = wait_reply (d, buf, sizeof (buf));
/* Parse the response into a result structure */
result = qcdm_cmd_nv_get_mdn_result (buf, reply_len, &error);
g_assert (result);
str = NULL;
qcdm_result_get_string (result, QCDM_CMD_NV_GET_MDN_ITEM_MDN, &str);
g_message ("%s: MDN: %s", __func__, str);
qcdm_result_unref (result);
}