diff options
author | Danny Jeongseok Seo <s.seo@samsung.com> | 2012-02-10 15:31:02 +0900 |
---|---|---|
committer | ByungWoo Lee <bw1212.lee@samsung.com> | 2012-02-10 16:51:42 +0900 |
commit | 6d3c39dd04f9b38b0659905ba1f5951c20904380 (patch) | |
tree | af8bc3b5780c7f0c69bcba7e05599a37a184018c | |
parent | 291c30db05fa243a9b7898ffb7a7f25e6496d55c (diff) | |
download | connection-6d3c39dd04f9b38b0659905ba1f5951c20904380.tar.gz connection-6d3c39dd04f9b38b0659905ba1f5951c20904380.tar.bz2 connection-6d3c39dd04f9b38b0659905ba1f5951c20904380.zip |
Fix bugs
-rw-r--r-- | .gitignore | 51 | ||||
-rw-r--r-- | debian/changelog | 16 | ||||
-rw-r--r-- | debian/control | 4 | ||||
-rwxr-xr-x | include/net_connection.h | 9 | ||||
-rw-r--r--[-rwxr-xr-x] | include/net_connection_private.h | 6 | ||||
-rwxr-xr-x | src/connection.c | 113 | ||||
-rw-r--r-- | test/connection_test.c | 2 |
7 files changed, 140 insertions, 61 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..85209fb --- /dev/null +++ b/.gitignore @@ -0,0 +1,51 @@ +CMakeCache.txt +*/CMakeFiles/* +*.cmake +CMakeFiles* +*.a +*.so +Testing +cmake.depends +cmake.check_depends +cmake.check_cache +core +core.* +gmon.out +install_manifest.txt +doc/html/* +*~ +.kdev_include_paths +src.kdev4 +.cproject +.project +tet_captured +tet_lock +*.pc +Makefile +*-test +TC/config +samples/.metadata +TC/results/ +TC/testcase/connection_test +build-stamp +cmake_build_tmp/ +config.cfg +configure-stamp +debian/capi-network-connection-dbg.debhelper.log +debian/capi-network-connection-dbg.substvars +debian/capi-network-connection-dbg/ +debian/capi-network-connection-dev.debhelper.log +debian/capi-network-connection-dev.substvars +debian/capi-network-connection-dev/ +debian/debhelper.log +debian/files +debian/substvars +debian/tmp/ +debian/capi-network-connection.debhelper.log +debian/capi-network-connection.postinst.debhelper +debian/capi-network-connection.postrm.debhelper +debian/capi-network-connection.substvars +debian/capi-network-connection/ +test/connection_test +test/connection_test_regress + diff --git a/debian/changelog b/debian/changelog index db4f9ea..74bd96b 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,19 @@ +capi-network-connection (0.1.0-15) unstable; urgency=low + + * Fix bugs and related DTS + * Git: api/connection + * Tag: capi-network-connection_0.1.0-15 + + -- JaeHyun Kim <jeik01.kim@samsung.com> Tue, 07 Feb 2012 19:09:07 +0900 + +capi-network-connection (0.1.0-14) unstable; urgency=low + + * Update DTS + * Git: api/connection + * Tag: capi-network-connection_0.1.0-14 + + -- ByungWoo Lee <bw1212.lee@samsung.com> Fri, 27 Jan 2012 18:18:29 +0900 + capi-network-connection (0.1.0-13) unstable; urgency=low * Update version diff --git a/debian/control b/debian/control index 1ccdf31..9bf1815 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: capi-network-connection Section: libs Priority: extra Maintainer: Sanjeev BA <as2902.b@samsung.com> -Build-Depends: debhelper (>= 5),dlog-dev, capi-base-common-dev, libvconf-dev +Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libvconf-dev Package: capi-network-connection Architecture: any @@ -11,7 +11,7 @@ Description: Network Connection library in TIZEN C API Package: capi-network-connection-dev Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-connection (= ${Source-Version}) +Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-connection (= ${Source-Version}), dlog-dev, capi-base-common-dev, libvconf-dev Description: Network Connection library in TIZEN C API (DEV) Package: capi-network-connection-dbg diff --git a/include/net_connection.h b/include/net_connection.h index 16a61ef..0a9ee73 100755 --- a/include/net_connection.h +++ b/include/net_connection.h @@ -54,11 +54,9 @@ extern "C" { typedef enum { CONNECTION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ - CONNECTION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ - - CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */ - CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */ + CONNECTION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory error */ + CONNECTION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Invalid Operation */ }connection_error_e; @@ -169,7 +167,8 @@ int connection_create(connection_h * handle); * @param[in] handle The handle to the connection * * @return 0 on success, otherwise negative error value. - * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_NONE Successful + * @retval #CONNECTION_ERROR_INVALID_PARAMETER Invalid parameter * @see connection_create() * * diff --git a/include/net_connection_private.h b/include/net_connection_private.h index 9dd62e0..cc8825f 100755..100644 --- a/include/net_connection_private.h +++ b/include/net_connection_private.h @@ -44,7 +44,7 @@ typedef enum TOTAL_DATACALL_DURATION, TOTAL_SENT_DATA_SIZE, TOTAL_RECEIVED_DATA_SIZE, - LAST_WIFI_DATACALL_DURATION, + LAST_WIFI_DATACALL_DURATION, LAST_WIFI_SENT_DATA_SIZE, LAST_WIFI_RECEIVED_DATA_SIZE, TOTAL_WIFI_DATACALL_DURATION, @@ -138,7 +138,7 @@ int connection_set_suspend_indication_cb(connection_h handle, connection_cb call * * @param[in] handle Handle received as a result of connection_create() API. * @return 0 on success, otherwise negative error value. - * @retval CONNECTION_ERROR_NONE - the operation has completed unccessfully. + * @retval CONNECTION_ERROR_NONE - the operation has completed unsuccessfully. * @retval TIZEN_ERROR_INVALID_PARAMETER - handle is invalid or callback is null * @pre #connection_create, #connection_set_suspend_indication_cb * @@ -155,7 +155,7 @@ int connection_unset_suspend_indication_cb(connection_h handle); * @param[in] callback Pointer to function of type (connection_cb). * @param[in] user_data User data param provided by application. * @return 0 on success, otherwise negative error value. - * @retval CONNECTION_ERROR_NONE - the operation has completed unccessfully. + * @retval CONNECTION_ERROR_NONE - the operation has completed unsuccessfully. * @retval TIZEN_ERROR_INVALID_PARAMETER - handle is invalid or callback is null * @pre #connection_create * diff --git a/src/connection.c b/src/connection.c index 6e3d1a1..50eb66b 100755 --- a/src/connection.c +++ b/src/connection.c @@ -124,85 +124,98 @@ int connection_create(connection_h *handle) int connection_destroy(connection_h handle) { - if(handle!=NULL) + if(handle==NULL) { - LOGI(TIZEN_N_CONNECTION,"Destroy Handle : %p\n", handle); - free(handle); + LOGI(TIZEN_N_CONNECTION,"Wrong Parameter Passed\n"); + return CONNECTION_ERROR_INVALID_PARAMETER; } + + LOGI(TIZEN_N_CONNECTION,"Destroy Handle : %p\n", handle); + free(handle); + return CONNECTION_ERROR_NONE; } -int connection_get_network_status(connection_network_type_e network_type, connection_network_status_e* network_status) +int connection_get_network_status(connection_network_type_e network_type, + connection_network_status_e* network_status) { - if (network_status==NULL) - { - return CONNECTION_ERROR_INVALID_PARAMETER; - } + if (network_status==NULL || + network_type > CONNECTION_WIFI_TYPE || + network_type < CONNECTION_DEFAULT_TYPE) + { + return CONNECTION_ERROR_INVALID_PARAMETER; + } - int status = 0; + int status = 0; if (vconf_get_int(VCONFKEY_NETWORK_STATUS, &status)) { - LOGI(TIZEN_N_CONNECTION,"First Step Failure = %d\n", status); - return CONNECTION_ERROR_INVALID_OPERATION; + LOGI(TIZEN_N_CONNECTION,"First Step Failure = %d\n", status); + return CONNECTION_ERROR_INVALID_OPERATION; } - LOGI(TIZEN_N_CONNECTION,"Connected Network = %d\n", status); + LOGI(TIZEN_N_CONNECTION,"Connected Network = %d\n", status); - if (network_type==CONNECTION_DEFAULT_TYPE) - network_type = CONNECTION_WIFI_TYPE; + if (network_type==CONNECTION_DEFAULT_TYPE) + { + switch(status) + { + case VCONFKEY_NETWORK_CELLULAR: + case VCONFKEY_NETWORK_WIFI: + *network_status = CONNECTION_STATUS_AVAILABLE; + break; + default : + *network_status = CONNECTION_STATUS_UNAVAILABLE; + break; + } - if (status!=network_type) - { - LOGI(TIZEN_N_CONNECTION,"Mismatch = %d\n", network_type); - *network_status = CONNECTION_STATUS_UNAVAILABLE; - return CONNECTION_ERROR_NONE; - } + return CONNECTION_ERROR_NONE; + } if (network_type == CONNECTION_MOBILE_TYPE) { if (!vconf_get_int(VCONFKEY_NETWORK_CELLULAR_STATE,&status)) { - LOGI(TIZEN_N_CONNECTION,"Mobile = %d\n", status); - if (status!=VCONFKEY_NETWORK_CELLULAR_NO_SERVICE) - { - *network_status = CONNECTION_STATUS_AVAILABLE; - } - else - { - *network_status = CONNECTION_STATUS_UNAVAILABLE; - } + LOGI(TIZEN_N_CONNECTION,"Mobile = %d\n", status); + if (status==VCONFKEY_NETWORK_CELLULAR_ON) + { + *network_status = CONNECTION_STATUS_AVAILABLE; + } + else + { + *network_status = CONNECTION_STATUS_UNAVAILABLE; + } return CONNECTION_ERROR_NONE; } - else - { - *network_status = CONNECTION_STATUS_UNKNOWN; - LOGI(TIZEN_N_CONNECTION,"3G Failed = %d\n", status); - return CONNECTION_ERROR_INVALID_OPERATION; - } + else + { + *network_status = CONNECTION_STATUS_UNKNOWN; + LOGI(TIZEN_N_CONNECTION,"3G Failed = %d\n", status); + return CONNECTION_ERROR_INVALID_OPERATION; + } } if (network_type == CONNECTION_WIFI_TYPE) { if (!vconf_get_int(VCONFKEY_NETWORK_WIFI_STATE,&status)) { - LOGI(TIZEN_N_CONNECTION,"WiFi = %d\n", status); - if (status!=VCONFKEY_NETWORK_WIFI_OFF) - { - *network_status = CONNECTION_STATUS_AVAILABLE; - } - else - { - *network_status = CONNECTION_STATUS_UNAVAILABLE; - } + LOGI(TIZEN_N_CONNECTION,"WiFi = %d\n", status); + if (status==VCONFKEY_NETWORK_WIFI_CONNECTED) + { + *network_status = CONNECTION_STATUS_AVAILABLE; + } + else + { + *network_status = CONNECTION_STATUS_UNAVAILABLE; + } return CONNECTION_ERROR_NONE; } - else - { - *network_status = CONNECTION_STATUS_UNKNOWN; - LOGI(TIZEN_N_CONNECTION,"WiFi Failed = %d\n", status); - return CONNECTION_ERROR_INVALID_OPERATION; - } + else + { + *network_status = CONNECTION_STATUS_UNKNOWN; + LOGI(TIZEN_N_CONNECTION,"WiFi Failed = %d\n", status); + return CONNECTION_ERROR_INVALID_OPERATION; + } } return CONNECTION_ERROR_INVALID_PARAMETER; } diff --git a/test/connection_test.c b/test/connection_test.c index 3b1c9e6..ff6159c 100644 --- a/test/connection_test.c +++ b/test/connection_test.c @@ -61,7 +61,7 @@ int test_register_client(void){ if(CONNECTION_ERROR_NONE==err) //set callbacks { if(handle==NULL) - printf("OOOOOPPPPSSS\n"); + printf("Handle is NULL\n"); connection_set_cb(handle, net_callback, NULL); } else |