return false;
}
+static void _noti_modem_power(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ int *status = (int *)data;
+
+ std::cout << std::endl;
+ std::cout << "<<notification received - Modem:Power>>" << std::endl;
+ if (!status)
+ return;
+ std::cout << " [status]: " << *status << "(0:ON,1:OFF,2:RST,3:LOW)" << std::endl << std::endl;
+}
+
+static void _noti_registration_status(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ TelNetworkRegistrationStatus_t *noti = (TelNetworkRegistrationStatus_t *)data;
+
+ int svc_type;
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+
+ std::cout << std::endl;
+ std::cout << "<<notification received - Network:RegistrationStatus>>" << std::endl;
+
+ std::cout << " [service_type]: " << svc_type << "(1=No Service, 2=Emergency, 4=2G, 7=3G, 9=LTE)" << std::endl;
+ std::cout << " [cs status]: " << noti->cs << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)" << std::endl;
+ std::cout << " [ps status]: " << noti->ps << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)" << std::endl;
+ std::cout << " [is roaming]: " << noti->is_roaming << std::endl << std::endl;
+}
+
static void _get_flight_mode_callback(TapiHandle *handle, int result, void *data, void *user_data)
{
int *mode = (int *)data;
std::cout << "tel_get_flight_mode() response receive" << std::endl;
- std::cout << " - result = " << result << " (0=Success)" << std::endl;
+ std::cout << " [result]: " << result << " (0=Success)" << std::endl;
async_result = result;
if (mode)
- std::cout << " - mode = " << *mode << " (0=flight mode OFF, 1=flight mode ON)" <<std::endl;
+ std::cout << " [mode]: " << *mode << " (0=flight mode OFF, 1=flight mode ON)" <<std::endl;
else
- std::cout << " - mode is invalid" << std::endl;
+ std::cout << " [mode is invalid]" << std::endl;
+
+ QUIT_GMAIN_LOOP;
+
+}
+
+static void _set_flight_mode_callback(TapiHandle *handle, int result, void *data, void *user_data)
+{
+ std::cout << "tel_set_flight_mode() response receive" << std::endl;
+ std::cout << " [result]: " << result << " (1=FLIGHT_MODE_ON, 2=FLIGHT_MODE_OFF)" << std::endl;
+ async_result = ASYNC_RESULT_SUCCESS;
QUIT_GMAIN_LOOP;
std::cout << "tel_get_sim_iccid() response received" << std::endl;
+ if (sim_card_status == TAPI_SIM_STATUS_CARD_ERROR
+ || sim_card_status == TAPI_SIM_STATUS_CARD_BLOCKED
+ || sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT
+ || sim_card_status == TAPI_SIM_STATUS_CARD_REMOVED
+ || sim_card_status == TAPI_SIM_STATUS_UNKNOWN) {
+ std::cout << " [MSISDN is unavaliable due to abnormal SIM card status" << std::endl;
+ async_result = ASYNC_RESULT_SUCCESS;
+ QUIT_GMAIN_LOOP;
+
+ return;
+ }
+
if ( access_rt == TAPI_SIM_ACCESS_SUCCESS) {
async_result = ASYNC_RESULT_SUCCESS;
- std::cout << " - iccid length = " << iccid->icc_length << std::endl;
- std::cout << " - iccid = " << iccid->icc_num << std::endl;
+ std::cout << " [iccid length]: " << iccid->icc_length << std::endl;
+ std::cout << " [iccid]: " << iccid->icc_num << std::endl;
}
QUIT_GMAIN_LOOP;
std::cout << "tel_get_sim_msisdn() response received" << std::endl;
- if ( access_rt == TAPI_SIM_ACCESS_SUCCESS) {
+ if (sim_card_status == TAPI_SIM_STATUS_CARD_ERROR
+ || sim_card_status == TAPI_SIM_STATUS_CARD_BLOCKED
+ || sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT
+ || sim_card_status == TAPI_SIM_STATUS_CARD_REMOVED
+ || sim_card_status == TAPI_SIM_STATUS_UNKNOWN) {
+ std::cout << " [MSISDN is unavaliable due to abnormal SIM card status" << std::endl;
+ async_result = ASYNC_RESULT_SUCCESS;
+ QUIT_GMAIN_LOOP;
+
+ return;
+ }
+
+ if ( access_rt == TAPI_SIM_ACCESS_SUCCESS && list) {
async_result = ASYNC_RESULT_SUCCESS;
- std::cout << " - list->count = " << list->count << std::endl;
+ std::cout << " [list->count]: " << list->count << std::endl;
if (list->count > 0)
- std::cout << " - msisdn[0] : name = " << list->list[0].name << ", num = " << list->list[0].num << std::endl;
+ std::cout << " [msisdn[0]]: name = " << list->list[0].name << ", num = " << list->list[0].num << std::endl;
}
QUIT_GMAIN_LOOP;
i++;
}
ASSERT_TRUE(cp_count > 0) << "cp_count is 0" << std::endl;
- std::cout << " - cp_count:" << cp_count << std::endl;
- std::cout << " - cp_list[0] = " << cp_list[0] << std::endl;
+ std::cout << " [cp_count]: " << cp_count << std::endl;
+ std::cout << " [cp_list[0]]: " << cp_list[0] << std::endl;
}
TEST(TAPI_INIT, tel_init_P)
std::cout << " - telephony_state : TELEPHONY_STATE_READY" << std::endl;
}
+TEST(TAPI_INIT, tel_register_noti_event_P)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ int ret = 0;
+ ret = tel_register_noti_event(tapi_h, TAPI_NOTI_MODEM_POWER, _noti_modem_power, NULL);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_register_noti_event() : TAPI_NOTI_MODEM_POWER is failed" << std::endl;
+
+ ret = tel_register_noti_event(tapi_h, TAPI_NOTI_NETWORK_REGISTRATION_STATUS, _noti_registration_status, NULL);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_register_noti_event() : TAPI_NOTI_NETWORK_REGISTRATION_STATUS is failed" << std::endl;
+
+}
+
+TEST(TAPI_NETWORK, tel_get_property_int_P)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ int svc_type = -1, act = -1, cs = -1, ps = -1;
+ int roam = -1, sig_level = -1;
+
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ACT, &act);
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_CIRCUIT_STATUS, &cs);
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_PACKET_STATUS, &ps);
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &sig_level);
+ tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ROAMING_STATUS, &roam);
+
+ std::cout << "<network properties>" << std::endl;
+ std::cout << " [service_type]: " << svc_type << "(1=No Service, 2=Emergency, 4=2G, 7=3G, 9=LTE)" << std::endl;
+ std::cout << " [access technology]: " << act << "(0=No Service, 1=GSM, 5=UMTS, 7=HSDPA, 19=LTE)" << std::endl;
+ std::cout << " [cs_status]: " << cs << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)"<< std::endl;
+ std::cout << " [ps_status]: " << ps << "(0=No Service, 1=Emergency, 2=Avaliable, 3=Searching)"<< std::endl;
+ std::cout << " [sig_level]: " << sig_level << std::endl;
+ std::cout << " [roaming_status]: " << roam << std::endl;
+}
+
+TEST(TAPI_NETWORK, tel_get_property_string_P)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ char *plmn = NULL, *n_name = NULL, *s_name = NULL;
+
+ tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_PLMN, &plmn);
+ tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_NETWORK_NAME, &n_name);
+ tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_SPN_NAME, &s_name);
+
+ std::cout << "<network properties>" << std::endl;
+ std::cout << " [plmn]: " << plmn << std::endl;
+ std::cout << " [network_name]: " << n_name << std::endl;
+ std::cout << " [spn_name]: " << s_name << std::endl;
+
+ g_free(plmn);
+ g_free(n_name);
+ g_free(s_name);
+
+}
+
+
TEST(TAPI_MODEM, telephony_modem_get_power_status_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
info = tel_get_misc_me_version_sync(tapi_h);
EXPECT_TRUE(NULL != info) << "tel_get_misc_me_version_sync() is failed" << std::endl;
- std::cout << " - sw version = " << info->szSwVersion << std::endl;
- std::cout << " - hw version = " << info->szHwVersion << std::endl;
- std::cout << " - RfCal Date = " << info->szRfCalDate << std::endl;
- std::cout << " - Product Code = " << info->szProductCode << std::endl;
- std::cout << " - Model ID = " << info->szModelId << std::endl;
- std::cout << " - Prl Version = " << info->szPrlVersion << std::endl;
- std::cout << " - ERI Version = " << info->szEriVersion << std::endl;
+ std::cout << " [sw version]: " << info->szSwVersion << std::endl;
+ std::cout << " [hw version]: " << info->szHwVersion << std::endl;
+ std::cout << " [RfCal Date]: " << info->szRfCalDate << std::endl;
+ std::cout << " [Product Code]: " << info->szProductCode << std::endl;
+ std::cout << " [Model ID]: " << info->szModelId << std::endl;
+ std::cout << " [Prl Version]: " << info->szPrlVersion << std::endl;
+ std::cout << " [ERI Version]: " << info->szEriVersion << std::endl;
free(info);
}
EXPECT_TRUE(NULL != sn) << "tel_get_misc_me_sn_sync() is failed" << std::endl;
- std::cout << " - esn number = " << sn->szEsn << std::endl;
- std::cout << " - meid number = " << sn->szMeid << std::endl;
- std::cout << " - imei number = " << sn->szImei << std::endl;
- std::cout << " - imeisv number = " << sn->szImeiSv << std::endl;
+ std::cout << " [esn number]: " << sn->szEsn << std::endl;
+ std::cout << " [meid number]: " << sn->szMeid << std::endl;
+ std::cout << " [imei number]: " << sn->szImei << std::endl;
+ std::cout << " [imeisv number]: " << sn->szImeiSv << std::endl;
free(sn);
}
imei = tel_get_misc_me_imei_sync(tapi_h);
EXPECT_TRUE(NULL != imei) << "tel_get_misc_me_imei_sync() is failed" << std::endl;
- std::cout << " - imei number = " << imei << std::endl;
+ std::cout << " [imei number]: " << imei << std::endl;
free(imei);
}
-TEST(TAPI_MODEM, tel_get_flight_mode_P)
+TEST(TAPI_MODEM, tel_get_flight_mode_P1)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
async_result = ASYNC_RESULT_UNKNOWN;
}
+TEST(TAPI_MODEM, tel_set_flight_mode_on)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ int ret = tel_set_flight_mode(tapi_h, TAPI_POWER_FLIGHT_MODE_ENTER, _set_flight_mode_callback, NULL);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_set_flight_mode() is failed" << std::endl;
+
+ RUN_GMAIN_LOOP(__timeout_callback);
+
+ EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_set_flight_mode()[ON] is failed failed";
+ async_result = ASYNC_RESULT_UNKNOWN;
+}
+
+TEST(TAPI_MODEM, tel_get_flight_mode_P2)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ int ret = tel_get_flight_mode(tapi_h, _get_flight_mode_callback, NULL);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_flight_mode() is failed" << std::endl;
+
+ RUN_GMAIN_LOOP(__timeout_callback);
+
+ EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_flight_mode() is failed failed";
+ async_result = ASYNC_RESULT_UNKNOWN;
+}
+
+TEST(TAPI_MODEM, tel_set_flight_mode_off)
+{
+ ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
+ ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
+
+ int ret = tel_set_flight_mode(tapi_h, TAPI_POWER_FLIGHT_MODE_LEAVE, _set_flight_mode_callback, NULL);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_set_flight_mode() is failed" << std::endl;
+
+ RUN_GMAIN_LOOP(__timeout_callback);
+
+ EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_set_flight_mode()[OFF] is failed failed";
+ async_result = ASYNC_RESULT_UNKNOWN;
+}
+
TEST(TAPI_SIM, tel_get_sim_init_info_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_init_info() is failed" << std::endl;
if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
- std::cout << " - SIM status = SIM_INIT_COMPLETED" << std::endl;
- std::cout << " - SIM changed = " << sim_card_changed<< std::endl;
+ std::cout << " [SIM status]: SIM_INIT_COMPLETED" << std::endl;
+ std::cout << " [SIM changed]: " << sim_card_changed<< std::endl;
} else if (sim_card_status == TAPI_SIM_STATUS_CARD_NOT_PRESENT) {
- std::cout << "- SIM status = No SIM" << std::endl;
+ std::cout << " [SIM status]: No SIM" << std::endl;
} else {
- std::cout << "- SIM status = SIM card Error" << std::endl;
+ std::cout << " [SIM status]: SIM card Error" << std::endl;
}
-
}
TEST(TAPI_SIM, tel_get_sim_imsi_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
- ASSERT_TRUE(sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) << "SIM status is invalid" << std::endl;
int ret = 0;
TelSimImsiInfo_t imsi;
memset(&imsi, 0, sizeof(TelSimImsiInfo_t));
+ if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
ret = tel_get_sim_imsi(tapi_h, &imsi);
EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_imsi() is failed" << std::endl;
- std::cout << " - mcc = "<< imsi.szMcc << std::endl;
- std::cout << " - mnc = " << imsi.szMnc << std::endl;
- std::cout << " - msin = " << imsi.szMsin << std::endl;
+ std::cout << " [mcc]: "<< imsi.szMcc << std::endl;
+ std::cout << " [mnc]: " << imsi.szMnc << std::endl;
+ std::cout << " [msin]: " << imsi.szMsin << std::endl;
+ }
}
TEST(TAPI_SIM, tel_get_sim_iccid_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
- ASSERT_TRUE(sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) << "SIM status is invalid" << std::endl;
int ret = tel_get_sim_iccid(tapi_h, _get_sim_iccid_callback, NULL);
EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_iccid() is failed" << std::endl;
- RUN_GMAIN_LOOP(__timeout_callback);
+ if (sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) {
+ RUN_GMAIN_LOOP(__timeout_callback);
- EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_sim_iccid() is failed failed";
- async_result = ASYNC_RESULT_UNKNOWN;
+ EXPECT_EQ(ASYNC_RESULT_SUCCESS, async_result) << "tel_get_sim_iccid() is failed failed";
+ async_result = ASYNC_RESULT_UNKNOWN;
+ }
}
TEST(TAPI_SIM, tel_get_sim_msisdn_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
- ASSERT_TRUE(sim_card_status == TAPI_SIM_STATUS_SIM_INIT_COMPLETED) << "SIM status is invalid" << std::endl;
int ret = tel_get_sim_msisdn(tapi_h, _get_sim_msisdn_callback, NULL);
EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_get_sim_msisdn() is failed" << std::endl;
async_result = ASYNC_RESULT_UNKNOWN;
}
-TEST(TAPI_NETWORK, tel_get_network_properties_P)
+TEST(TAPI_DEINIT, tel_deregister_noti_event_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;
ASSERT_TRUE(tapi_h != NULL) << "tapi_h is NULL" << std::endl;
- int svc_type = -1, act = -1, ps_type = -1, cs = -1, ps = -1;
- int roam = -1, sig_level = -1;
- char *plmn = NULL, *n_name = NULL, *s_name = NULL;
-
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SERVICE_TYPE, &svc_type);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ACT, &act);
- tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_PLMN, &plmn);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_PS_TYPE, &ps_type);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_CIRCUIT_STATUS, &cs);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_PACKET_STATUS, &ps);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_SIGNALSTRENGTH_LEVEL, &sig_level);
- tel_get_property_int(tapi_h, TAPI_PROP_NETWORK_ROAMING_STATUS, &roam);
- tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_NETWORK_NAME, &n_name);
- tel_get_property_string(tapi_h, TAPI_PROP_NETWORK_SPN_NAME, &s_name);
-
- std::cout << "<network properties>" << std::endl;
- std::cout <<" [service_type]: " << svc_type << std::endl;
- std::cout <<" [act]: " << act << std::endl;
- std::cout <<" [plmn]: " << plmn << std::endl;
- std::cout <<" [ps_type]: " <<ps_type << std::endl;
- std::cout <<" [cs_status]: " << cs << std::endl;
- std::cout <<" [ps_status]: " << ps << std::endl;
- std::cout <<" [sig_level]: " << sig_level << std::endl;
- std::cout <<" [roaming_status]: " << roam << std::endl;
- std::cout <<" [network_name]: " << n_name << std::endl;
- std::cout <<" [spn_name]: " << s_name << std::endl;
-
- g_free(plmn);
- g_free(n_name);
- g_free(s_name);
+ int ret = 0;
+ ret = tel_deregister_noti_event(tapi_h, TAPI_NOTI_MODEM_POWER);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_deregister_noti_event() : TAPI_NOTI_MODEM_POWER is failed" << std::endl;
+ ret = tel_deregister_noti_event(tapi_h, TAPI_NOTI_NETWORK_REGISTRATION_STATUS);
+ EXPECT_EQ(TAPI_API_SUCCESS, ret) << "tel_deregister_noti_event() : TAPI_NOTI_NETWORK_REGISTRATION_STATUS is failed" << std::endl;
}
-
TEST(TAPI_DEINIT, tel_deinit_P)
{
ASSERT_EQ(true, g_bFeatureTelephony) << FEATRE_NOT_SUPPORT << std::endl;