Release TIZEN beta
authorDanny Jeongseok Seo <s.seo@samsung.com>
Fri, 10 Feb 2012 06:31:02 +0000 (15:31 +0900)
committerDanny Jeongseok Seo <s.seo@samsung.com>
Fri, 10 Feb 2012 06:31:02 +0000 (15:31 +0900)
20 files changed:
.gitignore [new file with mode: 0644]
TC/_export_env.sh [new file with mode: 0755]
TC/_export_target_env.sh [new file with mode: 0755]
TC/build.sh [new file with mode: 0755]
TC/clean.sh [new file with mode: 0755]
TC/config.default [new file with mode: 0644]
TC/execute.sh [new file with mode: 0755]
TC/testcase/tslist [new file with mode: 0644]
TC/testcase/utc_network_connection.c [new file with mode: 0755]
TC/testcase/utc_network_connection.h [new file with mode: 0755]
TC/tet_scen [new file with mode: 0644]
TC/tetbuild.cfg [new file with mode: 0644]
TC/tetclean.cfg [new file with mode: 0644]
TC/tetexec.cfg [new file with mode: 0644]
debian/changelog
debian/control
include/net_connection.h
include/net_connection_private.h [changed mode: 0755->0644]
src/connection.c
test/connection_test.c

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..85209fb
--- /dev/null
@@ -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/TC/_export_env.sh b/TC/_export_env.sh
new file mode 100755 (executable)
index 0000000..72a11ec
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh
new file mode 100755 (executable)
index 0000000..5ddaa53
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+. ./config
+export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
+export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
+export PATH=$TET_TARGET_PATH/bin:$PATH
+export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH
+export TET_ROOT=$TET_TARGET_PATH
diff --git a/TC/build.sh b/TC/build.sh
new file mode 100755 (executable)
index 0000000..72aad6c
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -c -p ./
+tcc -b -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/clean.sh b/TC/clean.sh
new file mode 100755 (executable)
index 0000000..29743e0
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+. ./_export_env.sh                              # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+RESULT_DIR=results
+
+tcc -c -p ./                                # executing tcc, with clean option (-c)
+rm -r $RESULT_DIR
+rm -r tet_tmp_dir
+rm testcase/tet_captured
diff --git a/TC/config.default b/TC/config.default
new file mode 100644 (file)
index 0000000..04684f0
--- /dev/null
@@ -0,0 +1,2 @@
+TET_INSTALL_HOST_PATH=/home/rookiejava/dts_tool/TETware
+TET_INSTALL_TARGET_PATH=/mnt/nfs/dts_tool/TETware
diff --git a/TC/execute.sh b/TC/execute.sh
new file mode 100755 (executable)
index 0000000..0fe02e2
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+. ./_export_target_env.sh                    # setting environment variables
+
+export TET_SUITE_ROOT=`pwd`
+FILE_NAME_EXTENSION=`date +%s`
+
+RESULT_DIR=results
+HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html
+JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal
+
+mkdir -p $RESULT_DIR
+
+tcc -e -j $JOURNAL_RESULT -p ./
+grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT
diff --git a/TC/testcase/tslist b/TC/testcase/tslist
new file mode 100644 (file)
index 0000000..4d4a9a7
--- /dev/null
@@ -0,0 +1 @@
+/testcase/utc_network_connection
diff --git a/TC/testcase/utc_network_connection.c b/TC/testcase/utc_network_connection.c
new file mode 100755 (executable)
index 0000000..03e5387
--- /dev/null
@@ -0,0 +1,1010 @@
+/*
+ * 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 <stdlib.h>
+#include <glib.h>
+#include <glib-object.h>
+#include "utc_network_connection.h"
+
+connection_h handle = NULL;
+static void startup(), cleanup();
+void (*tet_startup) () = startup;
+void (*tet_cleanup) () = cleanup;
+int rv = 0;
+static connection_network_status_e conn_status = CONNECTION_STATUS_UNAVAILABLE;
+
+struct tet_testlist tet_testlist[] = { 
+                                       {utc_connection_create_positive,1},
+                                       {utc_connection_create_negative,2},
+                                       {utc_connection_destroy_positive,3},
+                                       {utc_connection_destroy_negative,4},
+                                       {utc_connection_set_cb_positive,5},
+                                       {utc_connection_set_cb_negative,6},
+                                       {utc_connection_get_ip_address_positive,7},
+                                       {utc_connection_get_ip_address_negative,8},
+                                       {utc_connection_get_proxy_positive,9},
+                                       {utc_connection_get_proxy_negative,10},
+                                       {utc_connection_get_network_status_positive_1,11},
+                                       {utc_connection_get_network_status_positive_2,12},
+                                       {utc_connection_get_network_status_positive_3,13},
+                                       {utc_connection_get_network_status_negative_1,14},
+                                       {utc_connection_get_network_status_negative_2,15},
+                                       {utc_connection_is_connected_positive,16},
+                                       {utc_connection_unset_cb_positive,17},
+                                       {utc_connection_unset_cb_negative,18},
+                                       {utc_connection_get_last_sent_positive,19},
+                                       {utc_connection_get_last_sent_negative,20},
+                                       {utc_connection_get_last_recv_positive,21},
+                                       {utc_connection_get_last_recv_negative,22},
+                                       {utc_connection_get_total_sent_positive,23},
+                                       {utc_connection_get_total_sent_negative,24},
+                                       {utc_connection_get_total_recv_positive,25},
+                                       {utc_connection_get_total_recv_negative,26},
+                                       {utc_connection_get_total_duration_positive,27},
+                                       {utc_connection_get_total_duration_negative,28},
+                                       {utc_connection_get_wifi_last_datacall_duration_positive,29},
+                                       {utc_connection_get_wifi_last_datacall_duration_negative,30},
+                                       {utc_connection_get_wifi_last_received_data_size_positive,31},
+                                       {utc_connection_get_wifi_last_received_data_size_negative,32},
+                                       {utc_connection_get_wifi_last_sent_data_size_positive,33},
+                                       {utc_connection_get_wifi_last_sent_data_size_negative,34},
+                                       {utc_connection_get_wifi_total_datacall_duration_positive,35},
+                                       {utc_connection_get_wifi_total_datacall_duration_negative,36},
+                                       {utc_connection_get_wifi_total_received_data_size_positive,37},
+                                       {utc_connection_get_wifi_total_received_data_size_negative,38},
+                                       {utc_connection_get_wifi_total_sent_data_size_positive,39},
+                                       {utc_connection_get_wifi_total_sent_data_size_negative,40},
+                                       {utc_connection_get_last_datacall_duration_positive,41},
+                                       {utc_connection_get_last_datacall_duration_negative,42},
+                                       {TET_NULLFP, 0} 
+                                    };
+
+
+
+//callbacks
+void net_callback(const connection_network_param_e param, void *user_data)
+{
+       tet_printf("== CM callback == %d\n", param);
+}
+
+int create_handle()
+{
+       int rv=0;
+       rv = connection_create(&handle);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Create  Error [%d]\n", rv);
+               return 1;
+       }
+       tet_printf("Connection Create Success [%d]\n", rv);
+       return 0;
+
+}
+
+int set_callbacks()
+{
+       int rv = 0;
+       rv = connection_set_cb(handle, net_callback, NULL);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Set Callback is not called! Error [%d]\n", rv);
+               return 1;
+       }
+       tet_printf("Connection Set Callback! Success [%d]\n", rv);
+       return 0;
+}
+
+int get_api_preconditions()
+{
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return 1;
+       }
+       if(set_callbacks()){
+               tet_result(TET_FAIL);
+               return 1;
+       }
+       return 0;
+}
+
+void startup()
+{
+       tet_printf(" TC startup");
+       return;
+}
+
+void cleanup()
+{
+       tet_printf(" TC cleanup");
+       return;
+}
+
+void utc_connection_create_positive(void)
+{
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_result(TET_PASS);
+       return;
+}
+
+void utc_connection_create_negative(void)
+{
+       int rv=0;
+       rv = connection_create(NULL);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Create Must Fail! Success [%d]\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Create Must Fail ! Error [%d]\n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+
+
+void utc_connection_set_cb_positive(void)
+{
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       if(set_callbacks()){
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_set_cb_negative(void)
+{
+       int rv=0;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_set_cb(NULL, NULL, NULL);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Set Callback! Must Fail : Success [%d]\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Set Callback Must Fail! Error [%d]\n", rv);
+       connection_destroy(handle);
+       tet_result(TET_FAIL);
+       return;
+}
+
+void utc_connection_get_ip_address_positive(void)
+{
+       int rv=0;
+
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       char *ip_address=NULL;
+       rv = connection_get_ip_address(handle, &ip_address);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Get IP Address Failed [%d]\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       if(ip_address !=NULL)
+               tet_printf("Connection Get IP Address Success : %s\n", ip_address);
+       else
+               tet_printf("Connection Get IP Address  Success : No IP Address from Network\n");
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_ip_address_negative(void)
+{
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+       char *ip_address=NULL;
+       rv = connection_get_ip_address(NULL, &ip_address);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Get IP Address Must Fail [%d]\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get IP Address Must Fail Success : %d\n",rv); 
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_proxy_positive(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       char *proxy=NULL;
+       rv = connection_get_proxy(handle, &proxy);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Get Proxy Failed [%d]\n", rv);
+               tet_result(TET_FAIL);
+               return;
+       }
+       if(proxy!=NULL)
+               tet_printf("Connection Get Proxy Success : %s\n", proxy);
+       else
+               tet_printf("Connection Get Proxy Success : Network Did Not Give Proxy\n");
+
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_proxy_negative(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       char *proxy=NULL;
+       rv = connection_get_proxy(NULL, &proxy);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection Get Proxy Must Fail [%d]\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get Proxy Must Fail : %d\n", rv);
+       tet_result(TET_FAIL);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_network_status_positive_1(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       connection_network_status_e  status;
+
+       rv = connection_get_network_status(CONNECTION_WIFI_TYPE, &status);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get Status Fail : %d\n", rv);
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status);
+       connection_destroy(handle);
+       tet_result(TET_PASS);
+
+       if(status == CONNECTION_STATUS_AVAILABLE)
+               conn_status = status;
+
+       return;
+
+}
+
+void utc_connection_get_network_status_positive_2(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       connection_network_status_e  status;
+
+       rv = connection_get_network_status(CONNECTION_MOBILE_TYPE, &status);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get Status Fail : %d\n", rv);
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+       tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status);
+       connection_destroy(handle);
+       tet_result(TET_PASS);
+
+       if(status == CONNECTION_STATUS_AVAILABLE)
+               conn_status = status;
+
+       return;
+}
+
+void utc_connection_get_network_status_positive_3(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       connection_network_status_e  status;
+
+       rv = connection_get_network_status(CONNECTION_DEFAULT_TYPE, &status);
+
+       if(rv!=CONNECTION_ERROR_NONE || status!=conn_status)
+       {
+               tet_printf("Connection Get Status Fail : %d\n", rv);
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               status = CONNECTION_STATUS_UNAVAILABLE;
+               return;
+       }
+       tet_printf("Connection Get Status Success : %d Status = %d\n", rv, status);
+       connection_destroy(handle);
+       tet_result(TET_PASS);
+       conn_status = CONNECTION_STATUS_UNAVAILABLE;
+       return;
+}
+
+void utc_connection_get_network_status_negative_1(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_network_status(CONNECTION_MOBILE_TYPE, NULL);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get Status MUST Fail : Success %d\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get Status MUST Fail : Failure %d\n", rv);
+       tet_result(TET_FAIL);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_network_status_negative_2(void)
+{
+       int rv=0;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+       connection_network_status_e  status;
+       rv = connection_get_network_status(999, &status);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get Status MUST Fail : Success %d\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get Status MUST Fail : Failure %d\n", rv);
+       tet_result(TET_FAIL);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_last_datacall_duration_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_last_datacall_duration(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_datacall_duration : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get last_datacall_duration: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_last_datacall_duration_negative(void)
+{
+       int stat;
+
+       rv = connection_get_last_datacall_duration(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_datacall_duration : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get last_datacall_duration: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+
+void utc_connection_get_last_sent_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_last_sent_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_sent : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get last_sent: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+
+void utc_connection_get_last_sent_negative(void)
+{
+       int stat;
+
+       rv = connection_get_last_sent_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_sent : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get last_sent: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+
+void utc_connection_get_last_recv_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_last_received_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_recv : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get last_recv: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_last_recv_negative(void)
+{
+       int stat;
+
+       rv = connection_get_last_received_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_recv : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get last_recv: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_total_sent_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_total_sent_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_sent : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get total_sent: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_total_sent_negative(void)
+{
+       int stat;
+
+       rv = connection_get_total_sent_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_sent : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get total_sent: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_total_recv_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_total_received_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_recv : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get total_recv: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_total_recv_negative(void)
+{
+       int stat;
+
+       rv = connection_get_total_received_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_recv : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get total_recv : MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_last_duration_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_last_datacall_duration(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_duration : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get last_duration: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_last_duration_negative(void)
+{
+       int stat;
+
+       rv = connection_get_last_datacall_duration(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get last_duration : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get last_duration: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_total_duration_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       rv = connection_get_total_datacall_duration(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_datacall_duration : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get total_datacall_duration: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_total_duration_negative(void)
+{
+       int stat;
+
+       rv = connection_get_total_datacall_duration(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get total_datacall_duration : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get total_datacall_duration: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_last_datacall_duration_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_last_datacall_duration(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_datacall_duration : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_datacall_duration: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_last_datacall_duration_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_last_datacall_duration(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_datacall_duration : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_datacall_duration: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_last_received_data_size_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_last_received_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_received_data_size : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_received_data_size: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_last_received_data_size_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_last_received_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_received_data_size : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_received_data_size: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_last_sent_data_size_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_last_sent_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_sent_data_size : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_sent_data_size: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_last_sent_data_size_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_last_sent_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_last_sent_data_size : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_last_sent_data_size: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_total_datacall_duration_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_total_datacall_duration(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_datacall_duration : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_datacall_duration: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_total_datacall_duration_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_total_datacall_duration(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_datacall_duration : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_datacall_duration: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_total_received_data_size_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_total_received_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_received_data_size : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_received_data_size: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_total_received_data_size_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_total_received_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_received_data_size : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_received_data_size: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_get_wifi_total_sent_data_size_positive(void)
+{
+       int stat;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_get_wifi_total_sent_data_size(handle, &stat);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_sent_data_size : Failure %d\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_sent_data_size: Success %d Value = %d\n", rv, stat);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_get_wifi_total_sent_data_size_negative(void)
+{
+       int stat;
+
+       rv = connection_get_wifi_total_sent_data_size(NULL, &stat);
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection Get wifi_total_sent_data_size : MUST FAIL %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Connection Get wifi_total_sent_data_size: MUST Fail %d \n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_unset_cb_positive(void)
+{
+       int rv=0;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       if(set_callbacks()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_unset_cb(handle);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection UnSet Callback Failed! Error [%d]\n", rv);
+               tet_result(TET_FAIL);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection UnSet Callback! Success [%d]\n", rv);
+       tet_result(TET_PASS);
+       connection_destroy(handle);
+       return;
+}
+void utc_connection_unset_cb_negative(void)
+{
+       int rv=0;
+       if(create_handle()){
+               tet_result(TET_FAIL);
+               return;
+       }
+       rv = connection_unset_cb(NULL);
+       if(rv != CONNECTION_ERROR_NONE){
+               tet_printf("Connection UnSet Callback! Must Fail : Success [%d]\n", rv);
+               tet_result(TET_PASS);
+               connection_destroy(handle);
+               return;
+       }
+       tet_printf("Connection UnSet Callback Must Fail! Error [%d]\n", rv);
+       connection_destroy(handle);
+       tet_result(TET_FAIL);
+       return;
+}
+
+void utc_connection_destroy_positive(void)
+{
+       int rv = connection_destroy(handle);
+
+       if(rv==CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Destroy connection : Success %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+       tet_printf("Destroy connection : Failure %d\n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_destroy_negative(void)
+{
+       int rv = connection_destroy(NULL);
+
+       if(rv!=CONNECTION_ERROR_NONE)
+       {
+               tet_printf("Connection destroy Must Fail : Success %d\n", rv);
+               tet_result(TET_PASS);
+               return;
+       }
+
+       tet_printf("Connection destroy Must Fail : Failure %d\n", rv);
+       tet_result(TET_FAIL);
+       return;
+}
+void utc_connection_is_connected_positive(void)
+{
+       bool status = FALSE;
+       if(get_api_preconditions())
+       {
+               connection_destroy(handle);
+               tet_result(TET_FAIL);
+               return;
+       }
+
+       if((connection_is_connected()))
+       {
+               tet_result(TET_PASS);
+               tet_printf("Is Connected:Expected %d vs Obtained %d\n", TRUE, status);
+       }
+       else
+       {
+               tet_result(TET_FAIL);
+               tet_printf("Is Connected:Expected %d vs Obtained %d\n", FALSE, status);
+       }
+       connection_destroy(handle);
+
+}
diff --git a/TC/testcase/utc_network_connection.h b/TC/testcase/utc_network_connection.h
new file mode 100755 (executable)
index 0000000..6684783
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * 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 <tet_api.h>
+#include <net_connection.h>
+
+void utc_connection_create_positive(void);
+void utc_connection_create_negative(void);
+void utc_connection_set_cb_positive(void);
+void utc_connection_set_cb_negative(void);
+void utc_connection_open_positive(void);
+void utc_connection_open_negative(void);
+void utc_connection_get_ip_address_positive(void);
+void utc_connection_get_ip_address_negative(void);
+void utc_connection_get_proxy_positive(void);
+void utc_connection_get_proxy_negative(void);
+void utc_connection_get_network_status_positive_1(void);
+void utc_connection_get_network_status_positive_2(void);
+void utc_connection_get_network_status_positive_3(void);
+void utc_connection_get_network_status_negative_1(void);
+void utc_connection_get_network_status_negative_2(void);
+void utc_connection_get_last_datacall_duration_positive(void);
+void utc_connection_get_last_datacall_duration_negative(void);
+void utc_connection_get_last_sent_positive(void);
+void utc_connection_get_last_sent_negative(void);
+void utc_connection_get_last_recv_positive(void);
+void utc_connection_get_last_recv_negative(void);
+void utc_connection_get_total_sent_positive(void);
+void utc_connection_get_total_sent_negative(void);
+void utc_connection_get_total_recv_positive(void);
+void utc_connection_get_total_recv_negative(void);
+void utc_connection_get_total_duration_positive(void);
+void utc_connection_get_total_duration_negative(void);
+void utc_connection_get_wifi_last_datacall_duration_positive(void);
+void utc_connection_get_wifi_last_datacall_duration_negative(void);
+void utc_connection_get_wifi_last_received_data_size_positive(void);
+void utc_connection_get_wifi_last_received_data_size_negative(void);
+void utc_connection_get_wifi_last_sent_data_size_positive(void);
+void utc_connection_get_wifi_last_sent_data_size_negative(void);
+void utc_connection_get_wifi_total_datacall_duration_positive(void);
+void utc_connection_get_wifi_total_datacall_duration_negative(void);
+void utc_connection_get_wifi_total_received_data_size_positive(void);
+void utc_connection_get_wifi_total_received_data_size_negative(void);
+void utc_connection_get_wifi_total_sent_data_size_positive(void);
+void utc_connection_get_wifi_total_sent_data_size_negative(void);
+void utc_connection_is_connected_positive(void);
+void utc_connection_unset_cb_positive(void);
+void utc_connection_unset_cb_negative(void);
+void utc_connection_destroy_positive(void);
+void utc_connection_destroy_negative(void);
diff --git a/TC/tet_scen b/TC/tet_scen
new file mode 100644 (file)
index 0000000..03f029a
--- /dev/null
@@ -0,0 +1,7 @@
+all
+       ^TEST
+##### Scenarios for TEST #####
+
+# Test scenario
+TEST
+       :include:/testcase/tslist
diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg
new file mode 100644 (file)
index 0000000..f7eda55
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option for build operation checking
+TET_BUILD_TOOL=make # build with using make command
+TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build
+TET_API_COMPLIANT=True # use TET API in Test Case ?
+TET_PASS_TC_NAME=True # report passed TC name in Journal file?
diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg
new file mode 100644 (file)
index 0000000..02d7030
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capture option
+TET_CLEAN_TOOL= make clean # clean tool
+TET_CLEAN_FILE= Makefile # file for clean
+TET_API_COMPLIANT=True # TET API useage 
+TET_PASS_TC_NAME=True # showing name , passed TC
diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg
new file mode 100644 (file)
index 0000000..ef3e452
--- /dev/null
@@ -0,0 +1,5 @@
+TET_OUTPUT_CAPTURE=True # capturing execution or not
+TET_EXEC_TOOL=  # ex) exec : execution tool set up/ Optional
+TET_EXEC_FILE=   # ex) exectool : execution file/ Optional
+TET_API_COMPLIANT=True # Test case or Tool usesTET API?
+TET_PASS_TC_NAME=True # showing Passed TC name ?
index db4f9ea52e96fd89d7de8444b01db2bf3366f3c1..74bd96bdd9f70d2b4d933615cafee8708b3bee3c 100644 (file)
@@ -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
index 1ccdf313557c02d7696362cd746e98f56cd2f392..9bf18153163c6c3ef44f117de118ae72101d5ef4 100644 (file)
@@ -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
index 16a61efff16c3fffa16084e8599dcc9a262af472..08c1903feaeeedc6b3983d3a5a51a6ad5f129e36 100755 (executable)
@@ -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;
 
old mode 100755 (executable)
new mode 100644 (file)
index 9dd62e0..cc8825f
@@ -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
  *
index 6e3d1a19aefc5bd263bb77bc7f44410d0a0ee206..50eb66b9a2ebab69abf38d41a761757670a0ad05 100755 (executable)
@@ -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;
 }
index 3b1c9e6d738366511b70dd03cd96514b60168ada..ff6159c9152836f0ca1ebf5664d2a96ef393b795 100644 (file)
@@ -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