SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
@ONLY
)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+ADD_SUBDIRECTORY(test)
IF(UNIX)
+%define major 3
+%define minor 0
+%define patchlevel 1
+
Name: capi-telephony-network-info
Summary: A Telephony Network Information library in Tizen Native API
-Version: 0.1.0
-Release: 11
+Version: %{major}.%{minor}.%{patchlevel}
+Release: 1
Group: C API
License: Apache-2.0
Source0: %{name}-%{version}.tar.gz
--- /dev/null
+SET(fw_test "${fw_name}-test")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_test} REQUIRED glib-2.0)
+FOREACH(flag ${${fw_test}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -Wall")
+
+#ADD_EXECUTABLE("system-sensor" system-sensor.c)
+#TARGET_LINK_LIBRARIES("system-sensor" ${fw_name} ${${fw_test}_LDFLAGS})
+
+aux_source_directory(. sources)
+FOREACH(src ${sources})
+ GET_FILENAME_COMPONENT(src_name ${src} NAME_WE)
+ MESSAGE("${src_name}")
+ ADD_EXECUTABLE(${src_name} ${src})
+ TARGET_LINK_LIBRARIES(${src_name} ${fw_name} ${${fw_test}_LDFLAGS})
+ENDFOREACH()
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+#include <stdio.h>
+#include <string.h>
+#include <telephony_network.h>
+#include <dlog.h>
+#include <glib.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+static GMainLoop *event_loop;
+
+static void cell_id_changed_cb_impl(int cell_id, void* user_data)
+{
+ LOGI("[%s] Start cell_id_changed_cb_impl", __FUNCTION__);
+
+ LOGI("[%s] Cell ID: %d", __FUNCTION__, cell_id);
+ LOGI("[%s] user data: %s", __FUNCTION__, user_data);
+
+ LOGI("[%s] End cell_id_changed_cb_impl", __FUNCTION__);
+ g_main_loop_quit(event_loop);
+}
+
+int main()
+{
+ if( network_info_set_cell_id_changed_cb(cell_id_changed_cb_impl, "cell_id_changed_test") == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to set callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to set callback function", __FUNCTION__);
+ return -1;
+ }
+
+ LOGI("[%s] If cell id is changed, then callback function will be called", __FUNCTION__);
+ event_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(event_loop);
+
+ if( network_info_unset_cell_id_changed_cb() == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to unset callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to unset callback function", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+
+int main()
+{
+ int ret = 0;
+ int cell_id = 0;
+ int ret_value = network_info_get_cell_id(&cell_id);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("[%s] Cell ID is %d", __FUNCTION__, cell_id);
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("[%s] Invalid parameter", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("[%s] Out of service\n", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("[%s] Cannot find Cell ID value\n", __FUNCTION__);
+ ret = -1;
+ break;
+ default:
+ LOGI("[%s] Unexpected return value\n", __FUNCTION__);
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+
+int main()
+{
+ int ret = 0;
+ int lac = 0;
+ int ret_value = network_info_get_lac(&lac);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("[%s] Location Area Code is %d", __FUNCTION__, lac);
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("[%s] Invalid parameter", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("[%s] Out of service", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("[%s] Cannot find Location Area Code value", __FUNCTION__);
+ ret = -1;
+ break;
+ default:
+ LOGI("[%s] Unexpected return value", __FUNCTION__);
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+
+int main()
+{
+ int ret = 0;
+ char* mcc = NULL;
+ int ret_value = network_info_get_mcc(&mcc);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("[%s] Mobile Country Code is %s", __FUNCTION__, mcc);
+ ret = 0;
+ free(mcc);
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("[%s] Invalid parameter", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_MEMORY:
+ LOGI("[%s] Out of memory", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("[%s] Out of service", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("[%s] Cannot find Mobile Country Code value", __FUNCTION__);
+ ret = -1;
+ break;
+ default:
+ LOGI("[%s] Unexpected return value", __FUNCTION__);
+ ret = -1;
+ break;
+ }
+
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+
+int main()
+{
+ int ret = 0;
+ char* mnc = NULL;
+ int ret_value = network_info_get_mnc(&mnc);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("[%s] Mobile Network Code is %s", __FUNCTION__, mnc);
+ ret = 0;
+ free(mnc);
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("[%s] Invalid parameter", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_MEMORY:
+ printf("[%s] Out of memory", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("[%s] Out of service", __FUNCTION__);
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("[%s] Cannot find Mobile Network Code value", __FUNCTION__);
+ ret = -1;
+ break;
+ default:
+ LOGI("[%s] Unexpected return value", __FUNCTION__);
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <stdlib.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+int main()
+{
+ int ret = 0;
+ char* provider_name = NULL;
+ int ret_value = network_info_get_provider_name(&provider_name);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("Provider name is %s", provider_name);
+ ret = 0;
+ free(provider_name);
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("Invalid parameter");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("Out of service");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("Cannot find provider name value");
+ ret = -1;
+ break;
+ default:
+ LOGI("Unexpected return value");
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+int main()
+{
+ int ret = 0;
+ network_info_rssi_e rssi = NETWORK_INFO_RSSI_0;
+ int ret_value = network_info_get_rssi(&rssi);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("Received Signal Strength Indicator is TELEPHONY_RSSI_%d", rssi);
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("Invalid parameter");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("Out of service");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("Cannot find Received Signal Strength Indicator value");
+ ret = -1;
+ break;
+ default:
+ LOGI("Unexpected return value");
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+int main()
+{
+ int ret = 0;
+ network_info_service_state_e network_service_state = NETWORK_INFO_SERVICE_STATE_OUT_OF_SERVICE;
+ int ret_value = network_info_get_service_state(&network_service_state);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ switch(network_service_state)
+ {
+ case NETWORK_INFO_SERVICE_STATE_IN_SERVICE:
+ LOGI("Service status is NETWORK_INFO_SERVICE_STATE_IN_SERVICE.");
+ break;
+ case NETWORK_INFO_SERVICE_STATE_OUT_OF_SERVICE:
+ LOGI("Service status is NETWORK_INFO_SERVICE_STATE_OUT_OF_SERVICE.");
+ break;
+ case NETWORK_INFO_SERVICE_STATE_EMERGENCY_ONLY:
+ LOGI("Service status is TELEPHONY_NETWORK_EMERGENCY_ONLY.");
+ break;
+ case NETWORK_INFO_SERVICE_STATE_RADIO_OFF:
+ LOGI("Service status is TELEPHONY_NETWORK_RADIO_OFF.");
+ break;
+ default:
+ LOGI("Service type is unknown.\n");
+ break;
+ }
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("Invalid parameter");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("Cannot find service status.");
+ ret = -1;
+ break;
+ default:
+ LOGI("Unexpected return value.");
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+int main()
+{
+ int ret = 0;
+ network_info_type_e network_type = NETWORK_INFO_TYPE_UNKNOWN;
+ int ret_value = network_info_get_type(&network_type);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ switch(network_type)
+ {
+ case NETWORK_INFO_TYPE_GSM:
+ LOGI("Network type is NETWORK_INFO_TYPE_GSM.");
+ break;
+ case NETWORK_INFO_TYPE_GPRS:
+ LOGI("Network type is NETWORK_INFO_TYPE_GPRS.");
+ break;
+ case NETWORK_INFO_TYPE_EDGE:
+ LOGI("Network type is NETWORK_INFO_TYPE_EDGE.");
+ break;
+ case NETWORK_INFO_TYPE_UMTS:
+ LOGI("Network type is NETWORK_INFO_TYPE_UMTS.");
+ break;
+ case NETWORK_INFO_TYPE_HSDPA:
+ LOGI("Network type is NETWORK_INFO_TYPE_HSDPA.");
+ break;
+ default:
+ LOGI("Unexpected network type.");
+ break;
+ }
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("Invalid parameter");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("Out of service");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("Cannot find network type.");
+ ret = -1;
+ break;
+ default:
+ LOGI("Unexpected return value.\n");
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <telephony_network.h>
+#include <dlog.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+int main()
+{
+ int ret = 0;
+ bool is_roaming = false;
+ int ret_value = network_info_is_roaming(&is_roaming);
+
+ switch(ret_value)
+ {
+ case NETWORK_INFO_ERROR_NONE:
+ LOGI("Roaming state - [%s]", (is_roaming == true) ? "ON" : "OFF");
+ ret = 0;
+ break;
+ case NETWORK_INFO_ERROR_INVALID_PARAMETER:
+ LOGI("Invalid parameter");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OUT_OF_SERVICE:
+ LOGI("Out of service");
+ ret = -1;
+ break;
+ case NETWORK_INFO_ERROR_OPERATION_FAILED:
+ LOGI("Cannot find roaming state");
+ ret = -1;
+ break;
+ default:
+ LOGI("Unexpected return value");
+ ret = -1;
+ break;
+ }
+
+ return ret;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <string.h>
+#include <telephony_network.h>
+#include <dlog.h>
+#include <glib.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+static GMainLoop *event_loop;
+
+static void roaming_state_changed_cb_impl(bool is_roaming, void* user_data)
+{
+ LOGI("[%s] Start roaming_state_changed_cb_impl", __FUNCTION__);
+
+ LOGI("Roaming state - [%s]", (is_roaming == true) ? "ON" : "OFF");
+
+ LOGI("[%s] user data: %s", __FUNCTION__, user_data);
+
+ LOGI("[%s] End roaming_state_changed_cb_impl", __FUNCTION__);
+ g_main_loop_quit(event_loop);
+}
+
+int main()
+{
+ if( network_info_set_roaming_state_changed_cb(roaming_state_changed_cb_impl, "roaming_state_changed_test") == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to add callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to add callback function", __FUNCTION__);
+ return -1;
+ }
+
+ LOGI("[%s] If roaming state is changed, then callback function will be called", __FUNCTION__);
+ event_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(event_loop);
+
+ if( network_info_unset_roaming_state_changed_cb() == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to remove callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to remove callback function", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <string.h>
+#include <telephony_network.h>
+#include <dlog.h>
+#include <glib.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+static GMainLoop *event_loop;
+
+static void rssi_changed_cb_impl(network_info_rssi_e rssi, void* user_data)
+{
+ LOGI("[%s] Start rssi_changed_cb_impl", __FUNCTION__);
+
+ LOGI("[%s] RSSI: %d", __FUNCTION__, rssi);
+ LOGI("[%s] user data: %s", __FUNCTION__, user_data);
+
+ LOGI("[%s] End rssi_changed_cb_impl", __FUNCTION__);
+ g_main_loop_quit(event_loop);
+}
+
+int main()
+{
+ if( network_info_set_rssi_changed_cb(rssi_changed_cb_impl, "rssi_changed_test") == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to add callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to add callback function", __FUNCTION__);
+ return -1;
+ }
+
+ LOGI("[%s] If RSSI is changed, then callback function will be called", __FUNCTION__);
+ event_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(event_loop);
+
+ if( network_info_unset_rssi_changed_cb() == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to remove callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to remove callback function", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <stdio.h>
+#include <string.h>
+#include <telephony_network.h>
+#include <dlog.h>
+#include <glib.h>
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+#define LOG_TAG "TIZEN_N_NETWORK_INFO_TEST"
+
+static GMainLoop *event_loop;
+
+static const char *capi_network_service_state[] = {
+"In service",
+"Out of service",
+"Emergency only",
+"Radio off",
+};
+
+static void state_changed_cb(network_info_service_state_e status, void* user_data)
+{
+ LOGI("[%s] Start telephony_service_changed_cb", __FUNCTION__);
+
+ LOGI("[%s] Service status: %s", __FUNCTION__, capi_network_service_state[status]);
+ LOGI("[%s] user data: %s", __FUNCTION__, user_data);
+
+ LOGI("[%s] End telephony_service_changed_cb", __FUNCTION__);
+ g_main_loop_quit(event_loop);
+}
+
+int main()
+{
+ if( network_info_set_service_state_changed_cb(state_changed_cb, "telephony_service_changed_test") == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to add callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to add callback function", __FUNCTION__);
+ return -1;
+ }
+
+ LOGI("[%s] If service status is changed, then callback function will be called", __FUNCTION__);
+ event_loop = g_main_loop_new(NULL, FALSE);
+ g_main_loop_run(event_loop);
+
+ if( network_info_unset_service_state_changed_cb() == NETWORK_INFO_ERROR_NONE )
+ {
+ LOGI("[%s] Succeeded to remove callback function", __FUNCTION__);
+ }
+ else
+ {
+ LOGE("[%s] Failed to remove callback function", __FUNCTION__);
+ return -1;
+ }
+
+ return 0;
+}