From 6c379f38c4a72b8bd3794f7f4c009bb0ea76184c Mon Sep 17 00:00:00 2001 From: hyunuktak Date: Fri, 3 Jun 2016 15:17:44 +0900 Subject: [PATCH] [UTC][Connection][Non-ACR][Add to check for cellular state] Change-Id: I175bd9360ef902bfa054546a3b4b37994a9a7bf5 Signed-off-by: hyunuktak --- src/utc/connection/utc-network-connection.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/src/utc/connection/utc-network-connection.c b/src/utc/connection/utc-network-connection.c index e8b7ad4..ab23db9 100755 --- a/src/utc/connection/utc-network-connection.c +++ b/src/utc/connection/utc-network-connection.c @@ -876,8 +876,14 @@ int utc_connection_get_default_cellular_service_profile_p(void) return 0; } + connection_cellular_state_e state; + int ret = connection_get_cellular_state(connection, &state); + assert_eq(ret, CONNECTION_ERROR_NONE); + if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE) + return 0; + int service_type = CONNECTION_CELLULAR_SERVICE_TYPE_INTERNET; - int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile); + ret = connection_get_default_cellular_service_profile(connection, service_type, &profile); assert_eq(ret, CONNECTION_ERROR_NONE); service_type = CONNECTION_CELLULAR_SERVICE_TYPE_MMS; @@ -935,7 +941,13 @@ int utc_connection_set_default_cellular_service_profile_p(void) return 0; } - int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular); + connection_cellular_state_e state; + int ret = connection_get_cellular_state(connection, &state); + assert_eq(ret, CONNECTION_ERROR_NONE); + if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE) + return 0; + + ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular); assert_eq(ret, CONNECTION_ERROR_NONE); ret = connection_set_default_cellular_service_profile(connection, service_type, profile_cellular); @@ -989,7 +1001,13 @@ int utc_connection_set_default_cellular_service_profile_async_p(void) return 0; } - int ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular); + connection_cellular_state_e state; + int ret = connection_get_cellular_state(connection, &state); + assert_eq(ret, CONNECTION_ERROR_NONE); + if (state == CONNECTION_CELLULAR_STATE_OUT_OF_SERVICE) + return 0; + + ret = connection_get_default_cellular_service_profile(connection, service_type, &profile_cellular); assert_eq(ret, CONNECTION_ERROR_NONE); ret = connection_set_default_cellular_service_profile_async(connection, service_type, profile_cellular, test_connection_set_default_callback, NULL); -- 2.7.4