2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
24 #include <tapi_common.h>
25 #include <ITapiModem.h>
27 #include <system_info.h>
28 #include <system_info_private.h>
34 #define LOG_TAG "TIZEN_N_SYSTEM_INFO"
36 int system_info_get_network_type(system_info_key_e key, system_info_data_type_e data_type, void **value)
39 char *NETWORK_TYPE = NULL;
41 if (system_info_vconf_get_value_int(VCONFKEY_TELEPHONY_SVCTYPE, &service_type))
42 return SYSTEM_INFO_ERROR_IO_ERROR;
44 switch (service_type) {
45 case VCONFKEY_TELEPHONY_SVCTYPE_NONE:
46 NETWORK_TYPE = strdup("NoService");
48 case VCONFKEY_TELEPHONY_SVCTYPE_NOSVC:
49 NETWORK_TYPE = strdup("NoService");
51 case VCONFKEY_TELEPHONY_SVCTYPE_EMERGENCY:
52 NETWORK_TYPE = strdup("Emergency");
54 case VCONFKEY_TELEPHONY_SVCTYPE_2G:
55 NETWORK_TYPE = strdup("GSM");
57 case VCONFKEY_TELEPHONY_SVCTYPE_2_5G:
58 NETWORK_TYPE = strdup("GPRS");
60 case VCONFKEY_TELEPHONY_SVCTYPE_2_5G_EDGE:
61 NETWORK_TYPE = strdup("EDGE");
63 case VCONFKEY_TELEPHONY_SVCTYPE_3G:
64 NETWORK_TYPE = strdup("UMTS");
66 case VCONFKEY_TELEPHONY_SVCTYPE_HSDPA:
67 NETWORK_TYPE = strdup("HSDPA");
71 if (NETWORK_TYPE == NULL) {
72 LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
73 return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
76 *value = NETWORK_TYPE;
78 return SYSTEM_INFO_ERROR_NONE;
81 int system_info_get_mobile_device_id(system_info_key_e key, system_info_data_type_e data_type, void **value)
83 TapiHandle *handle = NULL;
85 char *MOBILE_DEVICE_ID = NULL;
90 LOGE("[%s] tel_init ERROR", __func__);
92 return SYSTEM_INFO_ERROR_IO_ERROR;
95 imei = tel_get_misc_me_imei_sync(handle);
98 LOGE("[%s] IMEI value is NULL", __func__);
101 return SYSTEM_INFO_ERROR_IO_ERROR;
104 MOBILE_DEVICE_ID = strdup((char *)imei);
106 if (MOBILE_DEVICE_ID == NULL) {
107 LOGE("[%s] OUT_OF_MEMORY(0x%08x)", __func__, SYSTEM_INFO_ERROR_OUT_OF_MEMORY);
111 return SYSTEM_INFO_ERROR_OUT_OF_MEMORY;
116 *value = MOBILE_DEVICE_ID;
117 return SYSTEM_INFO_ERROR_NONE;