+
+ ret = __ctsvc_server_sim_get_type_and_iccid(info);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "__ctsvc_server_sim_get_type_and_iccid() Fail(%d)", ret);
+ ret = tel_get_sim_pb_init_info(info->handle, &sim_stat, &pb_list);
+ if (TAPI_API_SUCCESS == ret && ((1 == pb_list.b_3g) || (1 == pb_list.b_adn))) {
+ ret = __ctsvc_server_sim_init_meta_info(info);
+ WARN_IF(CONTACTS_ERROR_NONE != ret, "__ctsvc_server_sim_init_meta_info() Fail(%d)", ret);
+ }
+
+ ret = tel_register_noti_event(info->handle, TAPI_NOTI_PB_STATUS, __ctsvc_server_sim_noti_pb_status, info);
+ WARN_IF(TAPI_API_SUCCESS != ret, "tel_register_noti_event() Fail(%d)", ret);
+
+ ret = tel_register_noti_event(info->handle, TAPI_NOTI_SIM_REFRESHED, __ctsvc_server_sim_noti_sim_refreshed, info);
+ WARN_IF(TAPI_API_SUCCESS != ret, "tel_register_noti_event() Fail(%d)", ret);
+}
+
+static void __ctsvc_server_sim_status_events_cb(TapiHandle *handle, const char *noti_id, void *data, void *user_data)
+{
+ int ret;
+
+ RET_IF(NULL == data);
+ RET_IF(NULL == user_data);
+
+ TelSimCardStatus_t status = *(int *)data;
+ ctsvc_sim_info_s *info = (ctsvc_sim_info_s *)user_data;
+
+ if (TAPI_SIM_STATUS_SIM_INIT_COMPLETED != status) {
+ ERR("sim is not ready (%d)", status);
+ return;
+ }
+ INFO("sim is Ready");
+
+ ret = tel_deregister_noti_event(info->handle, TAPI_NOTI_SIM_STATUS);
+ WARN_IF(TAPI_API_SUCCESS != ret, "tel_deregister_noti_event() Fail(%d)", ret);
+
+ ctsvc_server_stop_timeout();
+ __ctsvc_server_sim_get_info(info);
+ ctsvc_server_start_timeout();
+}
+
+static int __ctsvc_server_sim_init_info()
+{
+ int ret;