Patch version revert to build other pakages
[platform/core/api/network-info.git] / test / network_info_get_mnc_test.c
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18
19 #include <stdio.h>
20 #include <telephony_network.h>
21 #include <stdlib.h>
22 #include <dlog.h>
23
24 #ifdef LOG_TAG
25 #undef LOG_TAG
26 #endif
27 #define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
28
29
30 int main()
31 {
32         int ret = 0;
33         char* mnc = NULL;
34         int ret_value = network_info_get_mnc(&mnc);
35
36         switch(ret_value)
37         {
38                 case NETWORK_INFO_ERROR_NONE:
39                         LOGI("[%s] Mobile Network Code is %s", __FUNCTION__, mnc);
40                         ret = 0;
41                         free(mnc);
42                         break;
43                 case NETWORK_INFO_ERROR_INVALID_PARAMETER:
44                         LOGI("[%s] Invalid parameter", __FUNCTION__);
45                         ret = -1;
46                         break;
47                 case NETWORK_INFO_ERROR_OUT_OF_MEMORY:
48                         printf("[%s] Out of memory", __FUNCTION__);
49                         ret = -1;
50                         break;
51                 case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
52                         LOGI("[%s] Out of service", __FUNCTION__);
53                         ret = -1;
54                         break;
55                 case NETWORK_INFO_ERROR_OPERATION_FAILED:
56                         LOGI("[%s] Cannot find Mobile Network Code value", __FUNCTION__);
57                         ret = -1;
58                         break;
59                 default:
60                         LOGI("[%s] Unexpected return value", __FUNCTION__);
61                         ret = -1;
62                         break;
63         }
64
65         return ret;
66 }