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.
21 #include <telephony_network.h>
28 #define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
30 static GMainLoop *event_loop;
32 static void rssi_changed_cb_impl(network_info_rssi_e rssi, void* user_data)
34 LOGI("[%s] Start rssi_changed_cb_impl", __FUNCTION__);
36 LOGI("[%s] RSSI: %d", __FUNCTION__, rssi);
37 LOGI("[%s] user data: %s", __FUNCTION__, user_data);
39 LOGI("[%s] End rssi_changed_cb_impl", __FUNCTION__);
40 g_main_loop_quit(event_loop);
45 if( network_info_set_rssi_changed_cb(rssi_changed_cb_impl, "rssi_changed_test") == NETWORK_INFO_ERROR_NONE )
47 LOGI("[%s] Succeeded to add callback function", __FUNCTION__);
51 LOGE("[%s] Failed to add callback function", __FUNCTION__);
55 LOGI("[%s] If RSSI is changed, then callback function will be called", __FUNCTION__);
56 event_loop = g_main_loop_new(NULL, FALSE);
57 g_main_loop_run(event_loop);
59 if( network_info_unset_rssi_changed_cb() == NETWORK_INFO_ERROR_NONE )
61 LOGI("[%s] Succeeded to remove callback function", __FUNCTION__);
65 LOGE("[%s] Failed to remove callback function", __FUNCTION__);