diff options
Diffstat (limited to 'libwmc/tests')
-rw-r--r-- | libwmc/tests/test-wmc-com.c | 65 | ||||
-rw-r--r-- | libwmc/tests/test-wmc-com.h | 2 | ||||
-rw-r--r-- | libwmc/tests/test-wmc.c | 1 |
3 files changed, 67 insertions, 1 deletions
diff --git a/libwmc/tests/test-wmc-com.c b/libwmc/tests/test-wmc-com.c index bf906ed6..203aeefe 100644 --- a/libwmc/tests/test-wmc-com.c +++ b/libwmc/tests/test-wmc-com.c @@ -258,7 +258,7 @@ test_com_device_info (void *f, void *data) TestComData *d = data; gboolean success; char buf[1024]; - const char *str; + const char *str, *str2; gint len; WmcResult *result; gsize reply_len; @@ -295,6 +295,69 @@ test_com_device_info (void *f, void *data) wmc_result_get_string (result, WMC_CMD_DEVICE_INFO_ITEM_HW_REVISION, &str); g_message ("%s: HW Revision: %s", __func__, str); + str = NULL; + wmc_result_get_string (result, WMC_CMD_DEVICE_INFO_ITEM_IMEI, &str); + g_message ("%s: IMEI: %s", __func__, str ? str : "(none)"); + + str = NULL; + wmc_result_get_string (result, WMC_CMD_DEVICE_INFO_ITEM_IMSI, &str); + g_message ("%s: IMSI: %s", __func__, str ? str : "(none)"); + + str = NULL; + wmc_result_get_string (result, WMC_CMD_DEVICE_INFO_ITEM_MCC, &str); + str2 = NULL; + wmc_result_get_string (result, WMC_CMD_DEVICE_INFO_ITEM_MNC, &str2); + g_message ("%s: MCC/MNC: %s %s", __func__, + str ? str : "(none)", + str2 ? str2 : "(none)"); + + wmc_result_unref (result); +} + +void +test_com_status (void *f, void *data) +{ + TestComData *d = data; + gboolean success; + char buf[1024]; + const char *str; + u_int8_t dbm; + gint len; + WmcResult *result; + gsize reply_len; + + len = wmc_cmd_status_new (buf, sizeof (buf)); + g_assert (len == 2); + + /* Send the command */ + success = send_command (d, buf, sizeof (buf), len); + g_assert (success); + + /* Get a response */ + reply_len = wait_reply (d, buf, sizeof (buf)); + + /* Parse the response into a result structure */ + result = wmc_cmd_status_result (buf, reply_len); + g_assert (result); + + g_print ("\n"); + + dbm = 0; + wmc_result_get_u8 (result, WMC_CMD_STATUS_ITEM_CDMA_DBM, &dbm); + g_message ("%s: CDMA 1x dBm: %d", __func__, dbm); + + dbm = 0; + wmc_result_get_u8 (result, WMC_CMD_STATUS_ITEM_HDR_DBM, &dbm); + g_message ("%s: HDR dBm: %d", __func__, dbm); + + dbm = 0; + wmc_result_get_u8 (result, WMC_CMD_STATUS_ITEM_LTE_DBM, &dbm); + g_message ("%s: LTE dBm: %d", __func__, dbm); + + str = NULL; + wmc_result_get_string (result, WMC_CMD_STATUS_ITEM_OPNAME, &str); + g_message ("%s: Operator Name: %s", __func__, str ? str : "(none)"); + wmc_result_unref (result); } diff --git a/libwmc/tests/test-wmc-com.h b/libwmc/tests/test-wmc-com.h index a26d364f..6c3d2a07 100644 --- a/libwmc/tests/test-wmc-com.h +++ b/libwmc/tests/test-wmc-com.h @@ -27,5 +27,7 @@ void test_com_init (void *f, void *data); void test_com_device_info (void *f, void *data); +void test_com_status (void *f, void *data); + #endif /* TEST_WMC_COM_H */ diff --git a/libwmc/tests/test-wmc.c b/libwmc/tests/test-wmc.c index 91a2c271..6479312a 100644 --- a/libwmc/tests/test-wmc.c +++ b/libwmc/tests/test-wmc.c @@ -102,6 +102,7 @@ int main (int argc, char **argv) g_test_suite_add (suite, TESTCASE (test_com_port_init, data->com_data)); g_test_suite_add (suite, TESTCASE (test_com_init, data->com_data)); g_test_suite_add (suite, TESTCASE (test_com_device_info, data->com_data)); + g_test_suite_add (suite, TESTCASE (test_com_status, data->com_data)); } result = g_test_run (); |