+++ /dev/null
-Before run DTS of bluetooth, BT should be disabled.
-This DTS needs another target and it must be set as the following:
- 1) BT is activated.
- 2) BT is discoverable.
- 3) BT name is set as "dts_test".
+++ /dev/null
-#!/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 TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware simulator 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
+++ /dev/null
-#!/bin/sh
-. ./config
-export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path
-export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target
-#export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-simulator # tetware simulator 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
+++ /dev/null
-#!/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
+++ /dev/null
-#!/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
+++ /dev/null
-PKG_NAME=capi-network-bluetooth
-TET_INSTALL_HOST_PATH=/var/tmp/dts_fw/TC/TETware
-TET_INSTALL_TARGET_PATH=/opt/home/$PKG_NAME/TETware
-
+++ /dev/null
-#!/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
+++ /dev/null
-#!/bin/sh
-
-. ./config
-
-TC_PATH=/opt/home/$PKG_NAME
-
-echo $TC_PATH
-
-sdb shell "mkdir -p $TC_PATH"
-
-sdb push . $TC_PATH
-
-
+++ /dev/null
-#!/bin/sh
-
-source ./_export_target_env.sh
-
-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
+++ /dev/null
-CC ?= gcc
-
-C_FILES = $(shell ls *.c)
-
-PKGS = capi-network-bluetooth glib-2.0
-
-LDFLAGS = `pkg-config --libs $(PKGS)`
-LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s
-LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s
-
-CFLAGS = -I. `pkg-config --cflags $(PKGS)`
-CFLAGS += -I$(TET_ROOT)/inc/tet3
-CFLAGS += -Wall
-
-TCS := $(shell ls -1 *.c | cut -d. -f1)
-
-all: $(TCS)
-
-%: %.c
- $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS)
-
-clean:
- rm -f $(TCS)
+++ /dev/null
-/testcase/utc_network_bluetooth_adapter_positive
-/testcase/utc_network_bluetooth_adapter_negative
-/testcase/utc_network_bluetooth_audio_negative
-/testcase/utc_network_bluetooth_audio_positive
-/testcase/utc_network_bluetooth_device_positive
-/testcase/utc_network_bluetooth_device_negative
-/testcase/utc_network_bluetooth_device_discovery_positive
-/testcase/utc_network_bluetooth_device_discovery_negative
-/testcase/utc_network_bluetooth_service_search_positive
-/testcase/utc_network_bluetooth_service_search_negative
-/testcase/utc_network_bluetooth_socket_positive
-/testcase/utc_network_bluetooth_socket_negative
-/testcase/utc_network_bluetooth_gatt_negative
-/testcase/utc_network_bluetooth_gatt_positive
-/testcase/utc_network_bluetooth_hid_negative
-/testcase/utc_network_bluetooth_hid_positive
-/testcase/utc_network_bluetooth_hdp_negative
-/testcase/utc_network_bluetooth_hdp_positive
-/testcase/utc_network_bluetooth_opp-server_negative
-/testcase/utc_network_bluetooth_opp-server_positive
-/testcase/utc_network_bluetooth_opp-client_negative
-/testcase/utc_network_bluetooth_opp-client_positive
-/testcase/utc_network_bluetooth_pan_negative
-/testcase/utc_network_bluetooth_pan_positive
-/testcase/utc_network_bluetooth_avrcp_negative
-/testcase/utc_network_bluetooth_avrcp_positive
-/testcase/utc_network_bluetooth_common_negative
-/testcase/utc_network_bluetooth_common_positive
\ No newline at end of file
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-#include <time.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-bt_adapter_visibility_mode_e adapter_visibility_mode =
- BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE;
-char adapter_name[128] = "dts_test";
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-
-static void utc_network_bluetooth_deinitialize_n(void);
-static void utc_network_bluetooth_adapter_set_state_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_set_name_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_set_connectable_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_enable_n(void);
-static void utc_network_bluetooth_adapter_get_state_n(void);
-static void utc_network_bluetooth_adapter_get_address_n(void);
-static void utc_network_bluetooth_adapter_set_name_n(void);
-static void utc_network_bluetooth_adapter_get_name_n(void);
-static void utc_network_bluetooth_adapter_set_visibility_n(void);
-static void utc_network_bluetooth_adapter_get_visibility_n(void);
-static void utc_network_bluetooth_adapter_add_white_list_n(void);
-static void utc_network_bluetooth_adapter_clear_white_list_n(void);
-static void utc_network_bluetooth_adapter_remove_white_list_n(void);
-static void utc_network_bluetooth_adapter_set_connectable_n(void);
-static void utc_network_bluetooth_adapter_get_connectable_n(void);
-static void utc_network_bluetooth_adapter_disable_n(void);
-static void utc_network_bluetooth_adapter_unset_state_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_unset_name_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_unset_connectable_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_set_le_state_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_unset_le_state_changed_cb_n(void);
-static void utc_network_bluetooth_adapter_le_enable_n(void);
-static void utc_network_bluetooth_adapter_get_le_state_n(void);
-static void utc_network_bluetooth_adapter_le_disable_n(void);
-
-void adapter_state_changed_cb_for_adapter_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_adapter_disable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_name_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_connectable_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_state_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_address_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_name_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_name_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_visibility_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_visibility_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_le_disable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_add_white_list_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_remove_white_list_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_clear_white_list_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_connectable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_deinitialize_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_connectable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_enable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_connectable_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_name_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_le_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_le_state_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_le_enable_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_le_state_changed_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- /* start of TC */
- tet_printf("TC start.");
- bt_initialize();
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- tet_printf("TC end");
-}
-
-/**
- * @brief Negative test case of bt_deinitialize()
- */
-static void utc_network_bluetooth_deinitialize_n(void)
-{
- int ret = bt_deinitialize();
-
- if (ret == BT_ERROR_NONE) {
- ret = bt_deinitialize();
- dts_check_eq("bt_deinitialize", ret, BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned.");
- } else {
- dts_fail("bt_deinitialize", "bt_deinitialize() failed.");
- }
-}
-
-/**
- * @brief Negative test case of bt_adapter_disable()
- */
-static void utc_network_bluetooth_adapter_disable_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_disable();
- dts_check_eq("bt_adapter_disable", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is disabled");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_set_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_name_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_name_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_name_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_set_name_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_visibility_mode_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_visibility_mode_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_set_visibility_mode_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_connectable_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_connectable_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_connectable_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_set_connectable_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_get_state()
- */
-static void utc_network_bluetooth_adapter_get_state_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_get_state(NULL);
- dts_check_eq("bt_adapter_get_state", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_get_address().
- */
-static void utc_network_bluetooth_adapter_get_address_n(void)
-{
- char *address = NULL;
- int ret = bt_adapter_get_address(&address);
-
- dts_check_eq("bt_adapter_get_address", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_get_name().
- */
-static void utc_network_bluetooth_adapter_get_name_n(void)
-{
- char *name = NULL;
- int ret = bt_adapter_get_name(&name);
-
- dts_check_eq("bt_adapter_get_name", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_get_visibility().
- */
-static void utc_network_bluetooth_adapter_get_visibility_n(void)
-{
- int dur = 10;
- int ret = bt_adapter_get_visibility(NULL, &dur);
-
- dts_check_eq("bt_adapter_get_visibility",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_name().
- */
-static void utc_network_bluetooth_adapter_set_name_n(void)
-{
- int ret = bt_adapter_set_name(NULL);
- dts_check_eq("bt_adapter_set_name", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_visibility().
- */
-static void utc_network_bluetooth_adapter_set_visibility_n(void)
-{
- int ret = bt_adapter_set_visibility(adapter_visibility_mode, 180);
-
- dts_check_eq("bt_adapter_set_visibility", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_le_add_white_list
- */
-static void utc_network_bluetooth_adapter_add_white_list_n(void)
-{
- int ret = bt_adapter_le_add_white_list(NULL);
- dts_check_eq("bt_adapter_le_add_white_list", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_clear_white_list
- */
-static void utc_network_bluetooth_adapter_clear_white_list_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_adapter_clear_white_list();
- dts_check_eq("bt_adapter_clear_white_list", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_le_add_white_list
- */
-static void utc_network_bluetooth_adapter_remove_white_list_n(void)
-{
- int ret = bt_adapter_le_remove_white_list(NULL);
- dts_check_eq("bt_adapter_le_remove_white_list", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_get_connectable
- */
-static void utc_network_bluetooth_adapter_get_connectable_n(void)
-{
- int ret = bt_adapter_get_connectable(NULL);
- dts_check_eq("bt_adapter_get_connectable", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_set_connectable
- */
-static void utc_network_bluetooth_adapter_set_connectable_n(void)
-{
- int ret = bt_adapter_set_connectable(NULL);
- dts_check_eq("bt_adapter_set_connectable", ret, BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_unset_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_state_changed_cb();
- dts_check_eq("bt_adapter_unset_state_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_unset_name_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_name_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_name_changed_cb();
- dts_check_eq("bt_adapter_unset_name_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_unset_visibility_mode_changed_cb()
- */
-static void
-utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_visibility_mode_changed_cb();
- dts_check_eq("bt_adapter_unset_visibility_mode_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_enable()
- */
-static void utc_network_bluetooth_adapter_enable_n(void)
-{
- bt_error_e ret = bt_adapter_enable();
- dts_check_eq("bt_adapter_enable", ret, BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_unset_connectable_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_connectable_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_connectable_changed_cb();
- dts_check_eq("bt_adapter_unset_connectable_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "bt_adapter_unset_connectable_changed_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_adapter_le_set_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_le_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_set_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_le_set_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-static void utc_network_bluetooth_adapter_le_enable_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_enable();
- dts_check_eq("bt_adapter_le_enable", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned.");
-}
-
-static void utc_network_bluetooth_adapter_le_disable_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_disable();
- dts_check_eq("bt_adapter_disable", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is disabled");
-}
-
-static void utc_network_bluetooth_adapter_get_le_state_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_get_state(NULL);
- dts_check_eq("bt_adapter_get_state", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL.");
-}
-
-static void utc_network_bluetooth_adapter_unset_le_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_unset_state_changed_cb();
- dts_check_eq("bt_adapter_unset_state_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-#include <time.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-char *remote_address;
-static GMainLoop *mainloop;
-static bool callback_result = false;
-bt_adapter_visibility_mode_e adapter_visibility_mode =
- BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE;
-char adapter_name[128] = "dts_test";
-
-void (*tet_startup)(void) = startup;
-void (*tet_cleanup)(void) = cleanup;
-
-static void utc_network_bluetooth_initialize_p(void);
-static void utc_network_bluetooth_deinitialize_p(void);
-static void utc_network_bluetooth_adapter_set_state_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_set_name_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_set_connectable_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_enable_p(void);
-static void utc_network_bluetooth_adapter_get_state_p(void);
-static void utc_network_bluetooth_adapter_get_address_p(void);
-static void utc_network_bluetooth_adapter_set_name_p(void);
-static void utc_network_bluetooth_adapter_get_name_p(void);
-static void utc_network_bluetooth_adapter_set_visibility_p(void);
-static void utc_network_bluetooth_adapter_get_visibility_p(void);
-static void utc_network_bluetooth_adapter_add_white_list_p(void);
-static void utc_network_bluetooth_adapter_remove_white_list_p(void);
-static void utc_network_bluetooth_adapter_clear_white_list_p(void);
-static void utc_network_bluetooth_adapter_set_connectable_p(void);
-static void utc_network_bluetooth_adapter_get_connectable_p(void);
-static void utc_network_bluetooth_adapter_disable_p(void);
-static void utc_network_bluetooth_adapter_unset_state_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_unset_name_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_unset_connectable_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_set_le_state_changed_cb_p(void);
-static void utc_network_bluetooth_adapter_le_enable_p(void);
-static void utc_network_bluetooth_adapter_get_le_state_p(void);
-static void utc_network_bluetooth_adapter_le_disable_p(void);
-static void utc_network_bluetooth_adapter_unset_le_state_changed_cb_p(void);
-
-void adapter_state_changed_cb_for_adapter_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-void adapter_state_changed_cb_for_adapter_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-void adapter_name_changed_cb_for_adapter_p(char *device_name, void *user_data);
-void adapter_visibility_mode_changed_cb_for_adpater_p(int result,
- bt_adapter_visibility_mode_e visibility_mode,
- void *user_data);
-void device_discovery_state_changed_cb_for_adapter_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_device_info_s *device_info,
- void *user_data);
-void adapter_connectable_changed_cb_for_adpater_p(int result,
- bool connectable, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_enable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_state_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_address_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_name_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_name_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_name_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_connectable_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_name_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_visibility_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_visibility_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_connectable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_connectable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_connectable_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_le_enable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_add_white_list_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_remove_white_list_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_clear_white_list_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_set_le_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_unset_le_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_get_le_state_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_le_disable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_adapter_disable_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_MOBILE") == 0) {
- token = strtok(NULL, "=");
- remote_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- tet_printf("TC start.");
- mainloop = g_main_loop_new(NULL, FALSE);
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- tet_printf("TC end");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *)data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_adapter_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- if (user_data != NULL && !strcmp((char *)user_data, "enable")) {
- if (adapter_state == BT_ADAPTER_ENABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- callback_result = true;
- } else {
- tet_printf("Callback: BT was not enabled.");
- }
-
- if (mainloop)
- g_main_loop_quit(mainloop);
- } else if (user_data != NULL && !strcmp((char *)user_data, "disable")) {
- if (adapter_state == BT_ADAPTER_DISABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled.");
- callback_result = true;
- } else {
- tet_printf("Callback: BT was not disabled.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-void adapter_le_state_changed_cb_for_adapter_p(int result,
- bt_adapter_le_state_e adapter_le_state,
- void *user_data)
-{
- if (user_data != NULL && !strcmp((char *)user_data, "enable")) {
- if (adapter_le_state == BT_ADAPTER_LE_ENABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT LE was enabled.");
- callback_result = true;
- } else {
- tet_printf("Callback: BT LE was not enabled.");
- }
-
- if (mainloop)
- g_main_loop_quit(mainloop);
- } else if (user_data != NULL && !strcmp((char *)user_data, "disable")) {
- if (adapter_le_state == BT_ADAPTER_LE_DISABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT LEwas disabled.");
- callback_result = true;
- } else {
- tet_printf("Callback: BT LE was not disabled.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-void device_discovery_state_changed_cb_for_adapter_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_device_info_s *device_info,
- void *user_data)
-{
- tet_printf("bt_adapter_device_discovery_state_changed_cb was called");
-
- if (user_data != NULL && !strcmp((char *)user_data, "enable")) {
- if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
- tet_printf("Callback: bt_adapter_device_discovery_state_changed_cb_for_adapter_p was called \
- and device discovery ends.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-void adapter_name_changed_cb_for_adapter_p(char *device_name, void *user_data)
-{
- tet_printf("bt_adapter_name_changed_cb_for_adapter_p was called: %s",
- (char *)device_name);
-
- if (user_data != NULL && !strcmp((char *)user_data, "set_name")) {
- if (!strcmp(device_name, adapter_name))
- callback_result = true;
- }
-
- if (mainloop)
- g_main_loop_quit(mainloop);
-
-}
-
-void adapter_visibility_mode_changed_cb_for_adpater_p(int result,
- bt_adapter_visibility_mode_e visibility_mode,
- void *user_data)
-{
- tet_printf("bt_adapter_visibility_mode_changed_cb was called: %d", visibility_mode);
-
- if (user_data != NULL && !strcmp((char *)user_data, "set_visibility")) {
- if (result == BT_ERROR_NONE) {
- if (visibility_mode == adapter_visibility_mode) {
- callback_result = true;
- } else {
- tet_printf("Callback: adapter_visibility_mode_changed_cb_for_adpater_p() was called but visibility mode is not same.");
- tet_printf("Callback: actual visibility mode : %d", visibility_mode);
- callback_result = false;
- }
- } else {
- tet_printf("\n Callback: adapter_visibility_mode_changed_cb_for_adpater_p() was called but failed.");
- callback_result = false;
- }
- }
-
- if (mainloop)
- g_main_loop_quit(mainloop);
-}
-
-void adapter_connectable_changed_cb_for_adpater_p(int result, bool connectable,
- void *user_data)
-{
- tet_printf("adapter_connectable_changed_cb_for_adapter_p was called.");
- if (result == BT_ERROR_NONE) {
- tet_printf("Callback: Connectable Changed");
- tet_printf("%s", connectable ? "Connectable" : "Non-connectable");
- callback_result = true;
- } else {
- tet_printf("Callback: adapter_connectable_changed_cb_for_adpater_p() was called but failed.");
- callback_result = false;
- }
- if (mainloop)
- g_main_loop_quit(mainloop);
-}
-
-/**
- * @brief Positive test case of bt_initialize()
- */
-static void utc_network_bluetooth_initialize_p(void)
-{
- int ret = bt_initialize();
- dts_check_eq("bt_initialize", ret, BT_ERROR_NONE,
- "bt_initialize() failed.");
-}
-
-/**
- * @brief Positive test case of bt_deinitialize()
- */
-static void utc_network_bluetooth_deinitialize_p(void)
-{
- int ret = bt_deinitialize();
- dts_check_eq("bt_deinitialize", ret,
- BT_ERROR_NONE, "bt_deinitialize() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_adapter_p, NULL);
- dts_check_eq("bt_adapter_set_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_set_state_changed_cb failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_name_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_name_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- ret = bt_adapter_set_name_changed_cb(adapter_name_changed_cb_for_adapter_p, NULL);
- if (ret == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(10000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- }
- dts_check_eq("bt_adapter_set_name_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_set_name_changed_cb failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_visibility_mode_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_visibility_mode_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- ret = bt_adapter_set_visibility_mode_changed_cb(
- adapter_visibility_mode_changed_cb_for_adpater_p, NULL);
- if (ret == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(10000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- }
- dts_check_eq("bt_adapter_set_visibility_mode_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_adapter_set_visibility_mode_changed_cb failed.");
-}
-
-static void utc_network_bluetooth_adapter_set_connectable_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_connectable_changed_cb(
- adapter_connectable_changed_cb_for_adpater_p, NULL);
- dts_check_eq("bt_adapter_set_connectable_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_adapter_set_connectable_changed_cb failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_enable()
- */
-static void utc_network_bluetooth_adapter_enable_p(void)
-{
- int timeout_id = 0;
- callback_result = false;
- bt_error_e ret = BT_ERROR_NONE;
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_adapter_p, "enable") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_enable",
- "bt_adapter_set_state_changed_cb() failed.");
- }
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- callback_result = true;
- } else {
- dts_fail("bt_adapter_enable", "bt_adapter_enable() failed.");
- bt_adapter_unset_state_changed_cb();
- return;
- }
-
- tet_printf("callback_result: %d", callback_result);
- bt_adapter_unset_state_changed_cb();
- dts_check_eq("bt_adapter_enable", callback_result, true,
- "BT was not enabled.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_get_state()
- */
-static void utc_network_bluetooth_adapter_get_state_p(void)
-{
- bt_adapter_state_e adapter_state = BT_ADAPTER_DISABLED;
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_get_state(&adapter_state);
- if (ret == BT_ERROR_NONE && adapter_state == BT_ADAPTER_ENABLED) {
- dts_pass("bt_adapter_get_state",
- "bt_adapter_get_state() succeeded.");
- } else {
- dts_fail("bt_adapter_get_state",
- "bt_adapter_get_state() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_get_address().
- */
-static void utc_network_bluetooth_adapter_get_address_p(void)
-{
- char *address = NULL;
- int ret = bt_adapter_get_address(&address);
-
- if (address != NULL)
- tet_printf("device address: %s", address);
-
- dts_check_eq("bt_adapter_get_address", ret, BT_ERROR_NONE,
- "bt_adapter_get_address() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_get_name().
- */
-static void utc_network_bluetooth_adapter_get_name_p(void)
-{
- char *name = NULL;
- int ret = bt_adapter_get_name(&name);
-
- if (name != NULL)
- tet_printf("device name : %s", name);
-
- memset(adapter_name, 0x00, sizeof(adapter_name));
- g_strlcpy(adapter_name, name, sizeof(adapter_name));
-
- dts_check_eq("bt_adapter_get_name", ret, BT_ERROR_NONE, \
- "bt_adapter_get_name() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_get_visibility().
- */
-static void utc_network_bluetooth_adapter_get_visibility_p(void)
-{
- bt_adapter_visibility_mode_e mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
- int dur = 1;
- int ret = bt_adapter_get_visibility(&mode, &dur);
-
- tet_printf("visibility mode : %d", mode);
- if (mode == BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE) {
- adapter_visibility_mode = BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE;
- } else if (mode == BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE) {
- adapter_visibility_mode = BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE;
- } else
- adapter_visibility_mode = BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE;
-
- dts_check_eq("bt_adapter_get_visibility", ret, BT_ERROR_NONE,
- "bt_adapter_get_visibility() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_name().
- */
-static void utc_network_bluetooth_adapter_set_name_p(void)
-{
- int timeout_id = 0;
- char name[128] = "";
-
- snprintf(name, 128, "%s_1", adapter_name);
- strncpy(adapter_name, name, 128);
-
- if (bt_adapter_set_name_changed_cb(adapter_name_changed_cb_for_adapter_p, "set_name") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_set_name",
- "bt_adapter_set_name_changed_cb() failed.");
- }
-
- if (bt_adapter_set_name(adapter_name) == BT_ERROR_NONE) {
- tet_printf("adapter_name_changed_cb_for_adapter_p() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_adapter_unset_name_changed_cb();
- dts_check_eq("bt_adapter_set_name", callback_result, true,
- "The local adapter name was not set.");
- } else {
- dts_fail("bt_adapter_set_name", "bt_adapter_set_name() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_visibility().
- */
-static void utc_network_bluetooth_adapter_set_visibility_p(void)
-{
- callback_result = false;
- int timeout = 0;
- int timeout_id = 0;
-
- if (bt_adapter_set_visibility_mode_changed_cb(adapter_visibility_mode_changed_cb_for_adpater_p, "set_visibility") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_set_visibility",
- "bt_adapter_set_visibility_mode_changed_cb() failed.");
- }
-
- tet_printf("set visibility mode: %d", adapter_visibility_mode);
- if (adapter_visibility_mode == BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE) {
- timeout = 90;
- tet_printf("set timeout: %d", timeout);
- }
-
- if (bt_adapter_set_visibility(adapter_visibility_mode, timeout) == BT_ERROR_NONE) {
- tet_printf("bt_adapter_visibility_changed_cb() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_adapter_unset_visibility_mode_changed_cb();
- dts_check_eq("bt_adapter_set_visibility", callback_result, true,
- "The visibility of BT was not set.");
- } else {
- dts_fail("bt_adapter_set_visibility",
- "bt_adapter_set_visibility() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_le_add_white_list
- */
-static void utc_network_bluetooth_adapter_add_white_list_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_adapter_le_add_white_list(remote_address);
- dts_check_eq("bt_adapter_le_add_white_list", ret, BT_ERROR_NONE,
- "bt_adapter_le_add_white_list() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_le_clear_white_list
- */
-static void utc_network_bluetooth_adapter_clear_white_list_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_adapter_le_clear_white_list();
- dts_check_eq("bt_adapter_le_clear_white_list", ret, BT_ERROR_NONE,
- "bt_adapter_le_clear_white_list() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_le_remove_white_list
- */
-static void utc_network_bluetooth_adapter_remove_white_list_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_adapter_le_remove_white_list(remote_address);
- dts_check_eq("bt_adapter_le_remove_white_list", ret, BT_ERROR_NONE,
- "bt_adapter_le_remove_white_list() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_get_connectable
- */
-static void utc_network_bluetooth_adapter_get_connectable_p(void)
-{
- int ret = BT_ERROR_NONE;
- bool connectable = false;
- ret = bt_adapter_get_connectable(&connectable);
- dts_check_eq("bt_adapter_get_connectable", ret, BT_ERROR_NONE,
- "bt_adapter_get_connectable() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_connectable
- */
-static void utc_network_bluetooth_adapter_set_connectable_p(void)
-{
- int ret = BT_ERROR_NONE;
- bool connectable = false;
- int timeout_id = 0;
- callback_result = false;
-
- ret = bt_adapter_get_connectable(&connectable);
- ret = bt_adapter_set_connectable(!connectable);
- if (ret == BT_ERROR_NONE) {
- tet_printf("adapter_connectable_changed_cb will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_adapter_set_connectable", ret, BT_ERROR_NONE,
- "bt_adapter_set_connectable() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_disable()
- */
-static void utc_network_bluetooth_adapter_disable_p(void)
-{
- callback_result = false;
- int timeout_id = 0;
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_adapter_p, "disable") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_disable",
- "bt_adapter_set_state_changed_cb() failed.");
- }
-
- if (bt_adapter_disable() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_state_changed_cb() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_adapter_unset_state_changed_cb();
- dts_check_eq("bt_adapter_disable", callback_result, true,
- "BT was not disabled");
- } else {
- dts_fail("bt_adapter_disable", "bt_adapter_disable() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_unset_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_state_changed_cb();
- dts_check_eq("bt_adapter_unset_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_unset_state_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_unset_name_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_name_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_name_changed_cb();
- dts_check_eq("bt_adapter_unset_name_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_unset_name_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_unset_visibility_mode_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_visibility_mode_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_visibility_mode_changed_cb();
- dts_check_eq("bt_adapter_unset_visibility_mode_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_adapter_unset_visibility_mode_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_unset_connectable_changed_cb()
- */
-static void utc_network_bluetooth_adapter_unset_connectable_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_connectable_changed_cb();
- dts_check_eq("bt_adapter_unset_connectable_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_adapter_unset_connectable_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_le_set_state_changed_cb()
- */
-static void utc_network_bluetooth_adapter_set_le_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_set_state_changed_cb(
- adapter_le_state_changed_cb_for_adapter_p, NULL);
- dts_check_eq("bt_adapter_le_set_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_set_state_le_state_changed_cb failed.");
-}
-
-static void utc_network_bluetooth_adapter_le_enable_p(void)
-{
- int timeout_id = 0;
- callback_result = false;
- bt_error_e ret = BT_ERROR_NONE;
-
- if (bt_adapter_le_set_state_changed_cb(adapter_le_state_changed_cb_for_adapter_p, "enable") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_le_enable",
- "bt_adapter_le_set_state_changed_cb() failed.");
- }
-
- ret = bt_adapter_le_enable();
- if (ret == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- callback_result = true;
- } else {
- dts_fail("bt_adapter_le_enable", "bt_adapter_le_enable() failed.");
- bt_adapter_le_unset_state_changed_cb();
- return;
- }
-
- tet_printf("callback_result: %d", callback_result);
- bt_adapter_le_unset_state_changed_cb();
- dts_check_eq("bt_adapter_le_enable", callback_result, true,
- "BT LE was not enabled.");
-}
-
-static void utc_network_bluetooth_adapter_le_disable_p(void)
-{
- callback_result = false;
- int timeout_id = 0;
-
- if (bt_adapter_le_set_state_changed_cb(adapter_le_state_changed_cb_for_adapter_p, "disable") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_le_disable",
- "bt_adapter_le_set_state_changed_cb() failed.");
- }
-
- if (bt_adapter_le_disable() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_le_state_changed_cb() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_adapter_le_unset_state_changed_cb();
- dts_check_eq("bt_adapter_le_disable", callback_result, true,
- "BT LE was not disabled");
- } else {
- dts_fail("bt_adapter_le_disable", "bt_adapter_le_disable() failed");
- }
-}
-
-static void utc_network_bluetooth_adapter_get_le_state_p(void)
-{
- bt_adapter_le_state_e adapter_le_state = BT_ADAPTER_LE_DISABLED;
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_get_state(&adapter_le_state);
- if (ret == BT_ERROR_NONE && adapter_le_state == BT_ADAPTER_LE_ENABLED) {
- dts_pass("bt_adapter_le_get_state",
- "bt_adapter_le_get_state() succeeded.");
- } else {
- dts_fail("bt_adapter_le_get_state",
- "bt_adapter_le_get_state() failed.");
- }
-}
-
-static void utc_network_bluetooth_adapter_unset_le_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_le_unset_state_changed_cb();
- dts_check_eq("bt_adapter_le_unset_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_adapter_unset_state_le_changed_cb() failed.");
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_audio_negative.c
- *
- * Created on: 19-Sep-2013
- * Author: mrinal.m
- */
-
-#include <tet_api.h>
-#include <bluetooth.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_audio_connect_n(void);
-static void utc_network_bluetooth_audio_disconnect_n(void);
-static void utc_network_bluetooth_audio_set_connection_n(void);
-static void utc_network_bluetooth_ag_get_speaker_gain_n(void);
-static void utc_network_bluetooth_ag_is_nrec_enabled_n(void);
-static void utc_network_bluetooth_ag_set_microphone_gain_changed_n(void);
-static void utc_network_bluetooth_ag_set_speaker_gain_changed_n(void);
-static void utc_network_bluetooth_ag_is_sco_opened_n(void);
-static void utc_network_bluetooth_ag_set_sco_state_changed_n(void);
-static void utc_network_bluetooth_ag_notify_call_event_n(void);
-static void utc_network_bluetooth_ag_notify_call_list_n(void);
-static void utc_network_bluetooth_ag_set_call_handling_event_cb_n(void);
-static void utc_network_bluetooth_ag_set_multi_call_handling_event_cb_n(void);
-static void utc_network_bluetooth_ag_set_vendor_cmd_cb_n(void);
-static void utc_network_bluetooth_ag_unset_vendor_cmd_cb_n(void);
-static void utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_n(void);
-static void utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_n(void);
-static void utc_network_bluetooth_ag_call_list_destroy_n(void);
-static void utc_network_bluetooth_ag_call_list_reset_n(void);
-static void utc_network_bluetooth_ag_call_list_add_n(void);
-static void utc_network_bluetooth_ag_set_dtmf_transmitted_cb_n(void);
-
-void adapter_state_changed_cb_for_audio_negative(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_audio_connect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_audio_disconnect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_audio_set_connection_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_get_speaker_gain_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_is_nrec_enabled_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_microphone_gain_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_speaker_gain_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_is_sco_opened_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_sco_state_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_call_event_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_call_list_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_call_handling_event_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_multi_call_handling_event_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_vendor_cmd_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_dtmf_transmitted_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_destroy_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_reset_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_add_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_vendor_cmd_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_audio_initialize() != BT_ERROR_NONE)
- tet_printf("bt_audio_initialize failed");
-
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_audio_negative,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_audio_negative(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if (user_data != NULL &&
- !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-/**
- * @brief Negative test case of bt_audio_connect()
- */
-static void utc_network_bluetooth_audio_connect_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_audio_connect(NULL,
- BT_AUDIO_PROFILE_TYPE_HSP_HFP);
- dts_check_eq("bt_audio_connect", ret,
- BT_ERROR_INVALID_PARAMETER, "bt_audio_connect() failed.");
-}
-
-/**
- * @brief Negative test case of bt_audio_disconnect()
- */
-static void utc_network_bluetooth_audio_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_audio_disconnect(NULL, BT_AUDIO_PROFILE_TYPE_A2DP);
- dts_check_eq("bt_audio_disconnect", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_audio_disconnect() failed.");
-}
-
-/**
- * @brief Negative test case of bt_audio_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_audio_set_connection_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_audio_set_connection_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_audio_set_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_audio_set_connection_state_changed_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_get_speaker_gain()
- */
-static void utc_network_bluetooth_ag_get_speaker_gain_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_get_speaker_gain(NULL);
- dts_check_eq("bt_ag_get_speaker_gain", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_get_speaker_gain() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_is_nrec_enabled()
- */
-static void utc_network_bluetooth_ag_is_nrec_enabled_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_is_nrec_enabled(NULL);
- dts_check_eq("bt_ag_is_nrec_enabled", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_is_nrec_enabled() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_microphone_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_microphone_gain_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_microphone_gain_changed_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_microphone_gain_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_microphone_gain_changed_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_speaker_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_speaker_gain_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_speaker_gain_changed_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_speaker_gain_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_speaker_gain_changed_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_is_sco_opened()
- */
-static void utc_network_bluetooth_ag_is_sco_opened_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_is_sco_opened(NULL);
- dts_check_eq("bt_ag_is_sco_opened", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_is_sco_opened() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_sco_state_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_sco_state_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_sco_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_sco_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_sco_state_changed_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_notify_call_event()
- */
-static void utc_network_bluetooth_ag_notify_call_event_n(void)
-{
- int ret = BT_ERROR_NONE;
- unsigned int call_id = 0;
- ret = bt_ag_notify_call_event(BT_AG_CALL_EVENT_INCOMING, call_id, NULL);
- dts_check_eq("bt_ag_notify_call_event", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_notify_call_event() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_notify_call_list()
- */
-static void utc_network_bluetooth_ag_notify_call_list_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_notify_call_list(NULL);
- dts_check_eq("bt_ag_notify_call_list", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_notify_call_list() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_set_call_handling_event_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_call_handling_event_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_call_handling_event_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_call_handling_event_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_multi_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_set_multi_call_handling_event_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_multi_call_handling_event_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_multi_call_handling_event_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_multi_call_handling_event_cb() failed.");
-}
-
-/**
- * @brief Negative test case of bt_ag_set_dtmf_transmitted_cb()
- */
-static void utc_network_bluetooth_ag_set_dtmf_transmitted_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_dtmf_transmitted_cb(NULL, NULL);
- dts_check_eq("bt_ag_set_dtmf_transmitted_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_ag_set_dtmf_transmitted_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_ag_unset_multi_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_deinitialize();
- ret = bt_ag_unset_multi_call_handling_event_cb();
- dts_check_eq("bt_ag_unset_multi_call_handling_event_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_ag_unset_dtmf_transmitted_cb()
- */
-static void utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_deinitialize();
- ret = bt_ag_unset_dtmf_transmitted_cb();
- dts_check_eq("bt_ag_unset_dtmf_transmitted_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_call_list_destroy()
- */
-static void utc_network_bluetooth_ag_call_list_destroy_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_call_list_destroy(NULL);
- dts_check_eq("bt_call_list_destroy", ret, BT_ERROR_INVALID_PARAMETER,
- "bt_call_list_destroy() failed.");
-}
-
-/**
- * @brief Negative test case of bt_call_list_reset()
- */
-static void utc_network_bluetooth_ag_call_list_reset_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_call_list_reset(NULL);
- dts_check_eq("bt_call_list_reset", ret, BT_ERROR_INVALID_PARAMETER,
- "bt_call_list_reset() failed.");
-}
-
-/**
- * @brief Negative test case of bt_call_list_add()
- */
-static void utc_network_bluetooth_ag_call_list_add_n(void)
-{
- int ret = BT_ERROR_NONE;
- unsigned int call_id = 0;
- const char *phone_number = "9663868998";
-
- ret = bt_call_list_add(NULL, call_id,
- BT_AG_CALL_STATE_INCOMING, phone_number);
- dts_check_eq("bt_call_list_add", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_call_list_add() failed.");
-
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_audio_positive.c
- *
- * Created on: 19-Sep-2013
- * Author: mrinal.m
- */
-
-#include <tet_api.h>
-#include <bluetooth.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-char *remote_address;
-static GMainLoop *mainloop;
-
-static void utc_network_bluetooth_audio_initialize_p(void);
-static void utc_network_bluetooth_audio_deinitialize_p(void);
-static void utc_network_bluetooth_audio_connect_p(void);
-static void utc_network_bluetooth_audio_disconnect_p(void);
-static void utc_network_bluetooth_audio_set_connection_p(void);
-static void utc_network_bluetooth_audio_unset_connection_p(void);
-static void utc_network_bluetooth_ag_notify_speaker_gain_p(void);
-static void utc_network_bluetooth_ag_get_speaker_gain_p(void);
-static void utc_network_bluetooth_ag_is_nrec_enabled_p(void);
-static void utc_network_bluetooth_ag_set_microphone_gain_changed_p(void);
-static void utc_network_bluetooth_ag_unset_microphone_gain_changed_p(void);
-static void utc_network_bluetooth_ag_set_speaker_gain_changed_p(void);
-static void utc_network_bluetooth_ag_unset_speaker_gain_changed_p(void);
-static void utc_network_bluetooth_ag_open_sco_p(void);
-static void utc_network_bluetooth_ag_close_sco_p(void);
-static void utc_network_bluetooth_ag_is_sco_opened_p(void);
-static void utc_network_bluetooth_ag_set_sco_state_changed_p(void);
-static void utc_network_bluetooth_ag_unset_sco_state_changed_p(void);
-static void utc_network_bluetooth_ag_notify_call_event_p(void);
-static void utc_network_bluetooth_ag_notify_call_list_p(void);
-static void utc_network_bluetooth_ag_notify_voice_recognition_state_p(void);
-static void utc_network_bluetooth_ag_set_call_handling_event_cb_p(void);
-static void utc_network_bluetooth_ag_unset_call_handling_event_cb_p(void);
-static void utc_network_bluetooth_ag_set_multi_call_handling_event_cb_p(void);
-static void utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_p(void);
-static void utc_network_bluetooth_ag_set_dtmf_transmitted_cb_p(void);
-static void utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_p(void);
-static void utc_network_bluetooth_ag_set_vendor_cmd_cb_p(void);
-static void utc_network_bluetooth_ag_unset_vendor_cmd_cb_p(void);
-static void utc_network_bluetooth_ag_call_list_create_p(void);
-static void utc_network_bluetooth_ag_call_list_destroy_p(void);
-static void utc_network_bluetooth_ag_call_list_reset_p(void);
-static void utc_network_bluetooth_ag_call_list_add_p(void);
-static void utc_network_bluetooth_ag_ca2dp_set_content_protection_p(void);
-
-void connection_state_changed_cb_for_audio_p(int result, bool connected,
- const char *remote_address,
- bt_audio_profile_type_e type,
- void *user_data);
-void dtmf_transmitted_cb_for_ag_p(const char *dtmf, void *user_data);
-void multi_call_handling_event_cb_for_ag_p(bt_ag_multi_call_handling_event_e event, void *user_data);
-void call_handling_event_cb_for_ag_p(bt_ag_call_handling_event_e event,
- unsigned int call_id, void *user_data);
-void sco_state_changed_cb_for_ag_p(int result, bool opened, void *user_data);
-void speaker_gain_changed_cb_for_ag_p(int gain, void *user_data);
-void microphone_gain_changed_cb_for_ag_p(int gain, void *user_data);
-void adapter_state_changed_cb_for_audio_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_audio_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_audio_set_connection_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_audio_connect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_open_sco_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_microphone_gain_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_speaker_gain_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_speaker_gain_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_get_speaker_gain_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_is_nrec_enabled_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_microphone_gain_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_speaker_gain_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_sco_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_vendor_cmd_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_vendor_cmd_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_is_sco_opened_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_close_sco_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_call_event_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_call_list_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_notify_voice_recognition_state_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_call_handling_event_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_call_handling_event_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_multi_call_handling_event_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_set_dtmf_transmitted_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_unset_sco_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_create_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_destroy_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_reset_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_call_list_add_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_ag_ca2dp_set_content_protection_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_audio_disconnect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_audio_unset_connection_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_audio_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_HEADSET") == 0) {
- token = strtok(NULL, "=");
- remote_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- tet_printf("TC start.");
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_audio_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("[%s] Callback: Timeout.", __FUNCTION__);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-
-void adapter_state_changed_cb_for_audio_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-void connection_state_changed_cb_for_audio_p(int result, bool connected,
- const char *remote_address,
- bt_audio_profile_type_e type,
- void *user_data)
-{
-
-}
-
-void microphone_gain_changed_cb_for_ag_p(int gain, void *user_data)
-{
-
-}
-
-void speaker_gain_changed_cb_for_ag_p(int gain, void *user_data)
-{
-
-}
-
-void sco_state_changed_cb_for_ag_p(int result, bool opened, void *user_data)
-{
-
-}
-
-void call_handling_event_cb_for_ag_p(bt_ag_call_handling_event_e event,
- unsigned int call_id, void *user_data)
-{
-
-}
-
-void multi_call_handling_event_cb_for_ag_p(bt_ag_multi_call_handling_event_e event, void *user_data)
-{
-
-}
-
-void dtmf_transmitted_cb_for_ag_p(const char *dtmf, void *user_data)
-{
-
-}
-
-void vendor_cmd_event_cb_for_ag_p(char *cmd, void *user_data)
-{
- tet_printf("Callback : vendor_cmd_cb was called.");
- tet_printf("Vendor Command[%s]", cmd);
-}
-
-/**
- * @brief Positive test case of bt_audio_initialize()
- */
-static void utc_network_bluetooth_audio_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_audio_initialize();
- dts_check_eq("bt_audio_initialize", ret, BT_ERROR_NONE,
- "bt_audio_initialize() failed. %x", ret);
-
-}
-
-/**
- * @brief Positive test case of bt_audio_connect()
- */
-static void utc_network_bluetooth_audio_connect_p(void)
-{
- int ret = BT_ERROR_NONE;
- const char *remote_address = "00:23:78:AB:C4:20";
- ret = bt_audio_connect(remote_address, BT_AUDIO_PROFILE_TYPE_HSP_HFP);
- dts_check_eq("bt_audio_connect", ret, BT_ERROR_NONE,
- "bt_audio_connect() failed. %x", ret);
-}
-
-/**
- * @brief Positive test case of bt_audio_disconnect()
- */
-static void utc_network_bluetooth_audio_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_audio_disconnect(remote_address, BT_AUDIO_PROFILE_TYPE_HSP_HFP);
- dts_check_eq("bt_audio_disconnect", ret, BT_ERROR_NONE,
- "bt_audio_disconnect() failed. %x", ret);
-}
-
-/**
- * @brief Positive test case of bt_audio_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_audio_set_connection_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_audio_set_connection_state_changed_cb
- (connection_state_changed_cb_for_audio_p, NULL);
- dts_check_eq("bt_audio_set_connection_state_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_audio_set_connection_state_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_audio_unset_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_audio_unset_connection_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_audio_unset_connection_state_changed_cb();
- dts_check_eq("bt_audio_set_connection_state_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_audio_set_connection_state_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_ag_notify_speaker_gain()
- */
-static void utc_network_bluetooth_ag_notify_speaker_gain_p(void)
-{
- int ret = BT_ERROR_NONE;
- int gain = 10;
- ret = bt_ag_notify_speaker_gain(gain);
- dts_check_eq("bt_ag_notify_speaker_gain", ret, BT_ERROR_NONE,
- "bt_ag_notify_speaker_gain() failed.%x", ret);
-}
-
-/**
- * @brief Positive test case of bt_ag_get_speaker_gain()
- */
-static void utc_network_bluetooth_ag_get_speaker_gain_p(void)
-{
- int ret = BT_ERROR_NONE;
- int gain = 0;
- ret = bt_ag_get_speaker_gain(&gain);
- dts_check_eq("bt_ag_get_speaker_gain", ret, BT_ERROR_NONE,
- "bt_ag_get_speaker_gain() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_is_nrec_enabled()
- */
-static void utc_network_bluetooth_ag_is_nrec_enabled_p(void)
-{
- int ret = BT_ERROR_NONE;
- bool enabled = 1;
- ret = bt_ag_is_nrec_enabled(&enabled);
- dts_check_eq("bt_ag_is_nrec_enabled", ret, BT_ERROR_NONE,
- "bt_ag_is_nrec_enabled() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_microphone_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_microphone_gain_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_microphone_gain_changed_cb(microphone_gain_changed_cb_for_ag_p, NULL);
- dts_check_eq("bt_ag_set_microphone_gain_changed_cb", ret, BT_ERROR_NONE,
- "bt_ag_set_microphone_gain_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_microphone_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_unset_microphone_gain_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_microphone_gain_changed_cb();
- dts_check_eq("bt_ag_unset_microphone_gain_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_ag_unset_microphone_gain_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_speaker_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_speaker_gain_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_speaker_gain_changed_cb(speaker_gain_changed_cb_for_ag_p, NULL);
- dts_check_eq("bt_ag_set_speaker_gain_changed_cb", ret, BT_ERROR_NONE,
- "bt_ag_set_speaker_gain_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_speaker_gain_changed_cb()
- */
-static void utc_network_bluetooth_ag_unset_speaker_gain_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_speaker_gain_changed_cb();
- dts_check_eq("bt_ag_unset_speaker_gain_changed_cb", ret, BT_ERROR_NONE,
- "bt_ag_unset_speaker_gain_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_open_sco()
- */
-static void utc_network_bluetooth_ag_open_sco_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_open_sco();
- dts_check_eq("bt_ag_open_sco", ret, BT_ERROR_NONE,
- "bt_ag_open_sco() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_close_sco()
- */
-static void utc_network_bluetooth_ag_close_sco_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_close_sco();
- dts_check_eq("bt_ag_close_sco", ret, BT_ERROR_NONE,
- "bt_ag_close_sco() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_is_sco_opened()
- */
-static void utc_network_bluetooth_ag_is_sco_opened_p(void)
-{
- int ret = BT_ERROR_NONE;
- bool opened = 1;
- ret = bt_ag_is_sco_opened(&opened);
- dts_check_eq("bt_ag_is_sco_opened", ret, BT_ERROR_NONE,
- "bt_ag_is_sco_opened() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_sco_state_changed_cb()
- */
-static void utc_network_bluetooth_ag_set_sco_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_sco_state_changed_cb(sco_state_changed_cb_for_ag_p, NULL);
- dts_check_eq("bt_ag_set_sco_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_ag_set_sco_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_sco_state_changed_cb()
- */
-static void utc_network_bluetooth_ag_unset_sco_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_sco_state_changed_cb();
- dts_check_eq("bt_ag_unset_sco_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_ag_unset_sco_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_notify_call_event()
- */
-static void utc_network_bluetooth_ag_notify_call_event_p(void)
-{
- int ret = BT_ERROR_NONE;
- const char *phone_number = "9663868998";
- unsigned int call_id = 0;
- ret = bt_ag_notify_call_event(BT_AG_CALL_EVENT_INCOMING,
- call_id, phone_number);
- dts_check_eq("bt_ag_notify_call_event", ret, BT_ERROR_NONE,
- "bt_ag_notify_call_event() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_notify_call_list()
- */
-static void utc_network_bluetooth_ag_notify_call_list_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_call_list_h handle;
- const char *phone_number = "9663868998";
-
- handle = g_malloc0(sizeof(bt_call_list_h));
- bt_call_list_add(handle, 1, BT_AG_CALL_STATE_ACTIVE, phone_number);
- ret = bt_ag_notify_call_list(handle);
- dts_check_eq("bt_ag_notify_call_list", ret, BT_ERROR_NONE,
- "bt_ag_notify_call_list() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_notify_voice_recognition_state()
- */
-static void utc_network_bluetooth_ag_notify_voice_recognition_state_p(void)
-{
- int ret = BT_ERROR_NONE;
- bool state = 1;
-
- ret = bt_ag_notify_voice_recognition_state(state);
- dts_check_eq("bt_ag_notify_voice_recognition_state", ret, BT_ERROR_NONE,
- "bt_ag_notify_voice_recognition_state() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_set_call_handling_event_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_call_handling_event_cb(call_handling_event_cb_for_ag_p,
- NULL);
- dts_check_eq("bt_ag_set_call_handling_event_cb", ret, BT_ERROR_NONE,
- "bt_ag_set_call_handling_event_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_unset_call_handling_event_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_call_handling_event_cb();
- dts_check_eq("bt_ag_unset_call_handling_event_cb", ret, BT_ERROR_NONE,
- "bt_ag_unset_call_handling_event_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_multi_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_set_multi_call_handling_event_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_multi_call_handling_event_cb(multi_call_handling_event_cb_for_ag_p, NULL);
- dts_check_eq("bt_ag_set_multi_call_handling_event_cb", ret,
- BT_ERROR_NONE,
- "bt_ag_set_multi_call_handling_event_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_multi_call_handling_event_cb()
- */
-static void utc_network_bluetooth_ag_unset_multi_call_handling_event_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_multi_call_handling_event_cb();
- dts_check_eq("bt_ag_unset_multi_call_handling_event_cb", ret,
- BT_ERROR_NONE,
- "bt_ag_unset_multi_call_handling_event_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_set_dtmf_transmitted_cb()
- */
-static void utc_network_bluetooth_ag_set_dtmf_transmitted_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_set_dtmf_transmitted_cb(dtmf_transmitted_cb_for_ag_p, NULL);
- dts_check_eq("bt_ag_set_dtmf_transmitted_cb", ret, BT_ERROR_NONE,
- "bt_ag_set_dtmf_transmitted_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_ag_unset_dtmf_transmitted_cb()
- */
-static void utc_network_bluetooth_ag_unset_dtmf_transmitted_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_ag_unset_dtmf_transmitted_cb();
- dts_check_eq("bt_ag_unset_dtmf_transmitted_cb", ret, BT_ERROR_NONE,
- "bt_ag_unset_dtmf_transmitted_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_call_list_create()
- */
-static void utc_network_bluetooth_ag_call_list_create_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_call_list_h handle;
- const char *phone_number = "9663868998";
-
- ret = bt_call_list_create(&handle);
- ret = bt_call_list_add(handle, 1, BT_AG_CALL_STATE_ACTIVE, phone_number);
-
- dts_check_eq("bt_call_list_create", ret, BT_ERROR_NONE,
- "bt_call_list_create() failed.");
-}
-
-/**
- * @brief Positive test case of bt_call_list_destroy()
- */
-static void utc_network_bluetooth_ag_call_list_destroy_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_call_list_h handle;
- const char *phone_number = "9663868998";
-
- handle = g_malloc0(sizeof(bt_call_list_h));
- bt_call_list_add(handle, 1, BT_AG_CALL_STATE_ACTIVE, phone_number);
- ret = bt_call_list_destroy(handle);
- dts_check_eq("bt_call_list_destroy", ret, BT_ERROR_NONE,
- "bt_call_list_destroy() failed.");
-}
-
-/**
- * @brief Positive test case of bt_call_list_reset()
- */
-static void utc_network_bluetooth_ag_call_list_reset_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_call_list_h handle;
- const char *phone_number = "9663868998";
-
- handle = g_malloc0(sizeof(bt_call_list_h));
- bt_call_list_add(handle, 1, BT_AG_CALL_STATE_ACTIVE, phone_number);
- ret = bt_call_list_reset(handle);
- dts_check_eq("bt_call_list_reset", ret, BT_ERROR_NONE,
- "bt_call_list_reset() failed.");
-}
-
-/**
- * @brief Positive test case of bt_call_list_add()
- */
-static void utc_network_bluetooth_ag_call_list_add_p(void)
-{
- int ret = BT_ERROR_NONE;
- unsigned int call_id = 0;
- bt_call_list_h handle;
- const char *phone_number = "9663868998";
-
- handle = g_malloc0(sizeof(bt_call_list_h));
- bt_call_list_add(handle, 1, BT_AG_CALL_STATE_ACTIVE, phone_number);
- ret = bt_call_list_add(handle, call_id, BT_AG_CALL_STATE_INCOMING, phone_number);
- dts_check_eq("bt_call_list_add", ret, BT_ERROR_NONE,
- "bt_call_list_add() failed.");
-}
-
-/**
- * @brief Positive test case of bt_audio_deinitialize()
- */
-static void utc_network_bluetooth_audio_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_audio_deinitialize();
- dts_check_eq("bt_audio_deinitialize", ret, BT_ERROR_NONE,
- "bt_audio_deinitialize() failed.");
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_avrcp_negative.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include "bluetooth.h"
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-const char target_name[128] = "dts_test";
-char target_address[18] = "";
-
-static GMainLoop *mainloop;
-
-static void utc_network_bluetooth_audio_initialize_n(void);
-static void utc_network_bluetooth_avrcp_set_equalizer_state_changed_n(void);
-static void utc_network_bluetooth_avrcp_set_repeat_mode_changed_n(void);
-static void utc_network_bluetooth_avrcp_set_shuffle_mode_changed_n(void);
-static void utc_network_bluetooth_avrcp_set_scan_mode_changed_n(void);
-
-
-void adapter_state_changed_cb_for_avrcp_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_audio_initialize_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_equalizer_state_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_repeat_mode_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_shuffle_mode_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_scan_mode_changed_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_avrcp_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Negative test case of bt_avrcp_target_initialize()
- */
-
-void adapter_state_changed_cb_for_avrcp_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_audio_initialize_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_initialize(NULL, NULL);
- dts_check_eq("bt_avrcp_target_initialize", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_avrcp_target_initialize() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_avrcp_set_equalizer_state_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_equalizer_state_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_equalizer_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_avrcp_set_equalizer_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_avrcp_set_equalizer_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_avrcp_set_repeat_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_repeat_mode_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_repeat_mode_changed_cb(NULL, NULL);
- dts_check_eq("bt_avrcp_set_repeat_mode_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_avrcp_set_repeat_mode_changed_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_avrcp_set_shuffle_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_shuffle_mode_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_shuffle_mode_changed_cb(NULL, NULL);
- dts_check_eq("bt_avrcp_set_shuffle_mode_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_avrcp_set_shuffle_mode_changed_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_avrcp_set_scan_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_scan_mode_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_scan_mode_changed_cb(NULL, NULL);
- dts_check_eq("bt_avrcp_set_scan_mode_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_avrcp_set_scan_mode_changed_cb() failed.");
-
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_avrcp_positive.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include <bluetooth.h>
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-void target_connection_state_changed_cb_for_avrcp_p(
- bool connected, const char *remote_address,
- void *user_data);
-void equalizer_state_changed_cb_for_avrcp_p(
- bt_avrcp_equalizer_state_e equalizer,
- void *user_data);
-void repeat_mode_changed_cb_for_avrcp_p(
- bt_avrcp_repeat_mode_e repeat,
- void *user_data);
-void shuffle_mode_changed_cb_for_avrcp_p(
- bt_avrcp_shuffle_mode_e shuffle,
- void *user_data);
-void scan_mode_changed_cb_for_avrcp_p(
- bt_avrcp_scan_mode_e scan,
- void *user_data);
-
-static void utc_network_bluetooth_avrcp_targe_initialize_p(void);
-static void utc_network_bluetooth_avrcp_target_deinitialize_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_equalizer_state_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_repeat_mode_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_shuffle_mode_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_scan_mode_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_player_state_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_position_p(void);
-static void utc_network_bluetooth_avrcp_target_notify_track_p(void);
-static void utc_network_bluetooth_avrcp_set_equalizer_state_changed_p(void);
-static void utc_network_bluetooth_avrcp_unset_equalizer_state_changed_p(void);
-static void utc_network_bluetooth_avrcp_set_repeat_mode_changed_p(void);
-static void utc_network_bluetooth_avrcp_unset_repeat_mode_changed_p(void);
-static void utc_network_bluetooth_avrcp_set_shuffle_mode_changed_p(void);
-static void utc_network_bluetooth_avrcp_unset_shuffle_mode_changed_p(void);
-static void utc_network_bluetooth_avrcp_set_scan_mode_changed_p(void);
-static void utc_network_bluetooth_avrcp_unset_scan_mode_changed_p(void);
-
-void adapter_state_changed_cb_for_avrcp_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_avrcp_targe_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_equalizer_state_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_repeat_mode_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_shuffle_mode_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_scan_mode_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_player_state_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_position_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_notify_track_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_equalizer_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_unset_equalizer_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_repeat_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_unset_repeat_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_shuffle_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_unset_shuffle_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_set_scan_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_unset_scan_mode_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_avrcp_target_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_avrcp_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-
-void adapter_state_changed_cb_for_avrcp_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-void target_connection_state_changed_cb_for_avrcp_p(
- bool connected, const char *remote_address,
- void *user_data)
-{
-
-}
-
-void equalizer_state_changed_cb_for_avrcp_p(
- bt_avrcp_equalizer_state_e equalizer,
- void *user_data)
-{
-
-}
-
-void repeat_mode_changed_cb_for_avrcp_p(
- bt_avrcp_repeat_mode_e repeat, void *user_data)
-{
-
-}
-
-void shuffle_mode_changed_cb_for_avrcp_p(
- bt_avrcp_shuffle_mode_e shuffle, void *user_data)
-{
-
-}
-
-void scan_mode_changed_cb_for_avrcp_p(
- bt_avrcp_scan_mode_e scan, void *user_data)
-{
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_initialize()
- */
-static void utc_network_bluetooth_avrcp_targe_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_initialize(
- target_connection_state_changed_cb_for_avrcp_p,
- NULL);
- dts_check_eq("bt_avrcp_target_initialize",
- ret, BT_ERROR_NONE,
- "bt_avrcp_target_initialize() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_deinitialize()
- */
-static void utc_network_bluetooth_avrcp_target_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_deinitialize();
- dts_check_eq("bt_avrcp_target_deinitialize", ret, BT_ERROR_NONE,
- "bt_avrcp_target_deinitialize() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_equalizer_state()
- */
-static void utc_network_bluetooth_avrcp_target_notify_equalizer_state_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_equalizer_state(
- BT_AVRCP_EQUALIZER_STATE_ON);
- dts_check_eq("bt_avrcp_target_notify_equalizer_state", ret,
- BT_ERROR_NONE,
- "bt_avrcp_target_notify_equalizer_state() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_repeat_mode()
- */
-static void utc_network_bluetooth_avrcp_target_notify_repeat_mode_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_repeat_mode(
- BT_AVRCP_REPEAT_MODE_ALL_TRACK);
- dts_check_eq("bt_avrcp_target_notify_repeat_mode", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_repeat_mode() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_shuffle_mode()
- */
-static void utc_network_bluetooth_avrcp_target_notify_shuffle_mode_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_shuffle_mode(
- BT_AVRCP_SHUFFLE_MODE_ALL_TRACK);
- dts_check_eq("bt_avrcp_target_notify_shuffle_mode", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_shuffle_mode() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_scan_mode()
- */
-static void utc_network_bluetooth_avrcp_target_notify_scan_mode_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_scan_mode(
- BT_AVRCP_SCAN_MODE_ALL_TRACK);
- dts_check_eq("bt_avrcp_target_notify_scan_mode", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_scan_mode() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_player_state()
- */
-static void utc_network_bluetooth_avrcp_target_notify_player_state_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_player_state(
- BT_AVRCP_PLAYER_STATE_PLAYING);
- dts_check_eq("bt_avrcp_target_notify_player_state", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_player_state() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_position()
- */
-static void utc_network_bluetooth_avrcp_target_notify_position_p(void)
-{
- int ret = BT_ERROR_NONE;
- unsigned int position = 0;
- ret = bt_avrcp_target_notify_position(position);
- dts_check_eq("bt_avrcp_target_notify_position", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_position() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_target_notify_track()
- */
-static void utc_network_bluetooth_avrcp_target_notify_track_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_target_notify_track("title",
- "artist", "album",
- "genre", 5, 20, 2);
- dts_check_eq("bt_avrcp_target_notify_track", ret, BT_ERROR_NONE,
- "bt_avrcp_target_notify_track() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_set_equalizer_state_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_equalizer_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_equalizer_state_changed_cb(
- equalizer_state_changed_cb_for_avrcp_p,
- NULL);
- dts_check_eq("bt_avrcp_set_equalizer_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_avrcp_set_equalizer_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_unset_equalizer_state_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_unset_equalizer_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_unset_equalizer_state_changed_cb();
- dts_check_eq("bt_avrcp_unset_equalizer_state_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_avrcp_unset_equalizer_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_set_repeat_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_repeat_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_repeat_mode_changed_cb(
- repeat_mode_changed_cb_for_avrcp_p, NULL);
- dts_check_eq("bt_avrcp_set_repeat_mode_changed_cb", ret, BT_ERROR_NONE,
- "bt_avrcp_set_repeat_mode_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_unset_repeat_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_unset_repeat_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_unset_repeat_mode_changed_cb();
- dts_check_eq("bt_avrcp_unset_repeat_mode_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_avrcp_unset_repeat_mode_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_set_shuffle_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_shuffle_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_shuffle_mode_changed_cb(
- shuffle_mode_changed_cb_for_avrcp_p,
- NULL);
- dts_check_eq("bt_avrcp_set_shuffle_mode_changed_cb", ret, BT_ERROR_NONE,
- "bt_avrcp_set_shuffle_mode_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_unset_shuffle_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_unset_shuffle_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_unset_shuffle_mode_changed_cb();
- dts_check_eq("bt_avrcp_unset_shuffle_mode_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_avrcp_unset_shuffle_mode_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_avrcp_set_scan_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_set_scan_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_set_scan_mode_changed_cb(
- scan_mode_changed_cb_for_avrcp_p,
- NULL);
- dts_check_eq("bt_avrcp_set_scan_mode_changed_cb", ret, BT_ERROR_NONE,
- "bt_avrcp_set_scan_mode_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_avrcp_unset_scan_mode_changed_cb()
- */
-static void utc_network_bluetooth_avrcp_unset_scan_mode_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_avrcp_unset_scan_mode_changed_cb();
- dts_check_eq("bt_avrcp_unset_scan_mode_changed_cb", ret, BT_ERROR_NONE,
- "bt_avrcp_unset_scan_mode_changed_cb() failed.");
-
-}
-
+++ /dev/null
-/*
- * utc_network_bluetooth_common_negative.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include "bluetooth.h"
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-void adapter_state_changed_cb_for_common_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_common_n,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_common_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_common_positive.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include <bluetooth.h>
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-void adapter_state_changed_cb_for_common_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-static void utc_network_bluetooth_bt_initialize_p(void);
-static void utc_network_bluetooth_bt_deinitialize_p(void);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_bt_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_bt_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_common_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_common_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-/**
- * @brief Positive test case of bt_initialize()
- */
-static void utc_network_bluetooth_bt_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_initialize();
- dts_check_eq("bt_initialize", ret, BT_ERROR_NONE,
- "bt_initialize() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_deinitialize()
- */
-static void utc_network_bluetooth_bt_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_deinitialize();
- dts_check_eq("bt_deinitialize", ret, BT_ERROR_NONE,
- "bt_deinitialize() failed.");
-
-}
-
-
-
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static GMainLoop *mainloop;
-gboolean timeout_func(gpointer data);
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_device_discovery_cancel_n(void);
-static void utc_network_bluetooth_device_discovery_unset_state_changed_cb_n(void);
-static void utc_network_bluetooth_device_discovery_set_state_changed_cb_n(void);
-static void utc_network_bluetooth_device_discovery_start_n(void);
-static void utc_network_bluetooth_device_discovery_get_status_n(void);
-
-void adapter_state_changed_cb_for_discovery_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_device_discovery_cancel_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_set_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_get_status_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_start_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_unset_state_changed_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_discovery_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_discovery_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-/**
- *@brief Negative test case of bt_adapter_stop_device_discovery()
- */
-static void utc_network_bluetooth_device_discovery_cancel_n(void)
-{
- int ret = bt_adapter_stop_device_discovery();
-
- dts_check_eq("bt_adapter_stop_device_discovery", ret,
- BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- *@brief Negative test case of bt_adapter_unset_device_discovery_state_changed_cb()
- */
-static void utc_network_bluetooth_device_discovery_unset_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- if (bt_deinitialize() != BT_ERROR_NONE) {
- dts_fail("bt_adapter_unset_device_discovery_state_changed_cb",
- "bt_deinitialize() failed.");
- }
- ret = bt_adapter_unset_device_discovery_state_changed_cb();
- dts_check_eq("bt_adapter_unset_device_discovery_state_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- *@brief Negative test case of bt_adapter_set_device_discovery_state_changed_cb()
- */
-static void utc_network_bluetooth_device_discovery_set_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_device_discovery_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_adapter_set_device_discovery_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- *@brief Negative test case of bt_adapter_start_device_discovery()
- */
-static void utc_network_bluetooth_device_discovery_start_n(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
-
- ret = bt_adapter_start_device_discovery();;
- dts_check_eq("bt_adapter_start_device_discovery", ret,
- BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- *@brief Negative test case of bt_adapter_is_discovering()
- */
-static void utc_network_bluetooth_device_discovery_get_status_n(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- bool status = false;
-
- ret = bt_adapter_is_discovering(&status);
- dts_check_eq("bt_adapter_is_discovering", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static GMainLoop *mainloop;
-static bool callback_result = false;
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_device_discovery_get_status_p(void);
-static void utc_network_bluetooth_device_discovery_set_state_changed_cb_p(void);
-static void utc_network_bluetooth_device_discovery_start_p(void);
-static void utc_network_bluetooth_device_discovery_unset_state_changed_cb_p(void);
-static void utc_network_bluetooth_device_discovery_cancel_p(void);
-
-gboolean timeout_func(gpointer data);
-void adapter_state_changed_cb_for_discovery_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-void device_discovery_state_changed_cb_for_discovery_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_device_discovery_get_status_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_set_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_start_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_unset_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_device_discovery_cancel_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_discovery_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed.");
- }
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- tet_printf("BT was already enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_enable() failed.");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf
- ("bt_adapter_unset_device_discovery_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- tet_printf("TC end");
- bt_deinitialize();
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_discovery_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- } else {
- tet_printf("Callback: bt_adapter_state_changed_cb() was \
- called but bt_adapter_enable() failed.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-void device_discovery_state_changed_cb_for_discovery_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data)
-{
- tet_printf("Callback: device_discovery_state_changed_cb_for_discovery_p is called");
-
- if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FOUND) {
- tet_printf("Callback: Devices were found");
- tet_printf("Callback: Device name is %s",
- discovery_info->remote_name);
- tet_printf("Callback: Service class: %x",
- discovery_info->bt_class.major_service_class_mask);
- if (user_data != NULL &&
- !strcmp((char *)user_data, "start")) {
- callback_result = true;
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- } else if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
- tet_printf("Callback: Device discovery finished");
- if (user_data != NULL) {
- if (!strcmp((char *)user_data, "start") &&
- callback_result == false) {
- tet_printf("You need a discoverable device");
- tet_printf("utc_network_bluetooth_device_discovery_start_p and \
- utc_network_bluetooth_device_discovery_cancel_p will fail");
- } else if (!strcmp((char *)user_data, "cancel")) {
- if (result == BT_ERROR_CANCELLED) {
- callback_result = true;
- }
- }
- }
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_is_discovering()
- */
-static void utc_network_bluetooth_device_discovery_get_status_p(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- bool status = false;
-
- ret = bt_adapter_is_discovering(&status);
- dts_check_eq("bt_adapter_is_discovering",
- ret, BT_ERROR_NONE,
- "bt_adapter_is_discovering() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_set_device_discovery_state_changed_cb()
- */
-static void utc_network_bluetooth_device_discovery_set_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_set_device_discovery_state_changed_cb(
- device_discovery_state_changed_cb_for_discovery_p,
- "start");
- dts_check_eq("bt_adapter_set_device_discovery_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_adapter_set_device_discovery_state_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_adapter_start_device_discovery()
- */
-static void utc_network_bluetooth_device_discovery_start_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- callback_result = false;
-
- ret = bt_adapter_start_device_discovery();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_device_discovery_state_changed_cb_for_discovery_p() will be called.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_adapter_start_device_discovery",
- callback_result, true,
- "Callback was called but failed.");
- } else {
- dts_fail("bt_adapter_start_device_discovery",
- "bt_adapter_start_device_discovery() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_adapter_unset_device_discovery_state_changed_cb()
- */
-static void utc_network_bluetooth_device_discovery_unset_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_unset_device_discovery_state_changed_cb();
- dts_check_eq("bt_adapter_unset_device_discovery_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_device_discovery_uset_state_changed_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_adapter_stop_device_discovery()
- */
-static void utc_network_bluetooth_device_discovery_cancel_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- callback_result = false;
-
- if (bt_adapter_set_device_discovery_state_changed_cb
- (device_discovery_state_changed_cb_for_discovery_p,
- "cancel") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_stop_device_discovery",
- "bt_adapter_set_device_discovery_state_changed_cb() failed");
- }
-
- ret = bt_adapter_stop_device_discovery();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_device_discovery_state_changed_cb_for_discovery_p() will be called");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_adapter_unset_device_discovery_state_changed_cb();
- dts_check_eq("bt_adapter_stop_device_discovery",
- callback_result, true,
- "Callback was called but failed");
- } else {
- dts_fail("bt_adapter_stop_device_discovery",
- "bt_adapter_stop_device_discovery() failed");
- }
-
-}
-
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-gboolean timeout_func(gpointer data);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_device_set_bonded_cb_n(void);
-static void utc_network_bluetooth_device_set_unbonded_cb_n(void);
-static void utc_network_bluetooth_device_set_authorization_state_changed_cb_n(void);
-static void utc_network_bluetooth_device_cancel_bonding_n(void);
-static void utc_network_bluetooth_device_bond_n(void);
-static void utc_network_bluetooth_device_foreach_bonded_device_n(void);
-static void utc_network_bluetooth_device_set_alias_n(void);
-static void utc_network_bluetooth_device_set_authorization_n(void);
-static void utc_network_bluetooth_device_unbond_n(void);
-static void utc_network_bluetooth_device_unset_bonded_cb_n(void);
-static void utc_network_bluetooth_device_unset_unbonded_cb_n(void);
-static void utc_network_bluetooth_device_unset_authorization_state_changed_cb_n(void);
-static void utc_network_bluetooth_device_get_rssi_strength_n(void);
-static void utc_network_bluetooth_device_disable_rssi_monitor_n(void);
-static void utc_network_bluetooth_device_enable_rssi_monitor_n(void);
-static void utc_network_bluetooth_device_unset_rssi_alert_cb_n(void);
-
-void adapter_state_changed_cb_for_device_negative(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_device_set_bonded_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_set_unbonded_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_set_authorization_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_bond_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_cancel_bonding_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_unbond_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_foreach_bonded_device_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_set_alias_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_set_authorization_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_get_rssi_strength_n, NEGATIVE_TC_IDX },
- {utc_network_bluetooth_device_enable_rssi_monitor_n, NEGATIVE_TC_IDX },
- {utc_network_bluetooth_device_disable_rssi_monitor_n, NEGATIVE_TC_IDX },
- {utc_network_bluetooth_device_unset_rssi_alert_cb_n, NEGATIVE_TC_IDX },
- {utc_network_bluetooth_device_unset_bonded_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_unset_unbonded_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_device_unset_authorization_state_changed_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_device_negative,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_device_negative(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if ((user_data != NULL) &&
- !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-/**
- * @brief Negative test case of bt_device_set_bond_created_cb()
- */
-static void utc_network_bluetooth_device_set_bonded_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_bond_created_cb(NULL, NULL);
- dts_check_eq("bt_device_set_bond_created_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_set_bond_destroyed_cb()
- */
-static void utc_network_bluetooth_device_set_unbonded_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_bond_destroyed_cb(NULL, NULL);
- dts_check_eq("bt_device_set_bond_destroyed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_set_authorization_changed_cb()
- */
-static void
-utc_network_bluetooth_device_set_authorization_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_authorization_changed_cb(NULL, NULL);
- dts_check_eq("bt_device_set_authorization_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_unset_bond_created_cb()
- */
-static void utc_network_bluetooth_device_unset_bonded_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_deinitialize();
-
- ret = bt_device_unset_bond_created_cb();
- dts_check_eq("bt_device_unset_bond_created_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
-
- /**
- * @brief Negative test case of bt_device_unset_bond_destroyed_cb()
- */
-static void utc_network_bluetooth_device_unset_unbonded_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_unset_bond_destroyed_cb();
- dts_check_eq("bt_device_unset_bond_destroyed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_device_unset_authorization_changed_cb()
- */
-static void
-utc_network_bluetooth_device_unset_authorization_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_unset_authorization_changed_cb();
- dts_check_eq("bt_device_unset_authorization_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
- /**
- * @brief Negative test case of bt_device_create_bond()
- */
-static void utc_network_bluetooth_device_bond_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_create_bond(NULL);
- dts_check_eq("bt_device_create_bond",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
- /**
- * @brief Negative test case of bt_device_cancel_bonding()
- */
-static void utc_network_bluetooth_device_cancel_bonding_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_cancel_bonding();
- dts_check_eq("bt_device_cancel_bonding",
- ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- * @brief Negative test case of bt_device_destroy_bond()
- */
-static void utc_network_bluetooth_device_unbond_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_destroy_bond(NULL);
- dts_check_eq("bt_device_destroy_bond",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_adapter_foreach_bonded_device()
- */
-static void utc_network_bluetooth_device_foreach_bonded_device_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_foreach_bonded_device(NULL, NULL);
- dts_check_eq("bt_adapter_foreach_bonded_device",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_set_alias()
- */
-static void utc_network_bluetooth_device_set_alias_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_alias(NULL, "dts_alias");
- dts_check_eq("bt_device_set_alias",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when address parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_set_authorization()
- */
-static void utc_network_bluetooth_device_set_authorization_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_authorization(NULL, BT_DEVICE_AUTHORIZED);
- dts_check_eq("bt_device_set_authorization",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when address parameter is NULL");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-static bool callback_result = false;
-char target_name[128] = "dts_test";
-char *target_address;
-bt_device_info_s *device_info = NULL;
-bool discovery_result = false;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_device_set_bonded_cb_p(void);
-static void utc_network_bluetooth_device_set_unbonded_cb_p(void);
-static void utc_network_bluetooth_device_set_authorization_state_changed_cb_p(void);
-static void utc_network_bluetooth_device_cancel_bonding_p(void);
-static void utc_network_bluetooth_device_bond_p(void);
-static void utc_network_bluetooth_device_foreach_bonded_device_p(void);
-static void utc_network_bluetooth_device_set_alias_p(void);
-static void utc_network_bluetooth_device_set_authorization_p(void);
-static void utc_network_bluetooth_device_unbond_p(void);
-static void utc_network_bluetooth_device_unset_bonded_cb_p(void);
-static void utc_network_bluetooth_device_unset_unbonded_cb_p(void);
-static void utc_network_bluetooth_device_unset_authorization_state_changed_cb_p(void);
-static void utc_network_bluetooth_device_get_rssi_strength_p(void);
-static void utc_network_bluetooth_device_disable_rssi_monitor_p(void);
-static void utc_network_bluetooth_device_enable_rssi_monitor_p(void);
-static void utc_network_bluetooth_device_unset_rssi_alert_cb_p(void);
-
-gboolean timeout_func(gpointer data);
-void adapter_state_changed_cb_for_device_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-void device_discovery_state_changed_cb_for_device_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data);
-void device_bonded_cb(int result, bt_device_info_s *device_info,
- void *user_data);
-void device_unbonded_cb(int result, char *remote_address, void *user_data);
-void device_authorization_state_changed_cb(bt_device_authorization_e authorization_state, \
- char *remote_address, void *user_data);
-bool bonded_device_cb_for_device_p(bt_device_info_s *dev_info,
- void *user_data);
-void device_get_rssi_strength_cb(char *bt_address,
- bt_device_connection_link_type_e link_type,
- int rssi_dbm, void *user_data);
-static void device_rssi_enabled_cb(const char *address,
- bt_device_connection_link_type_e link_type,
- int rssi_enabled, void *user_data);
-static void device_rssi_alert_cb(char *bt_address,
- bt_device_connection_link_type_e link_type,
- int rssi_alert_type, int rssi_alert_dbm, void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- { utc_network_bluetooth_device_set_bonded_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_bond_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_foreach_bonded_device_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_set_alias_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_set_authorization_state_changed_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_set_authorization_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_unset_bonded_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_unset_authorization_state_changed_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_get_rssi_strength_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_enable_rssi_monitor_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_disable_rssi_monitor_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_unset_rssi_alert_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_set_unbonded_cb_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_cancel_bonding_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_unbond_p, POSITIVE_TC_IDX },
- { utc_network_bluetooth_device_unset_unbonded_cb_p, POSITIVE_TC_IDX },
- { NULL, 0 },
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_MOBILE") == 0) {
- token = strtok(NULL, "=");
- target_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- callback_result = false;
- discovery_result = false;
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_device_p, "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- if (bt_adapter_set_device_discovery_state_changed_cb(device_discovery_state_changed_cb_for_device_p, "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_device_discovery_state_changed_cb() failed.");
- }
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
-
- tet_printf("BT was enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- tet_printf("BT was already enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else {
- tet_printf("DTS may fail because bt_adapter_enable() failed.");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_state_changed_cb() failed.");
- }
-
- if (bt_adapter_unset_device_discovery_state_changed_cb() !=
- BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_device_discovery_state_changed_cb() failed.");
- }
-
- tet_printf("TC start.");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- if (device_info != NULL)
- free(device_info);
-
- bt_deinitialize();
- tet_printf("TC end");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("[%s] Callback: Timeout.", __FUNCTION__);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_device_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb() was called");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- } else {
- tet_printf("Callback: BT was not enabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-void device_discovery_state_changed_cb_for_device_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_device_discovery_state_changed_cb() was called");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
- tet_printf("Callback: Device discovery finished. DTS will be started.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- } else if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FOUND) {
- tet_printf("Callback: Devices were founded (%s)", discovery_info->remote_name);
- if (discovery_info->remote_name != NULL && !strcmp(discovery_info->remote_name, target_name)) {
- discovery_result = true;
- tet_printf("Callback: dts_test device was found.");
- strncpy(target_address, discovery_info->remote_address, 18);
- tet_printf("Callback: device address: [%s]", discovery_info->remote_address);
- if (bt_adapter_stop_device_discovery() == BT_ERROR_NONE) {
- tet_printf("Callback: Device discovery will be stopped");
- }
- }
- }
- }
-}
-
-void device_bonded_cb(int result, bt_device_info_s *device_info,
- void *user_data)
-{
- int i = 0;
-
- tet_printf("Callback: bt_device_bond_created_cb() was called.");
- if (result == BT_ERROR_TIMED_OUT)
- tet_printf("result is BT_ERROR_TIMEOUT");
- else if (result == BT_ERROR_CANCELLED)
- tet_printf("result is BT_ERROR_CANCELLED");
- else if (result == BT_ERROR_AUTH_FAILED)
- tet_printf("result is BT_ERROR_AUTH_FAILED");
- else if (result == BT_ERROR_OPERATION_FAILED)
- tet_printf("result is BT_ERROR_OPERATION_FAILED");
- else if (result == BT_ERROR_AUTH_REJECTED)
- tet_printf("result is BT_ERROR_AUTH_REJECTED");
- else if (result == BT_ERROR_REMOTE_DEVICE_NOT_FOUND)
- tet_printf("result is BT_ERROR_REMOTE_DEVICE_NOT_FOUND");
- else if (result == BT_ERROR_NONE)
- tet_printf("result is BT_ERROR_NONE");
- else
- tet_printf("result is unknown: %s",
- _bt_convert_error_to_string(result));
-
- /* in case of bt_device_cancel_bonding() */
- if (user_data != NULL && !strcmp((char *)user_data, "cancel")) {
- if (result == BT_ERROR_CANCELLED) {
- tet_printf("Callback: Cancellation of bonding succeeded");
- callback_result = true;
- } else {
- tet_printf("Callback: Cancellation of bonding failed");
- }
- } /* in case of bt_device_create_bond() */
- else if (user_data != NULL && !strcmp((char *)user_data, "bond")) {
- if (device_info == NULL) {
- tet_printf("Callback data is NULL");
-
- if (result == BT_ERROR_CANCELLED)
- tet_printf("No user input in the peer device");
-
- if (mainloop)
- g_main_loop_quit(mainloop);
-
- return;
- }
-
- if (device_info->remote_name != NULL && !strcmp(device_info->remote_name, target_name)) {
- if (result == BT_ERROR_NONE) {
- tet_printf("Callback: Bonding succeeded");
- tet_printf("Callback: serivce count : %d", device_info->service_count);
- callback_result = true;
- for (i = 0; i < device_info->service_count; i++) {
- tet_printf("Callback: service list[%d] - %s", i + 1, device_info->service_uuid[i]);
- }
- } else {
- tet_printf("Callback: Bonding failed");
- }
- }
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-}
-
-void device_unbonded_cb(int result, char *remote_address, void *user_data)
-{
- tet_printf("Callback: bt_device_bond_destroyed_cb() was called.");
- tet_printf("Callback: target address");
- if (target_address != NULL) {
- tet_printf("device address: %s", target_address);
- } else
- tet_printf("Callback: target address is NULL!");
-
- tet_printf("Callback: address of unbonded device");
- if (remote_address != NULL) {
- tet_printf("device address: %s", remote_address);
- } else
- tet_printf("Callback: address of unbonded device is NULL!");
-
- if ((remote_address != NULL) && \
- !strcmp(remote_address, target_address)) {
- if (result == BT_ERROR_NONE) {
- tet_printf("Callback: Unbonding succeeded");
- callback_result = true;
- } else {
- tet_printf("Callback: Unbonding failed");
- }
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-
-}
-
-void device_authorization_state_changed_cb(bt_device_authorization_e authorization_state, \
- char *address, void *user_data)
-{
- if (authorization_state == BT_DEVICE_AUTHORIZED) {
- if (address != NULL && !strcmp(address, target_address)) {
- callback_result = true;
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- } else {
- if (address != NULL && !strcmp(address, target_address)) {
- callback_result = true;
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-void device_get_rssi_strength_cb(char *bt_address,
- bt_device_connection_link_type_e link_type,
- int rssi_dbm, void *user_data)
-{
- tet_printf("Callback:Rssi_strength_cb is called.");
- tet_printf("RSSI Strength: [Address %s][Link Type %d][RSSI dBm %d]",
- bt_address, link_type, rssi_dbm);
-}
-
-static void device_rssi_enabled_cb(const char *address,
- bt_device_connection_link_type_e link_type,
- int rssi_enabled, void *user_data)
-{
- tet_printf("Callback:Rssi_enabled_cb is called.");
- tet_printf("RSSI Enabled: %s %d %d", address, link_type, rssi_enabled);
-}
-
-static void device_rssi_alert_cb(char *bt_address,
- bt_device_connection_link_type_e link_type,
- int rssi_alert_type, int rssi_alert_dbm, void *user_data)
-{
- tet_printf("Callback:rssi_alert_cb is called.");
- tet_printf("RSSI Alert: [Address:%s LinkType:%d][RSSI Alert Type:%d dBm:%d]",
- bt_address, link_type, rssi_alert_type, rssi_alert_dbm);
-}
-
-/**
- * @brief Positive test case of bt_device_set_bond_created_cb()
- */
-static void utc_network_bluetooth_device_set_bonded_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_set_bond_created_cb(device_bonded_cb, "cancel");
- dts_check_eq("bt_device_set_bond_created_cb", ret, BT_ERROR_NONE,
- "bt_device_set_bond_created_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_set_bond_destroyed_cb()
- */
-static void utc_network_bluetooth_device_set_unbonded_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_set_bond_destroyed_cb(device_unbonded_cb, NULL);
- dts_check_eq("bt_device_set_bond_destroyed_cb", ret, BT_ERROR_NONE,
- "bt_device_set_bond_destroyed_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_set_authorization_changed_cb()
- */
-static void
-utc_network_bluetooth_device_set_authorization_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_set_authorization_changed_cb(device_authorization_state_changed_cb, NULL);
- dts_check_eq("bt_device_set_authorization_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_device_set_authorization_changed_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_cancel_bonding()
- */
-static void utc_network_bluetooth_device_cancel_bonding_p(void)
-{
- int ret = BT_ERROR_NONE;
- callback_result = false;
- int timeout_id = 0;
-
- if (bt_device_set_bond_created_cb(device_bonded_cb, "cancel") !=
- BT_ERROR_NONE) {
- dts_fail("bt_device_cancel_bonding",
- "bt_device_set_bond_created_cb() failed");
- }
-
- /* bond device */
- ret = bt_device_create_bond(target_address);
- if (ret != BT_ERROR_NONE) {
- dts_fail("bt_device_cancel_bonding",
- "bt_device_create_bond failed");
- }
- tet_printf("bt_device_create_bond() was called");
-
- /* cancel bonding */
- ret = bt_device_cancel_bonding();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_device_cancel_bonding() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_device_unset_bond_created_cb();
- dts_check_eq("bt_device_cancel_bonding", callback_result, true,
- "Failed");
- } else {
- bt_device_unset_bond_created_cb();
- dts_fail("bt_device_cancel_bonding",
- "bt_device_cancel_bonding() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_unset_bond_created_cb()
- */
-static void utc_network_bluetooth_device_unset_bonded_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_unset_bond_created_cb();
- dts_check_eq("bt_device_unset_bond_created_cb", ret, BT_ERROR_NONE,
- "bt_device_unset_bond_created_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_create_bond()
- */
-static void utc_network_bluetooth_device_bond_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- callback_result = false;
-
- /* bond device */
- ret = bt_device_set_bond_created_cb(device_bonded_cb, "bond");
- if (ret != BT_ERROR_NONE) {
- tet_printf("bt_device_set_bond_created_cb was called");
- }
-
- ret = bt_device_create_bond(target_address);
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_device_bond_created_cb() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- bt_device_unset_bond_created_cb();
- dts_check_eq("bt_device_create_bond", ret, BT_ERROR_NONE,
- "bt_device_create_bond() failed.");
- } else {
- bt_device_unset_bond_created_cb();
- dts_fail("bt_device_create_bond",
- "bt_device_create_bond() failed");
- }
-}
-
-
-bool bonded_device_cb_for_device_p(bt_device_info_s *dev_info, void *user_data)
-{
- int i = 0;
- device_info = (bt_device_info_s *) malloc(sizeof(bt_device_info_s));
- if (device_info == NULL) {
- tet_printf("Callback: Memory allocation failed");
- } else if (dev_info != NULL) {
- device_info->remote_address = strdup(dev_info->remote_address);
- tet_printf("device address : %s", device_info->remote_address);
- device_info->remote_name = strdup(dev_info->remote_name);
- tet_printf("device name : %s", device_info->remote_name);
- device_info->bt_class.major_device_class = dev_info->bt_class.major_device_class;
- tet_printf("major clasee : %2.2X", device_info->bt_class.major_device_class);
- device_info->bt_class.minor_device_class = dev_info->bt_class.minor_device_class;
- tet_printf("minor clasee : %2.2X", device_info->bt_class.minor_device_class);
- device_info->bt_class.major_service_class_mask = dev_info->bt_class.major_service_class_mask;
- tet_printf("service clasee : %2.2X", device_info->bt_class.major_service_class_mask);
- device_info->service_count = dev_info->service_count;
- tet_printf("service count : %d", device_info->service_count);
- if (device_info->service_count > 0) {
- device_info->service_uuid = (char **)malloc(sizeof(char *) *device_info->service_count);
- if (device_info->service_uuid == NULL) {
- tet_printf("Failed to allocate memory");
- } else {
- if (dev_info->service_uuid == NULL) {
- tet_printf("service_list is NULL");
- } else {
- tet_printf("Copy service list");
- for (i = 0; i < device_info->service_count; i++) {
- device_info->service_uuid[i] = strdup(dev_info->service_uuid[i]);
- tet_printf("Callback: service list[%d] - %s", i + 1, device_info->service_uuid[i]);
- }
- }
- }
- } else
- device_info->service_uuid = NULL;
-
- device_info->is_bonded = dev_info->is_bonded;
- tet_printf("is_bonded : %d", device_info->is_bonded);
- device_info->is_connected = dev_info->is_connected;
- tet_printf("is_connected : %d", device_info->is_connected);
- tet_printf("Callback: device_info was selected.");
- }
-
- return false;
-}
-
-/**
- * @brief Positive test case of bt_adapter_foreach_bonded_device()
- */
-static void utc_network_bluetooth_device_foreach_bonded_device_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_adapter_foreach_bonded_device(bonded_device_cb_for_device_p, NULL);
- if (ret == BT_ERROR_NONE) {
- dts_pass("bt_adapter_foreach_bonded_device",
- "bt_adapter_foreach_bonded_device pass");
- } else {
- dts_fail("bt_adapter_foreach_bonded_device",
- "bt_adapter_foreach_bonded_device() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_set_alias()
- */
-static void utc_network_bluetooth_device_set_alias_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- if (device_info == NULL) {
- tet_printf("No device to alias");
- dts_fail("bt_device_set_alias", "bt_device_set_alias() failed");
- return;
- }
-
- ret = bt_device_set_alias(device_info->remote_address, "dts_alias");
- dts_check_eq("bt_device_set_alias", ret, BT_ERROR_NONE,
- "bt_device_set_alias() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_set_authorization()
- */
-static void utc_network_bluetooth_device_set_authorization_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- callback_result = false;
-
- ret = bt_device_set_authorization(target_address, BT_DEVICE_AUTHORIZED);
- if (ret == BT_ERROR_NONE) {
- tet_printf("device_authorization_state_changed_cb will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_device_set_authorization", ret, BT_ERROR_NONE,
- "bt_device_set_authorization() failed.");
- callback_result = false;
- } else {
- dts_fail("bt_device_set_authorization",
- "bt_device_set_authorization() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_destroy_bond()
- */
-static void utc_network_bluetooth_device_unbond_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
- callback_result = false;
-
- tet_printf("bt_device_destroy_bond() will start");
- ret = bt_device_destroy_bond(target_address);
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_device_unbond_cb() will be called");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_device_destroy_bond", ret, BT_ERROR_NONE,
- "bt_device_destroy_bond() failed.");
- } else {
- dts_fail("bt_device_destroy_bond",
- "bt_device_destroy_bond() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_unset_bond_destroyed_cb()
- */
-static void utc_network_bluetooth_device_unset_unbonded_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_unset_bond_destroyed_cb();
- dts_check_eq("bt_device_unset_bond_destroyed_cb", ret, BT_ERROR_NONE,
- "bt_device_unset_bond_destroyed_cb() failed");
-}
-
-/**
- * @brief Positive test case of bt_device_unset_authorization_changed_cb()
- */
-static void utc_network_bluetooth_device_unset_authorization_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- /* Normal operation test */
- ret = bt_device_unset_authorization_changed_cb();
- dts_check_eq("bt_device_unset_authorization_changed_cb", ret,
- BT_ERROR_NONE,
- "bt_device_unset_authorization_changed_cb() failed");
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_gatt_negative.c
- *
- * Created on: 23-Sep-2013
- * Author: shagun.garg
- */
-
-#include <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_gatt_foreach_primary_services_n(void);
-static void utc_network_bluetooth_gatt_discover_characteristics_n(void);
-static void utc_network_bluetooth_gatt_get_service_uuid_n(void);
-static void utc_network_bluetooth_gatt_foreach_included_services_n(void);
-static void utc_network_bluetooth_gatt_set_characteristic_changed_cb_n(void);
-static void utc_network_bluetooth_gatt_unset_characteristic_changed_cb_n(void);
-static void utc_network_bluetooth_gatt_get_characteristic_declaration_n(void);
-static void utc_network_bluetooth_gatt_set_characteristic_value_n(void);
-static void utc_network_bluetooth_gatt_clone_attribute_handle_n(void);
-static void utc_network_bluetooth_gatt_destroy_attribute_handle_n(void);
-static void utc_network_bluetooth_gatt_connect_n(void);
-static void utc_network_bluetooth_gatt_disconnect_n(void);
-static void utc_network_bluetooth_set_gatt_connection_state_changed_cb_n(void);
-static void utc_network_bluetooth_unset_gatt_connection_state_changed_cb_n(void);
-
-void adapter_state_changed_cb_for_gatt_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_gatt_foreach_primary_services_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_discover_characteristics_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_get_service_uuid_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_foreach_included_services_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_set_characteristic_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_set_gatt_connection_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_connect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_disconnect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_get_characteristic_declaration_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_set_characteristic_value_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_clone_attribute_handle_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_destroy_attribute_handle_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_unset_gatt_connection_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_gatt_unset_characteristic_changed_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_gatt_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_gatt_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if ((user_data != NULL) && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-
-/**
- * @brief Negative test case of bt_gatt_foreach_primary_services()
- */
-static void utc_network_bluetooth_gatt_foreach_primary_services_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_foreach_primary_services(NULL, NULL, NULL);
- dts_check_eq("bt_gatt_foreach_primary_services", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when remote address and callback parameters are NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_discover_characteristics()
- */
-static void utc_network_bluetooth_gatt_discover_characteristics_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_discover_characteristics(NULL, NULL, NULL);
- dts_check_eq("bt_gatt_discover_characteristics", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when service and callback parameters are NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_get_service_uuid()
- */
-static void utc_network_bluetooth_gatt_get_service_uuid_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_gatt_get_service_uuid(NULL, NULL);
- dts_check_eq("bt_gatt_get_service_uuid", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when service parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_foreach_included_services()
- */
-static void utc_network_bluetooth_gatt_foreach_included_services_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_foreach_included_services(NULL, NULL, NULL);
- dts_check_eq("bt_socket_unset_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when service and callback parameters are NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_set_characteristic_changed_cb()
- */
-static void utc_network_bluetooth_gatt_set_characteristic_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_set_characteristic_changed_cb(NULL, NULL);
- dts_check_eq("bt_gatt_set_characteristic_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when service and callback parameters are NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_unset_characteristic_changed_cb()
- */
-static void utc_network_bluetooth_gatt_unset_characteristic_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_unset_characteristic_changed_cb();
- dts_check_eq("bt_gatt_unset_characteristic_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
-
-
-/**
- * @brief Negative test case of bt_gatt_get_characteristic_declaration()
- */
-static void utc_network_bluetooth_gatt_get_characteristic_declaration_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_get_characteristic_declaration(NULL, NULL, NULL, 0);
- dts_check_eq("bt_gatt_get_characteristic_declaration", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when characteristic parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_set_characteristic_value()
- */
-static void utc_network_bluetooth_gatt_set_characteristic_value_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_set_characteristic_value(NULL, NULL, -1);
- dts_check_eq("bt_socket_connect_rfcomm", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when characteristic and value parameters are NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_clone_attribute_handle()
- */
-static void utc_network_bluetooth_gatt_clone_attribute_handle_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_clone_attribute_handle(NULL, NULL);
- dts_check_eq("bt_gatt_clone_attribute_handle", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when origin parameter is NULL.");
-}
-
-/**
- * @brief Negative test case of bt_gatt_destroy_attribute_handle()
- */
-static void utc_network_bluetooth_gatt_destroy_attribute_handle_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_destroy_attribute_handle(NULL);
- dts_check_eq("bt_gatt_destroy_attribute_handle", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when handle parameter is NULL.");
-}
-
-static void utc_network_bluetooth_gatt_connect_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_gatt_connect(NULL, false);
- dts_check_eq("bt_gatt_connect", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when address is NULL.");
-
-}
-
-static void utc_network_bluetooth_gatt_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_gatt_disconnect(NULL);
- dts_check_eq("bt_gatt_connect", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when address is NULL.");
-
-}
-
-static void utc_network_bluetooth_set_gatt_connection_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_set_connection_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_gatt_set_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when address is NULL.");
-}
-
-static void utc_network_bluetooth_unset_gatt_connection_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_deinitialize();
- ret = bt_gatt_unset_connection_state_changed_cb();
- dts_check_eq("bt_gatt_unset_connection_state_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT is not initialized.");
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_gatt_positive.c
- *
- * Created on: 23-Sep-2013
- * Author: shagun.garg
- */
-
-#include <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-char *remote_address;
-static GMainLoop *mainloop;
-
-static void utc_network_bluetooth_gatt_foreach_primary_services_p(void);
-static void utc_network_bluetooth_gatt_discover_characteristics_p(void);
-
-static void utc_network_bluetooth_gatt_get_service_uuid_p(void);
-static void utc_network_bluetooth_gatt_foreach_included_services_p(void);
-static void utc_network_bluetooth_gatt_set_characteristic_changed_cb_p(void);
-static void utc_network_bluetooth_gatt_unset_characteristic_changed_cb_p(void);
-static void utc_network_bluetooth_gatt_get_characteristic_declaration_p(void);
-static void utc_network_bluetooth_gatt_set_characteristic_value_p(void);
-static void utc_network_bluetooth_gatt_clone_attribute_handle_p(void);
-static void utc_network_bluetooth_gatt_destroy_attribute_handle_p(void);
-static void utc_network_bluetooth_gatt_connect_p(void);
-static void utc_network_bluetooth_gatt_disconnect_p(void);
-static void utc_network_bluetooth_set_gatt_connection_state_changed_cb_p(void);
-static void utc_network_bluetooth_unset_gatt_connection_state_changed_cb_p(void);
-
-gboolean timeout_func(gpointer data);
-void adapter_state_changed_cb_for_gatt_p(int result, bt_adapter_state_e adapter_state,
- void *user_data);
-void adapter_le_state_changed_cb_for_gatt_p(int result, bt_adapter_le_state_e adapter_state,
- void *user_data);
-
-bool primary_service_cb_for_gatt_p(bt_gatt_attribute_h service, void *user_data);
-bool included_service_cb_for_gatt_p(bt_gatt_attribute_h service, void *user_data);
-bool characteristics_discovered_cb_for_gatt_p(int result, int index, int total, bt_gatt_attribute_h characteristic,
- void *user_data);
-void characteristics_changed_cb_for_gatt_p(bt_gatt_attribute_h characteristic, unsigned char *value, int value_length,
- void *user_data);
-void gatt_connection_state_changed_cb(int result, bool connected,
- const char *remote_address, void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_gatt_foreach_primary_services_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_discover_characteristics_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_get_service_uuid_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_foreach_included_services_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_set_characteristic_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_set_gatt_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_connect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_disconnect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_unset_gatt_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_unset_characteristic_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_get_characteristic_declaration_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_set_characteristic_value_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_clone_attribute_handle_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_gatt_destroy_attribute_handle_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_LE") == 0) {
- token = strtok(NULL, "=");
- remote_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- tet_printf("TC start.");
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_gatt_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- if (bt_adapter_le_set_state_changed_cb(adapter_le_state_changed_cb_for_gatt_p, "enable") != BT_ERROR_NONE) {
- dts_fail("bt_adapter_le_enable",
- "bt_adapter_le_set_state_changed_cb() failed.");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- tet_printf("bt_adapter_le_enable() was called.");
- ret = bt_adapter_le_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_le_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("DTS may fail because bt_adapter_le_enable failed");
- bt_adapter_le_unset_state_changed_cb();
- }
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_enable failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("[%s] Callback: Timeout.", __FUNCTION__);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-
-
-void adapter_state_changed_cb_for_gatt_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-void adapter_le_state_changed_cb_for_gatt_p(int result,
- bt_adapter_le_state_e adapter_le__state, void *user_data)
-{
-
-}
-
-bool primary_service_cb_for_gatt_p(bt_gatt_attribute_h service,
- void *user_data)
-{
- return false;
-}
-
-bool characteristics_discovered_cb_for_gatt_p(int result,
- int index, int total, bt_gatt_attribute_h characteristic,
- void *user_data)
-{
- return false;
-}
-
-bool included_service_cb_for_gatt_p(bt_gatt_attribute_h service,
- void *user_data)
-{
- return false;
-}
-
-void characteristics_changed_cb_for_gatt_p(bt_gatt_attribute_h characteristic,
- unsigned char *value, int value_length,
- void *user_data)
-{
-
-}
-
-void gatt_connection_state_changed_cb(int result, bool connected,
- const char *remote_address, void *user_data)
-{
- tet_printf("bt_gatt_connection_state_changed_cb : %d", result);
- if (connected)
- tet_printf("LE Connected");
- else
- tet_printf("LE Disconnected");
-}
-
-/**
- * @brief Positive test case of bt_gatt_foreach_primary_services()
- */
-static void utc_network_bluetooth_gatt_foreach_primary_services_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_foreach_primary_services(remote_address,
- primary_service_cb_for_gatt_p, NULL);
- dts_check_eq("bt_gatt_foreach_primary_services",
- ret, BT_ERROR_NONE,
- "bt_gatt_foreach_primary_services() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_discover_characteristics()
- */
-static void utc_network_bluetooth_gatt_discover_characteristics_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_gatt_attribute_h gatt_serv;
- gatt_serv = g_malloc0(sizeof(bt_gatt_attribute_h));
-
- ret = bt_gatt_discover_characteristics(gatt_serv,
- characteristics_discovered_cb_for_gatt_p, NULL);
- dts_check_eq("bt_gatt_discover_characteristics",
- ret, BT_ERROR_NONE,
- "bt_gatt_discover_characteristics() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_get_service_uuid()
- */
-static void utc_network_bluetooth_gatt_get_service_uuid_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *uid = "dts_uid";
- bt_gatt_attribute_h gatt_serv;
- gatt_serv = g_malloc0(sizeof(bt_gatt_attribute_h));
-
- ret = bt_gatt_get_service_uuid(gatt_serv, &uid);
- dts_check_eq("bt_gatt_get_service_uuid",
- ret, BT_ERROR_NONE,
- "bt_gatt_get_service_uuid() failed.");
-}
-
-/**
- * @brief Positive test case of bt_gatt_foreach_included_services()
- */
-static void utc_network_bluetooth_gatt_foreach_included_services_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_gatt_attribute_h gatt_serv;
- gatt_serv = g_malloc0(sizeof(bt_gatt_attribute_h));
- ret = bt_gatt_foreach_included_services(gatt_serv,
- included_service_cb_for_gatt_p, NULL);
- dts_check_eq("bt_gatt_foreach_included_services",
- ret, BT_ERROR_NONE,
- "bt_gatt_foreach_included_services() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_set_characteristic_changed_cb()
- */
-static void utc_network_bluetooth_gatt_set_characteristic_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_set_characteristic_changed_cb(
- characteristics_changed_cb_for_gatt_p, NULL);
- dts_check_eq("bt_gatt_set_characteristic_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_gatt_set_characteristic_changed_cb() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_unset_characteristic_changed_cb()
- */
-static void utc_network_bluetooth_gatt_unset_characteristic_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_unset_characteristic_changed_cb();
- dts_check_eq("bt_gatt_unset_characteristic_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_gatt_unset_characteristic_changed_cb() failed.");
-
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_get_characteristic_declaration()
- */
-static void utc_network_bluetooth_gatt_get_characteristic_declaration_p(void)
-{
- int ret = BT_ERROR_NONE;
- char **uid = "dts_uid";
- unsigned char **val = "dts_value";
- int l = 1;
- bt_gatt_attribute_h gatt_charac;
- gatt_charac = g_malloc0(sizeof(bt_gatt_attribute_h));
- ret = bt_gatt_get_characteristic_declaration(gatt_charac, uid, val, &l);
- dts_check_eq("bt_gatt_get_characteristic_declaration", ret, BT_ERROR_NONE,
- "gatt_get_characteristic_declaration() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_set_characteristic_value()
- */
-static void utc_network_bluetooth_gatt_set_characteristic_value_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_gatt_attribute_h gatt_charac;
- gatt_charac = g_malloc0(sizeof(bt_gatt_attribute_h));
- const unsigned char *gatt_value = "dts_value";
- ret = bt_gatt_set_characteristic_value(gatt_charac, gatt_value, strlen("dts_value"));
- dts_check_eq("bt_gatt_set_characteristic_value", ret, BT_ERROR_NONE,
- "bt_gatt_set_characteristic_value() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_clone_attribute_handle()
- */
-static void utc_network_bluetooth_gatt_clone_attribute_handle_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_gatt_attribute_h gatt_origin;
- bt_gatt_attribute_h gatt_clone;
- gatt_origin = g_malloc0(sizeof(bt_gatt_attribute_h));
- gatt_clone = g_malloc0(sizeof(bt_gatt_attribute_h));
-
- ret = bt_gatt_clone_attribute_handle(&gatt_clone, gatt_origin);
- dts_check_eq("bt_gatt_clone_attribute_handle", ret, BT_ERROR_NONE,
- "bt_gatt_clone_attribute_handle() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_gatt_destroy_attribute_handle()
- */
-static void utc_network_bluetooth_gatt_destroy_attribute_handle_p(void)
-{
- int ret = BT_ERROR_NONE;
- bt_gatt_attribute_h gatt_handle;
- gatt_handle = g_malloc0(sizeof(bt_gatt_attribute_h));
-
- ret = bt_gatt_destroy_attribute_handle(gatt_handle);
- dts_check_eq("bt_gatt_destroy_attribute_handle", ret, BT_ERROR_NONE,
- "bt_gatt_destroy_attribute_handle() failed.");
-}
-
-static void utc_network_bluetooth_gatt_connect_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_connect(remote_address, false);
- dts_check_eq("bt_gatt_connect", ret, BT_ERROR_NONE,
- "bt_gatt_connect() failed.");
-
-}
-
-static void utc_network_bluetooth_gatt_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_gatt_disconnect(remote_address);
- dts_check_eq("bt_gatt_connect", ret, BT_ERROR_NONE,
- "bt_gatt_connect() failed.");
-
-}
-
-static void utc_network_bluetooth_set_gatt_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_set_connection_state_changed_cb(gatt_connection_state_changed_cb, NULL);
- dts_check_eq("bt_gatt_set_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_gatt_set_connection_state_changed_cb() failed.");
-}
-
-static void utc_network_bluetooth_unset_gatt_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_gatt_unset_connection_state_changed_cb();
- dts_check_eq("bt_gatt_unset_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_gatt_unset_connection_state_changed_cb() failed.");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_hdp_register_sink_app_n(void);
-static void utc_network_bluetooth_hdp_unregister_sink_app_n(void);
-static void utc_network_bluetooth_hdp_connect_to_source_n(void);
-static void utc_network_bluetooth_hdp_disconnect_n(void);
-static void utc_network_bluetooth_hdp_send_data_n(void);
-static void utc_network_bluetooth_hdp_set_connection_state_changed_cb_n(void);
-static void utc_network_bluetooth_hdp_set_data_received_cb_n(void);
-
-void adapter_state_changed_cb_for_hdp_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- { utc_network_bluetooth_hdp_register_sink_app_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_connect_to_source_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_send_data_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_set_connection_state_changed_cb_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_set_data_received_cb_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_disconnect_n, NEGATIVE_TC_IDX },
- { utc_network_bluetooth_hdp_unregister_sink_app_n, NEGATIVE_TC_IDX },
- { NULL, 0 },
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_hdp_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_hdp_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-
-
-/**
- * @brief Negative test case of bt_hdp_set_data_received_cb()
- */
-static void utc_network_bluetooth_hdp_set_data_received_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_set_data_received_cb(
- NULL, NULL);
- dts_check_eq("bt_hdp_set_data_received_cb",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER is returned when cb parameters are NULL");
-}
-
-/**
- * @brief Negative test case of bt_hdp_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_hdp_set_connection_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_set_connection_state_changed_cb(NULL, NULL, NULL);
- dts_check_eq("bt_hdp_set_connection_state_changed_cb",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER is returned when cb parameters are NULL");
-}
-
-
-/**
- * @brief Negative test case of bt_hdp_disconnect()
- */
-static void utc_network_bluetooth_hdp_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_disconnect(NULL, 1);
- dts_check_eq("bt_hdp_disconnect",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when remote address parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_hdp_connect_to_source()
- */
-static void utc_network_bluetooth_hdp_connect_to_source_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_connect_to_source(NULL, NULL);
- dts_check_eq("bt_hdp_connect_to_source",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when remote address and app_id parameter are NULL");
-}
-
-/**
- * @brief Negative test case of bt_hdp_register_sink_app()
- */
-static void utc_network_bluetooth_hdp_register_sink_app_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_register_sink_app(1, NULL);
- dts_check_eq("bt_hdp_register_sink_app",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when app_id parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_hdp_unregister_sink_appe()
- */
-static void utc_network_bluetooth_hdp_unregister_sink_app_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_unregister_sink_app(NULL);
- dts_check_eq("bt_shdp_unregister_sink",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when app_id parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_hdp_send_data()
- */
-static void utc_network_bluetooth_hdp_send_data_n(void)
-{
- int ret = BT_ERROR_NONE;
- char *data = "dts_test";
-
- ret = bt_hdp_send_data(1, data, sizeof(data));
- dts_check_eq("bt_hdp_send_data",
- ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void(*tet_startup)(void) = startup;
-void(*tet_cleanup)(void) = cleanup;
-
-const char *appid = "/org/bluez/health_app_2";
-const char *remote_adr = "00:22:58:07:77:BB";
-
-static void utc_network_bluetooth_hdp_register_sink_app_p(void);
-static void utc_network_bluetooth_hdp_unregister_sink_app_p(void);
-static void utc_network_bluetooth_hdp_connect_to_source_p(void);
-static void utc_network_bluetooth_hdp_disconnect_p(void);
-static void utc_network_bluetooth_hdp_send_data_p(void);
-static void utc_network_bluetooth_hdp_set_connection_state_changed_cb_p(void);
-static void utc_network_bluetooth_hdp_unset_connection_state_changed_cb_p(void);
-static void utc_network_bluetooth_hdp_set_data_received_cb_p(void);
-static void utc_network_bluetooth_hdp_unset_data_received_cb_p(void);
-
-void data_received_cb_for_hdp_p(unsigned int channel, const char *data,
- unsigned int size, void *user_data);
-void connected_cb_for_hdp_p(int result, const char *remote_address,
- const char *app_id,
- bt_hdp_channel_type_e type, unsigned int channel, void *user_data);
-void disconnected_cb_for_hdp_p(int result, const char *remote_address,
- unsigned int channel, void *user_data);
-
-void adapter_state_changed_cb_for_hdp_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_hdp_register_sink_app_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_set_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_set_data_received_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_connect_to_source_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_send_data_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_disconnect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_unset_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_unset_data_received_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hdp_unregister_sink_app_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_hdp_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_hdp_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-
-void data_received_cb_for_hdp_p(unsigned int channel,
- const char *data, unsigned int size,
- void *user_data)
-{
-
-}
-
-void connected_cb_for_hdp_p(int result,
- const char *remote_address, const char *app_id,
- bt_hdp_channel_type_e type, unsigned int channel,
- void *user_data)
-{
-
-}
-
-void disconnected_cb_for_hdp_p(int result,
- const char *remote_address, unsigned int channel,
- void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_hdp_set_data_received_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_set_data_received_cb(
- data_received_cb_for_hdp_p, NULL);
- dts_check_eq("bt_hdp_set_data_received_cb",
- ret, BT_ERROR_NONE,
- "bt_hdp_set_data_received_cb() failed.");
-}
-
-
-static void utc_network_bluetooth_hdp_unset_data_received_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_unset_data_received_cb();
- dts_check_eq("bt_hdp_unset_data_received_cb",
- ret, BT_ERROR_NONE,
- "bt_hdp_unset_data_received_cb() failed.");
-}
-
-static void utc_network_bluetooth_hdp_set_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_set_connection_state_changed_cb(
- connected_cb_for_hdp_p,
- disconnected_cb_for_hdp_p, NULL);
- dts_check_eq("bt_hdp_set_connection_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_hdp_set_connection_state_changed_cb() failed.");
-}
-
-static void utc_network_bluetooth_hdp_unset_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_unset_connection_state_changed_cb();
- dts_check_eq("bt_hdp_unset_connection_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_hdp_unset_connection_state_changed_cb() failed.");
-}
-
-static void utc_network_bluetooth_hdp_send_data_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *dts_test = "dts_test";
-
- ret = bt_hdp_send_data(1, "dts_test", sizeof(dts_test));
- dts_check_eq("bt_hdp_send_data", ret, BT_ERROR_NONE,
- "bt_hdp_send_data() failed.");
-}
-
-static void utc_network_bluetooth_hdp_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *remote_adr = "00:22:58:07:77:BB";
-
- ret = bt_hdp_disconnect(remote_adr, 0);
- dts_check_eq("bt_hdp_disconnect",
- ret, BT_ERROR_NONE,
- "bt_hdp_disconnect() failed.");
-}
-
-static void utc_network_bluetooth_hdp_connect_to_source_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_connect_to_source(remote_adr, appid);
- dts_check_eq("bt_hdp_connect_to_source",
- ret, BT_ERROR_NONE,
- "bt_hdp_connect_to_source() failed.");
-
-}
-
-static void utc_network_bluetooth_hdp_unregister_sink_app_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_unregister_sink_app(appid);
- dts_check_eq("bt_hdp_unregister_sink_app",
- ret, BT_ERROR_NONE,
- "bt_hdp_unregister_sink_app() failed.");
-
-}
-
-static void utc_network_bluetooth_hdp_register_sink_app_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hdp_register_sink_app(1, &appid);
- dts_check_eq("bt_hdp_register_sink_app",
- ret, BT_ERROR_NONE,
- "bt_hdp_register_sink_app() failed.");
-
-}
-
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_hid_host_initialize_n(void);
-static void utc_network_bluetooth_hid_host_connect_n(void);
-static void utc_network_bluetooth_hid_host_disconnect_n(void);
-
-void adapter_state_changed_cb_for_hid_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_hid_host_initialize_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_hid_host_connect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_hid_host_disconnect_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_hid_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_hid_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-void host_connection_state_changed_cb_for_hid_p(int result,
- bool connected, const char *remote_address, void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_hid_host_initialize_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hid_host_initialize(NULL, NULL);
- dts_check_eq("bt_hid_host_initialize", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL.");
-}
-
-
-static void utc_network_bluetooth_hid_host_connect_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hid_host_initialize(host_connection_state_changed_cb_for_hid_p, NULL);
-
- ret = bt_hid_host_connect(NULL);
- dts_check_eq("bt_hid_host_connect", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when remote address parameter is NULL.");
-}
-
-
-static void utc_network_bluetooth_hid_host_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hid_host_disconnect(NULL);
- dts_check_eq("bt_hid_host_disconnect", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when remote address parameter is NULL.");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_hid_host_initialize_p(void);
-static void utc_network_bluetooth_hid_host_deinitialize_p(void);
-static void utc_network_bluetooth_hid_host_connect_p(void);
-static void utc_network_bluetooth_hid_host_disconnect_p(void);
-
-void adapter_state_changed_cb_for_hid_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-void host_connection_state_changed_cb_for_hid_p(int result,
- bool connected, const char *remote_address, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_hid_host_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hid_host_connect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hid_host_disconnect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_hid_host_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_hid_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_hid_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-
-void host_connection_state_changed_cb_for_hid_p(int result,
- bool connected, const char *remote_address, void *user_data)
-{
-
-}
-
-
-static void utc_network_bluetooth_hid_host_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hid_host_initialize(host_connection_state_changed_cb_for_hid_p, NULL);
- dts_check_eq("bt_hid_host_initialize", ret, BT_ERROR_NONE,
- "bt_hid_host_initialize() failed.");
-}
-
-
-static void utc_network_bluetooth_hid_host_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_hid_host_deinitialize();
- dts_check_eq("bt_hid_host_deinitialize", ret, BT_ERROR_NONE,
- "bt_hid_host_deinitialize() failed.");
-}
-
-
-static void utc_network_bluetooth_hid_host_connect_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *remote_addr = "dts_addr";
-
- ret = bt_hid_host_connect(remote_addr);
- dts_check_eq("bt_hid_host_connect", ret, BT_ERROR_NONE,
- "bt_hid_host_connect() failed.");
-}
-
-
-static void utc_network_bluetooth_hid_host_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *remote_addr = "dts_addr";
-
- ret = bt_hid_host_disconnect(remote_addr);
- dts_check_eq("bt_hid_host_disconnect", ret, BT_ERROR_NONE,
- "bt_hid_host_disconnect() failed.");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_opp_client_add_file_n(void);
-static void utc_network_bluetooth_opp_client_push_files_n(void);
-
-void adapter_state_changed_cb_for_opp_client_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_opp_client_add_file_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_push_files_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- bt_opp_client_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_opp_client_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_opp_client_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- bt_adapter_start_device_discovery();
- } else {
- tet_printf("Callback: BT was not enabled. DTS will be started but DTS may fail.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-
-static void utc_network_bluetooth_opp_client_add_file_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_add_file(NULL);
- dts_check_eq("bt_opp_client_add_file", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when file parameter is NULL");
-}
-
-
-static void utc_network_bluetooth_opp_client_push_files_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_push_files(NULL, NULL, NULL, NULL, NULL);
- dts_check_eq("bt_opp_client_push_files", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameters are NULL");
-}
-
-
+++ /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 <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void(*tet_startup)(void) = startup;
-void(*tet_cleanup)(void) = cleanup;
-
-char *remote_address;
-
-static void utc_network_bluetooth_opp_client_initialize_p(void);
-static void utc_network_bluetooth_opp_client_deinitialize_p(void);
-static void utc_network_bluetooth_opp_client_add_file_p(void);
-static void utc_network_bluetooth_opp_client_clear_files_p(void);
-static void utc_network_bluetooth_opp_client_push_files_p(void);
-static void utc_network_bluetooth_opp_client_cancel_push_p(void);
-
-void push_responded_cb_for_opp_client_p(int result,
- const char *remote_address, void *user_data);
-void push_progress_cb_for_opp_client_p(const char *file,
- long long size, int percent, void *user_data);
-void push_finished_cb_for_opp_client_p(int result,
- const char *remote_address, void *user_data);
-void adapter_state_changed_cb_for_opp_client_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_opp_client_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_add_file_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_push_files_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_cancel_push_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_clear_files_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_client_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_MOBILE") == 0) {
- token = strtok(NULL, "=");
- remote_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_opp_client_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-void adapter_state_changed_cb_for_opp_client_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- if ((user_data != NULL) &&
- !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- bt_adapter_start_device_discovery();
- } else {
- tet_printf("Callback: BT was not enabled. DTS will be started but DTS may fail.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-void push_responded_cb_for_opp_client_p(int result,
- const char *remote_address, void *user_data)
-{
-
-}
-
-void push_progress_cb_for_opp_client_p(const char *file,
- long long size, int percent, void *user_data)
-{
-
-}
-
-void push_finished_cb_for_opp_client_p(int result,
- const char *remote_address, void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_opp_client_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_initialize();
- dts_check_eq("bt_opp_client_initialize", ret,
- BT_ERROR_NONE, "bt_opp_client_initialize() failed.");
-}
-
-static void utc_network_bluetooth_opp_client_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_deinitialize();
- dts_check_eq("bt_opp_client_deinitialize", ret,
- BT_ERROR_NONE, "bt_opp_client_deinitialize() failed.");
-
-}
-
-static void utc_network_bluetooth_opp_client_add_file_p(void)
-{
- int ret = BT_ERROR_NONE;
- int fd = 0;
- const char *file = "/tmp/a.txt";
-
- if (access("/tmp/a.txt", F_OK) < 0) {
- fd = open("/tmp/a.txt", O_RDWR|O_CREAT, 0666);
- write(fd, "hey", 3);
- }
-
- ret = bt_opp_client_add_file(file);
- dts_check_eq("bt_opp_client_add_file", ret,
- BT_ERROR_NONE, "bt_opp_client_add_file() failed");
-}
-
-
-static void utc_network_bluetooth_opp_client_clear_files_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_clear_files();
- dts_check_eq("bt_opp_client_clear_files", ret,
- BT_ERROR_NONE, "bt_opp_client_clear_files() failed.");
-
-}
-
-
-static void utc_network_bluetooth_opp_client_push_files_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_push_files(remote_address,
- push_responded_cb_for_opp_client_p,
- push_progress_cb_for_opp_client_p,
- push_finished_cb_for_opp_client_p, NULL);
-
- dts_check_eq("bt_opp_client_push_files", ret,
- BT_ERROR_NONE, "bt_opp_client_push_files() failed");
-}
-
-static void utc_network_bluetooth_opp_client_cancel_push_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_client_cancel_push();
- dts_check_eq("bt_opp_client_cancel_push", ret,
- BT_ERROR_NONE, "bt_opp_client_cancel_push() failed.");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-const char *dest = "/tmp";
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_opp_server_initialize_n(void);
-static void utc_network_bluetooth_opp_server_initialize_by_connection_request_n(void);
-static void utc_network_bluetooth_opp_server_accept_n(void);
-static void utc_network_bluetooth_opp_server_set_destination_n(void);
-
-void adapter_state_changed_cb_for_opp_server_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-void transfer_progress_cb_for_opp_server(const char *file, long long size,
- int percent, void *user_data);
-void transfer_finished_cb_for_opp_server(int result, const char *file,
- long long size, void *user_data);
-void push_requested_cb_for_opp_server(const char *file,
- int size, void *user_data);
-
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_opp_server_initialize_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_initialize_by_connection_request_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_set_destination_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_accept_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_opp_server_n,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *)data);
- return FALSE;
-}
-
-void push_requested_cb_for_opp_server(const char *file,
- int size, void *user_data)
-{
-
-}
-
-void transfer_progress_cb_for_opp_server(const char *file,
- long long size, int percent, void *user_data)
-{
-
-}
-
-void transfer_finished_cb_for_opp_server(int result,
- const char *file, long long size, void *user_data)
-{
-
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_opp_server_n(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if ((user_data != NULL) &&
- !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-static void utc_network_bluetooth_opp_server_initialize_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_initialize(NULL, NULL, NULL);
- dts_check_eq("bt_opp_server_initialize",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when destination parameter is NULL");
-}
-
-
-static void utc_network_bluetooth_opp_server_accept_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_opp_server_accept(
- transfer_progress_cb_for_opp_server,
- transfer_finished_cb_for_opp_server,
- NULL, NULL, NULL);
- dts_check_eq("bt_opp_server_accept",
- ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_NOT_INITIALIZED must be returned.");
-
-}
-
-static void utc_network_bluetooth_opp_server_set_destination_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_initialize(dest,
- push_requested_cb_for_opp_server_p,
- NULL);
-
- ret = bt_opp_server_set_destination(NULL);
- dts_check_eq("bt_opp_server_set_destination", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned destination parameter is NULL");
-}
-
-static void utc_network_bluetooth_opp_server_initialize_by_connection_request_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_initialize_by_connection_request(NULL, NULL, NULL);
- dts_check_eq("bt_opp_server_initialize_by_connection_request", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned destination parameter is NULL");
-
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-const char *dest = "/tmp";
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_opp_server_initialize_p(void);
-static void utc_network_bluetooth_opp_server_initialize_by_connection_request_p(void);
-static void utc_network_bluetooth_opp_server_deinitialize_p(void);
-static void utc_network_bluetooth_opp_server_accept_p(void);
-static void utc_network_bluetooth_opp_server_reject_p(void);
-static void utc_network_bluetooth_opp_server_set_destination_p(void);
-
-void push_requested_cb_for_opp_server_p(const char *file, int size, void *user_data);
-void connection_requested_cb_for_opp_server_p(const char *remote_address,
- void *user_data);
-void adapter_state_changed_cb_for_opp_server_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-void transfer_finished_cb_for_opp_server_p(int result, const char *file,
- long long size, void *user_data);
-void transfer_progress_cb_for_opp_server_p(int result, const char *file,
- long long size, void *user_data);
-
-
-gboolean timeout_func(gpointer data);
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_opp_server_initialize_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_initialize_by_connection_request_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_set_destination_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_accept_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_reject_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_opp_server_deinitialize_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_opp_server_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *)data);
- return FALSE;
-}
-
-
-void adapter_state_changed_cb_for_opp_server_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
-
-}
-
-
-void push_requested_cb_for_opp_server_p(const char *file, int size,
- void *user_data)
-{
-
-}
-
-void connection_requested_cb_for_opp_server_p(const char *remote_address,
- void *user_data)
-{
-
-}
-
-void transfer_progress_cb_for_opp_server_p(int result, const char *file,
- long long size, void *user_data)
-{
-
-}
-
-void transfer_finished_cb_for_opp_server_p(int result, const char *file,
- long long size, void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_opp_server_initialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_initialize(dest, push_requested_cb_for_opp_server_p,
- NULL);
-
- if (ret != BT_ERROR_RESOURCE_BUSY) {
- dts_check_eq("bt_opp_server_initialize", ret, BT_ERROR_NONE,
- "bt_opp_server_initialize() failed");
- } else {
- dts_check_eq("bt_opp_server_initialize", ret, BT_ERROR_RESOURCE_BUSY,
- "bt_opp_server_initialize() failed");
- }
-
-
-}
-
-static void utc_network_bluetooth_opp_server_deinitialize_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_deinitialize();
- dts_check_eq("bt_opp_server_deinitialize", ret, BT_ERROR_NONE,
- "bt_opp_server_deinitialize() failed.");
-}
-
-static void utc_network_bluetooth_opp_server_accept_p(void)
-{
- int ret = BT_ERROR_NONE;
- int tid = 0;
- const char *name = "abc";
- ret = bt_opp_server_accept(transfer_progress_cb_for_opp_server_p,
- transfer_finished_cb_for_opp_server_p, name, NULL, &tid);
- dts_check_eq("bt_opp_server_accept", ret,
- BT_ERROR_NONE, "bt_opp_server_accept() failed.");
-
-}
-
-static void utc_network_bluetooth_opp_server_reject_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_reject();
- dts_check_eq("bt_opp_server_reject", ret,
- BT_ERROR_NONE, "bt_opp_server_reject() failed.");
-}
-
-static void utc_network_bluetooth_opp_server_set_destination_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_set_destination(dest);
- dts_check_eq("bt_opp_server_set_destination", ret,
- BT_ERROR_NONE, "bt_opp_server_destination() failed");
-}
-
-static void utc_network_bluetooth_opp_server_initialize_by_connection_request_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_opp_server_initialize_by_connection_request(dest,
- connection_requested_cb_for_opp_server_p, NULL);
- dts_check_eq("bt_opp_server_initialize_by_connection_request", ret,
- BT_ERROR_NONE,
- "bt_opp_server_initialize_by_connection_request() failed");
-
-}
-
-
-
-
-
-
+++ /dev/null
-/*
- * utc_network_bluetooth_pan_negative.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include "bluetooth.h"
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_nap_set_connection_state_changed_n(void);
-static void utc_network_bluetooth_panu_set_connection_state_changed_n(void);
-static void utc_network_bluetooth_panu_connect_n(void);
-static void utc_network_bluetooth_nap_disconnect_n(void);
-static void utc_network_bluetooth_panu_disconnect_n(void);
-
-void adapter_state_changed_cb_for_pan_n(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_nap_set_connection_state_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_panu_set_connection_state_changed_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_panu_connect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_nap_disconnect_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_panu_disconnect_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_pan_n, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *)data);
- return FALSE;
-}
-
-
-
-
-/**
- * @brief Negative test case of bt_nap_set_connection_state_changed_cb()
- */
-
-void adapter_state_changed_cb_for_pan_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-static void utc_network_bluetooth_nap_set_connection_state_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_nap_set_connection_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_nap_set_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_nap_set_connection_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_panu_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_panu_set_connection_state_changed_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_panu_set_connection_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_panu_set_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "bt_panu_set_connection_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_panu_connect()
- */
-static void utc_network_bluetooth_panu_connect_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_panu_connect(NULL, BT_PANU_SERVICE_TYPE_NAP);
- dts_check_eq("bt_panu_connect", ret, BT_ERROR_INVALID_PARAMETER,
- "bt_panu_connect() failed.");
-
-}
-
-/**
- * @brief Negative test case of bt_nap_disconnect()
- */
-static void utc_network_bluetooth_nap_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_disconnect(NULL);
- dts_check_eq("bt_nap_disconnect", ret, BT_ERROR_INVALID_PARAMETER,
- "bt_nap_disconnect() failed.");
-
-}
-/**
- * @brief Negative test case of bt_panu_disconnect()
- */
-static void utc_network_bluetooth_panu_disconnect_n(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_panu_disconnect(NULL);
- dts_check_eq("bt_panu_disconnect", ret, BT_ERROR_INVALID_PARAMETER,
- "bt_panu_disconnect() failed.");
-
-}
+++ /dev/null
-/*
- * utc_network_bluetooth_pan_positive.c
- *
- * Created on: 20-Sep-2013
- * Author: mrinal.m
- */
-
-#include <bluetooth.h>
-#include <tet_api.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_nap_activate_p(void);
-static void utc_network_bluetooth_nap_deactivate_p(void);
-static void utc_network_bluetooth_nap_disconnect_all_p(void);
-static void utc_network_bluetooth_nap_set_connection_state_changed_p(void);
-static void utc_network_bluetooth_nap_unset_connection_state_changed_p(void);
-static void utc_network_bluetooth_panu_set_connection_state_changed_p(void);
-static void utc_network_bluetooth_panu_unset_connection_state_changed_p(void);
-static void utc_network_bluetooth_panu_connect_p(void);
-static void utc_network_bluetooth_nap_disconnect_p(void);
-static void utc_network_bluetooth_panu_disconnect_p(void);
-
-void connection_state_changed_cb_for_nap_p(bool connected,
- const char *remote_address,
- const char *interface_name,
- void *user_data);
-void connection_state_changed_cb_for_panu_p(int result,
- bool connected,
- const char *remote_address,
- bt_panu_service_type_e type,
- void *user_data);
-
-void adapter_state_changed_cb_for_pan_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_nap_activate_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_nap_set_connection_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_nap_unset_connection_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_nap_deactivate_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_nap_disconnect_all_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_panu_connect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_panu_set_connection_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_panu_unset_connection_state_changed_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_nap_disconnect_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_panu_disconnect_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_pan_p, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_enable() was called.");
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret != BT_ERROR_ALREADY_DONE) {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
-*/
-
-void adapter_state_changed_cb_for_pan_p(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
-
-}
-
-void connection_state_changed_cb_for_nap_p(bool connected,
- const char *remote_address,
- const char *interface_name,
- void *user_data)
-{
-
-}
-
-void connection_state_changed_cb_for_panu_p(int result,
- bool connected,
- const char *remote_address,
- bt_panu_service_type_e type,
- void *user_data)
-{
-
-}
-
-/**
- * @brief Positive test case of bt_nap_activate()
-*/
-static void utc_network_bluetooth_nap_activate_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_activate();
- if (ret != BT_ERROR_ALREADY_DONE) {
- dts_check_eq("bt_nap_activate", ret, BT_ERROR_NONE, "bt_nap_activate() failed.");
- } else {
- dts_check_eq("bt_nap_activate", ret, BT_ERROR_ALREADY_DONE,
- "bt_nap_activate() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_nap_deactivate()
-*/
-static void utc_network_bluetooth_nap_deactivate_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_deactivate();
- dts_check_eq("bt_nap_deactivate", ret, BT_ERROR_NONE,
- "bt_nap_deactivate() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_nap_disconnect_all()
- */
-static void utc_network_bluetooth_nap_disconnect_all_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_disconnect_all();
- dts_check_eq("bt_nap_disconnect_all", ret, BT_ERROR_NONE,
- "bt_nap_disconnect_all() failed.");
-}
-
-/**
- * @brief Positive test case of bt_nap_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_nap_set_connection_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_set_connection_state_changed_cb(connection_state_changed_cb_for_nap_p, NULL);
- dts_check_eq("bt_nap_set_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_nap_set_connection_state_changed_cb() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_nap_unset_connection_state_changed_cb()
-*/
-static void utc_network_bluetooth_nap_unset_connection_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_nap_unset_connection_state_changed_cb();
- dts_check_eq("bt_nap_unset_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_nap_unset_connection_state_changed_cb() failed.");
-}
-
-
-/**
- * @brief Positive test case of bt_panu_set_connection_state_changed_cb()
-*/
-static void utc_network_bluetooth_panu_set_connection_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_panu_set_connection_state_changed_cb(connection_state_changed_cb_for_panu_p, NULL);
- dts_check_eq("bt_panu_set_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_panu_set_connection_state_changed_cb() failed.");
-
-}
-
-
-/**
- * @brief Positive test case of bt_panu_unset_connection_state_changed_cb()
-*/
-static void utc_network_bluetooth_panu_unset_connection_state_changed_p(void)
-{
- int ret = BT_ERROR_NONE;
- ret = bt_panu_unset_connection_state_changed_cb();
- dts_check_eq("bt_panu_unset_connection_state_changed_cb", ret, BT_ERROR_NONE,
- "bt_panu_unset_connection_state_changed_cb() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_panu_connect()
-*/
-static void utc_network_bluetooth_panu_connect_p(void)
-{
- int ret = BT_ERROR_NONE;
- const char *remote_address = "00:00:00:00:00:00";
- ret = bt_panu_connect(remote_address, BT_PANU_SERVICE_TYPE_NAP);
- dts_check_eq("bt_panu_connect", ret, BT_ERROR_NONE,
- "bt_panu_connect() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_nap_disconnect()
-*/
-static void utc_network_bluetooth_nap_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- const char *remote_address = "00:00:00:00:00:00";
- ret = bt_nap_disconnect(remote_address);
- dts_check_eq("bt_nap_disconnect", ret, BT_ERROR_NONE,
- "bt_nap_disconnect() failed.");
-
-}
-
-/**
- * @brief Positive test case of bt_panu_disconnect()
-*/
-static void utc_network_bluetooth_panu_disconnect_p(void)
-{
- int ret = BT_ERROR_NONE;
- const char *remote_address = "00:00:00:00:00:00";
- ret = bt_panu_disconnect(remote_address);
- dts_check_eq("bt_panu_disconnect", ret, BT_ERROR_NONE,
- "bt_panu_disconnect() failed.");
-
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_service_search_set_cb_n(void);
-static void utc_network_bluetooth_service_search_unset_cb_n(void);
-static void utc_network_bluetooth_service_search_n(void);
-static void utc_network_bluetooth_service_search_cancel_n(void);
-
-void adapter_state_changed_cb_for_service_search_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_service_search_set_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_service_search_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_service_search_cancel_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_service_search_unset_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_service_search_n,
- "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_service_search_n(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-/**
- * @brief Negative test case of bt_device_set_service_searched_cb()
- */
-static void utc_network_bluetooth_service_search_set_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_set_service_searched_cb(NULL, NULL);
- dts_check_eq("bt_device_set_service_searched_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_unset_service_searched_cb()
- */
-static void utc_network_bluetooth_service_search_unset_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- if (bt_deinitialize() != BT_ERROR_NONE) {
- dts_fail("bt_device_unset_service_searched_cb",
- "bt_deinitialize() failed.");
- }
-
- ret = bt_device_unset_service_searched_cb();
- dts_check_eq("bt_device_unset_service_searched_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_device_start_service_search()
- */
-static void utc_network_bluetooth_service_search_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_start_service_search(NULL);
- dts_check_eq("bt_device_start_service_search", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_device_cancel_service_search()
- */
-static void utc_network_bluetooth_service_search_cancel_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_cancel_service_search();
- dts_check_eq("bt_device_cancel_service_search",
- ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-char target_name[128] = "dts_test";
-char *target_address;
-bool callback_result = false;
-bool discovery_result = false;
-bool bonding_result = false;
-static GMainLoop *mainloop;
-
-static void utc_network_bluetooth_service_search_set_cb_p(void);
-static void utc_network_bluetooth_service_search_p(void);
-static void utc_network_bluetooth_service_search_cancel_p(void);
-static void utc_network_bluetooth_service_search_unset_cb_p(void);
-
-gboolean timeout_func(gpointer data);
-void adapter_state_changed_cb_for_service_search_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-void device_discovery_state_changed_cb_for_service_search_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info, void *user_data);
-void service_searched_cb_for_service_search_p(int result,
- bt_device_sdp_info_s *sdp_info, void *user_data);
-void device_bonded_cb_for_service_search_p(int result,
- bt_device_info_s *device_info, void *user_data);
-void device_unbonded_cb(int result, char *remote_address, void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_service_search_set_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_service_search_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_service_search_cancel_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_service_search_unset_cb_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_MOBILE") == 0) {
- token = strtok(NULL, "=");
- target_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- callback_result = false;
- discovery_result = false;
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_service_search_p, "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- if (bt_adapter_set_device_discovery_state_changed_cb
- (device_discovery_state_changed_cb_for_service_search_p, "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_device_discovery_state_changed_cb() failed.");
- }
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
-
- tet_printf("BT was enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- tet_printf("BT was already enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else {
- tet_printf("DTS may fail because bt_adapter_enable() failed.");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_state_changed_cb() failed.");
- }
-
- if (bt_adapter_unset_device_discovery_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_device_discovery_state_changed_cb() failed.");
- }
-
- tet_printf("TC start.");
-}
-
-
-static void cleanup(void)
-{
- /* end of TC */
- int timeout_id = 0;
-
- /* Destroy a bond */
- bt_device_set_bond_destroyed_cb(device_unbonded_cb, NULL);
- if (bt_device_destroy_bond(target_address) == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- }
-
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("[%s] Callback: Timeout.", __FUNCTION__);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-
-/**
- * @brief Callback funtions
- */
-void device_unbonded_cb(int result, char *remote_address, void *user_data)
-{
- tet_printf("Callback: bt_device_bond_destroyed_cb() was called.");
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-
-}
-
-void adapter_state_changed_cb_for_service_search_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb() was called");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- } else {
- tet_printf("Callback: BT was not enabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-void device_discovery_state_changed_cb_for_service_search_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info, void *user_data)
-{
- tet_printf("Callback: bt_adapter_device_discovery_state_changed_cb() was called");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
- tet_printf("Callback: Device discovery finished. DTS will be started.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- } else if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FOUND) {
- tet_printf("Callback: Devices were founded (%s)",
- discovery_info->remote_name);
- if (discovery_info->remote_name != NULL && !strcmp(discovery_info->remote_name, target_name)) {
- discovery_result = true;
- tet_printf("Callback: dts_test device was found.");
- strncpy(target_address, discovery_info->remote_address, 18);
- tet_printf("Callback: device address: %s", discovery_info->remote_address);
- if (bt_adapter_stop_device_discovery() == BT_ERROR_NONE) {
- tet_printf("Callback: Device discovery will be stopped");
- }
- }
- }
- }
-}
-
-void service_searched_cb_for_service_search_p(int result,
- bt_device_sdp_info_s *sdp_info,
- void *user_data)
-{
- int i = 0;
-
- tet_printf("Callback: bt_device_service_searched_cb() was called.");
- if (result == BT_ERROR_NONE) {
- if (sdp_info != NULL && !strcmp(sdp_info->remote_address, target_address)) {
- tet_printf("Callback: Service search succeeded.");
- tet_printf("Callback: Service count : %d", sdp_info->service_count);
- for (i = 0; i < sdp_info->service_count; i++) {
- tet_printf("Callback: uuid[%d] - %s", i + 1, sdp_info->service_uuid[i]);
- }
-
- callback_result = true;
- }
- } else if (result == BT_ERROR_CANCELLED) {
- if (sdp_info != NULL && !strcmp(sdp_info->remote_address, target_address)) {
- tet_printf("Callback: Calcellation of service search succeeded.");
- callback_result = true;
- }
- } else {
- tet_printf("Callback: Failed.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-}
-
-void device_bonded_cb_for_service_search_p(int result,
- bt_device_info_s *device_info, void *user_data)
-{
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (device_info->remote_address != NULL && !strcmp(device_info->remote_address, target_address)) {
- if (result == BT_ERROR_NONE) {
- tet_printf("Callback: Bonding succeeded");
- bonding_result = true;
- } else {
- tet_printf("Callback: Bonding failed");
- }
- }
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-}
-
-/**
- * @brief Positive test case of bt_device_set_service_searched_cb()
- */
-static void utc_network_bluetooth_service_search_set_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- ret = bt_device_set_service_searched_cb(service_searched_cb_for_service_search_p, NULL);
- if (ret == BT_ERROR_NONE) {
- if (bt_device_set_bond_created_cb(device_bonded_cb_for_service_search_p, "startup") != BT_ERROR_NONE) {
- tet_printf("bt_device_set_bond_created_cb() failed.");
- }
-
- if (discovery_result == true && bt_device_create_bond(target_address) == BT_ERROR_NONE) {
- tet_printf("bt_device_create_bond() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_device_create_bond() failed.");
- }
- }
-
- dts_check_eq("bt_device_set_service_searched_cb", ret, BT_ERROR_NONE,
- "bt_device_set_service_searched_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_device_start_service_search()
- */
-static void utc_network_bluetooth_service_search_p(void)
-{
- int timeout_id = 0;
- int ret = BT_ERROR_NONE;
-
- if (discovery_result != true) {
- tet_printf("bt_device_start_service_search failed.");
- }
-
- callback_result = false;
- ret = bt_device_start_service_search(target_address);
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_device_start_service_search() succeeded.");
- tet_printf("service_searched_cb_for_service_search_p() will be called.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_device_start_service_search", ret, BT_ERROR_NONE,
- "bt_device_start_service_search() failed.");
- } else {
- dts_fail("bt_device_start_service_search",
- "bt_device_start_service_search() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_cancel_service_search()
- */
-static void utc_network_bluetooth_service_search_cancel_p(void)
-{
- int timeout_id = 0;
- int ret = BT_ERROR_NONE;
-
- if (discovery_result != true) {
- tet_printf("t_device_cancel_service_search failed.");
- }
-
- callback_result = false;
- if (bt_device_start_service_search(target_address) != BT_ERROR_NONE) {
- tet_printf("t_device_start_service_search failed.");
-
- } else {
- tet_printf("bt_device_cancel_service_search",
- "bt_device_start_service_search() succeeded.");
- }
-
- ret = bt_device_cancel_service_search();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_device_cancel_service_search() succeeded.");
- tet_printf("service_searched_cb_for_service_search_p() will be called.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- dts_check_eq("bt_device_cancel_service_search", ret, BT_ERROR_NONE,
- "bt_device_cancel_service_search() failed.");
-
- } else {
- dts_fail("bt_device_cancel_service_search",
- "bt_device_cancel_service_search() failed.");
- }
-}
-
-/**
- * @brief Positive test case of bt_device_unset_service_searched_cb()
- */
-static void utc_network_bluetooth_service_search_unset_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_device_unset_service_searched_cb();
- dts_check_eq("bt_device_unset_service_searched_cb", ret, BT_ERROR_NONE,
- "bt_device_set_service_searched_cb() failed.");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-static GMainLoop *mainloop;
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-static void utc_network_bluetooth_socket_set_data_received_cb_n(void);
-static void utc_network_bluetooth_socket_set_connection_state_changed_cb_n(void);
-static void utc_network_bluetooth_socket_unset_data_received_cb_n(void);
-static void utc_network_bluetooth_socket_unset_connection_state_changed_cb_n(void);
-static void utc_network_bluetooth_socket_create_rfcomm_n(void);
-static void utc_network_bluetooth_socket_destroy_rfcomm_n(void);
-static void utc_network_bluetooth_socket_listen_and_accept_rfcomm_n(void);
-static void utc_network_bluetooth_socket_connect_rfcomm_n(void);
-static void utc_network_bluetooth_socket_disconnect_rfcomm_n(void);
-static void utc_network_bluetooth_socket_send_data_n(void);
-
-void adapter_state_changed_cb_for_device_negative(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-gboolean timeout_func(gpointer data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_socket_create_rfcomm_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_set_connection_state_changed_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_listen_and_accept_rfcomm_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_set_data_received_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_connect_rfcomm_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_send_data_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_disconnect_rfcomm_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_destroy_rfcomm_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_unset_data_received_cb_n, NEGATIVE_TC_IDX},
- {utc_network_bluetooth_socket_unset_connection_state_changed_cb_n, NEGATIVE_TC_IDX},
- {NULL, 0},
-};
-
-static void startup(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- /* start of TC */
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
- if (bt_adapter_set_state_changed_cb(adapter_state_changed_cb_for_device_negative, "startup") != BT_ERROR_NONE) {
- tet_printf("DTS may fail because bt_adapter_set_state_changed_cb() failed");
- }
-
- tet_printf("bt_adapter_disable() was called.");
- ret = bt_adapter_disable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_disable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else if (ret == BT_ERROR_NOT_ENABLED) {
- tet_printf("Bluetooth adapter is not enabled.");
- } else {
- tet_printf("DTS may fail because bt_adapter_disable() failed");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- tet_printf("TC start");
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("Callback: Timeout.");
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void adapter_state_changed_cb_for_device_negative(int result,
- bt_adapter_state_e adapter_state,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_state_changed_cb was called.");
- if (user_data != NULL && !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_DISABLED && result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was disabled. DTS will be started.");
- } else {
- tet_printf("Callback: BT was not disabled. DTS will be started but DTS may fail.");
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
-}
-
-
-
-/**
- * @brief Negative test case of bt_socket_set_data_received_cb()
- */
-static void utc_network_bluetooth_socket_set_data_received_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_set_data_received_cb(NULL, NULL);
- dts_check_eq("bt_socket_set_data_received_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_socket_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_socket_set_connection_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_set_connection_state_changed_cb(NULL, NULL);
- dts_check_eq("bt_socket_set_connection_state_changed_cb", ret,
- BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when callback parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_socket_unset_data_received_cb()
- */
-static void utc_network_bluetooth_socket_unset_data_received_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- if (bt_deinitialize() != BT_ERROR_NONE) {
- dts_fail("bt_socket_unset_data_received_cb",
- "bt_deinitialize() failed.");
- }
-
- ret = bt_socket_unset_data_received_cb();
- dts_check_eq("bt_socket_unset_data_received_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_socket_unset_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_socket_unset_connection_state_changed_cb_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_unset_connection_state_changed_cb();
- dts_check_eq("bt_socket_unset_connection_state_changed_cb", ret,
- BT_ERROR_NOT_INITIALIZED,
- "BT_ERROR_NOT_INITIALIZED must be returned when BT service is not initialized.");
-}
-
-/**
- * @brief Negative test case of bt_socket_create_rfcomm()
- */
-static void utc_network_bluetooth_socket_create_rfcomm_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_create_rfcomm(NULL, NULL);
- dts_check_eq("bt_socket_create_rfcomm", ret, BT_ERROR_INVALID_PARAMETER,
- "BT_ERROR_INVALID_PARAMETER must be returned when port_uuid parameter is NULL");
-}
-
-/**
- * @brief Negative test case of bt_socket_destroy_rfcomm()
- */
-static void utc_network_bluetooth_socket_destroy_rfcomm_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_destroy_rfcomm(NULL);
- dts_check_eq("bt_socket_listen_and_accept_rfcomm", ret,
- BT_ERROR_NOT_ENABLED,
- "BT_ERROR_INVALID_PARAMETER must be returned when socket_fd is below 0");
-}
-
-
-/**
- * @brief Negative test case of bt_socket_listen_and_accept_rfcomm()
- */
-static void utc_network_bluetooth_socket_listen_and_accept_rfcomm_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_listen_and_accept_rfcomm(1, 1);
- dts_check_eq("bt_socket_listen_and_accept_rfcomm", ret,
- BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- * @brief Negative test case of bt_socket_connect_rfcomm()
- */
-static void utc_network_bluetooth_socket_connect_rfcomm_n(void)
-{
- int ret = BT_ERROR_NONE;
- char *address = "00:02:79:AC:7D:FD";
- char *uuid = "";
-
- ret = bt_socket_connect_rfcomm(address, uuid);
- dts_check_eq("bt_socket_connect_rfcomm", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- * @brief Negative test case of bt_socket_disconnect_rfcomm()
- */
-static void utc_network_bluetooth_socket_disconnect_rfcomm_n(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_disconnect_rfcomm(-1);
- dts_check_eq("bt_socket_disconnect_rfcomm", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
-
-/**
- * @brief Negative test case of bt_socket_send_data()
- */
-static void utc_network_bluetooth_socket_send_data_n(void)
-{
- int ret = BT_ERROR_NONE;
- char *data = "dts_test";
-
- ret = bt_socket_send_data(1, data, sizeof(data));
- dts_check_eq("bt_socket_send_data", ret, BT_ERROR_NOT_ENABLED,
- "BT_ERROR_NOT_ENABLED must be returned when BT is not enabled");
-}
+++ /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 <tet_api.h>
-#include <bluetooth.h>
-#include <stdlib.h>
-#include <stdbool.h>
-#include <glib.h>
-
-#define CONFIG_FILE_PATH "/opt/home/capi-network-bluetooth/tetware.conf"
-
-enum {
- POSITIVE_TC_IDX = 0x01,
- NEGATIVE_TC_IDX,
-};
-
-static void startup(void);
-static void cleanup(void);
-
-void (*tet_startup) (void) = startup;
-void (*tet_cleanup) (void) = cleanup;
-
-const char target_name[128] = "dts_test";
-const char *rfcomm_test_uuid_spp = "00001101-0000-1000-8000-00805F9B34FB";
-char *target_address;
-int socket_fd = 0;
-bool callback_result = false;
-bool discovery_result = false;
-bool bonding_result = false;
-bool is_connecting = false;
-static GMainLoop *mainloop;
-
-static void utc_network_bluetooth_socket_set_data_received_cb_p(void);
-static void utc_network_bluetooth_socket_set_connection_state_changed_cb_p(void);
-
-static void utc_network_bluetooth_socket_create_rfcomm_p(void);
-static void utc_network_bluetooth_socket_destroy_rfcomm_p(void);
-static void utc_network_bluetooth_socket_listen_and_accept_rfcomm_p(void);
-static void utc_network_bluetooth_socket_connect_rfcomm_p(void);
-static void utc_network_bluetooth_socket_disconnect_rfcomm_p(void);
-static void utc_network_bluetooth_socket_send_data_p(void);
-static void utc_network_bluetooth_socket_unset_data_received_cb_p(void);
-static void utc_network_bluetooth_socket_unset_connection_state_changed_cb_p(void);
-
-gboolean timeout_func(gpointer data);
-void adapter_state_changed_cb_for_socket_p(int result,
- bt_adapter_state_e adapter_state, void *user_data);
-void device_discovery_state_changed_cb_for_socket_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data);
-void device_bonded_cb_for_socket_p(int result, bt_device_info_s *device_info,
- void *user_data);
-void socket_data_received_cb_for_socket_p(bt_socket_received_data_s *data,
- void *user_data);
-void socket_connection_state_changed_cb_for_socket_p(int result,
- bt_socket_connection_state_e connection_state,
- bt_socket_connection_s *connection,
- void *user_data);
-void device_unbonded_cb(int result, char *remote_address, void *user_data);
-
-struct tet_testlist tet_testlist[] = {
- {utc_network_bluetooth_socket_create_rfcomm_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_set_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_listen_and_accept_rfcomm_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_set_data_received_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_connect_rfcomm_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_send_data_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_disconnect_rfcomm_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_destroy_rfcomm_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_unset_data_received_cb_p, POSITIVE_TC_IDX},
- {utc_network_bluetooth_socket_unset_connection_state_changed_cb_p, POSITIVE_TC_IDX},
- {NULL, 0},
-};
-
-int get_value_from_file(void)
-{
- FILE *fp;
- char *token;
- char buf[100];
-
- fp = fopen(CONFIG_FILE_PATH, "r");
- if (fp == NULL) {
- tet_printf("Default configuration is used\n");
- return -1;
- }
- while (fgets(buf, sizeof(buf), fp)) {
- if (buf[0] == '#' || buf[0] == '\n')
- continue;
-
- token = strrchr(buf, '\n');
- if (token == NULL) {
- tet_printf("g_conf is too long\n");
- break;
- }
- *token = '\0';
-
- token = strtok(buf, "=");
- if (token == NULL) {
- continue;
- }
- if (strcasecmp(token, "BT_ADDR_MOBILE") == 0) {
- token = strtok(NULL, "=");
- target_address = strdup(token);
- fclose(fp);
- return 0;
- }
- }
- fclose(fp);
- return -1;
-}
-
-static void startup(void)
-{
- bt_error_e ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- if (get_value_from_file() == -1) {
- tet_printf("Failed to read.");
- }
-
- /* start of TC */
- tet_printf("TC start.");
- callback_result = false;
- discovery_result = false;
- bonding_result = false;
- mainloop = g_main_loop_new(NULL, FALSE);
-
- bt_initialize();
-
- if (bt_adapter_set_state_changed_cb(
- adapter_state_changed_cb_for_socket_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_state_changed_cb() failed.");
- }
-
- if (bt_adapter_set_device_discovery_state_changed_cb(
- device_discovery_state_changed_cb_for_socket_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("bt_adapter_set_device_discovery_state_changed_cb() failed.");
- }
-
- if (bt_device_set_bond_created_cb(
- device_bonded_cb_for_socket_p,
- "startup") != BT_ERROR_NONE) {
- tet_printf("bt_device_set_bond_created_cb() failed.");
- }
-
- ret = bt_adapter_enable();
- if (ret == BT_ERROR_NONE) {
- tet_printf("bt_adapter_enable() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
-
- tet_printf("BT was enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else if (ret == BT_ERROR_ALREADY_DONE) {
- tet_printf("BT was already enabled. Device discovery will be started");
- if (bt_adapter_start_device_discovery() == BT_ERROR_NONE) {
- tet_printf("bt_adapter_start_device_discovery() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_adapter_start_device_discovery() failed.");
- }
- } else {
- tet_printf("DTS may fail because bt_adapter_enable() failed.");
- }
-
- if (discovery_result == true &&
- bt_device_create_bond(target_address) == BT_ERROR_NONE) {
- tet_printf("bt_device_create_bond() succeeded.");
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- tet_printf("bt_device_create_bond() failed.");
- }
-
- if (bt_adapter_unset_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_state_changed_cb() failed.");
- }
-
- if (bt_adapter_unset_device_discovery_state_changed_cb() != BT_ERROR_NONE) {
- tet_printf("bt_adapter_unset_device_discovery_state_changed_cb() failed.");
- }
-
- if (bt_device_unset_bond_created_cb() != BT_ERROR_NONE) {
- tet_printf("bt_device_unset_bond_created_cb() failed.");
- }
-
-}
-
-static void cleanup(void)
-{
- /* end of TC */
- int timeout_id = 0;
-
- /* Destroy a bond */
- bt_device_set_bond_destroyed_cb(
- device_unbonded_cb, NULL);
- if (bt_device_destroy_bond(target_address) == BT_ERROR_NONE) {
- timeout_id = g_timeout_add(60000, timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- }
-
- bt_deinitialize();
- tet_printf("TC end.");
-}
-
-gboolean timeout_func(gpointer data)
-{
- tet_printf("[%s] Callback: Timeout.", __FUNCTION__);
- g_main_loop_quit((GMainLoop *) data);
- return FALSE;
-}
-
-/**
- * @brief Callback funtions
- */
-void device_unbonded_cb(int result,
- char *remote_address, void *user_data)
-{
- tet_printf("Callback: bt_device_bond_destroyed_cb() was called.");
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-
-}
-
-void adapter_state_changed_cb_for_socket_p(int result,
- bt_adapter_state_e adapter_state, void *user_data)
-{
- if (user_data != NULL &&
- !strcmp((char *)user_data, "startup")) {
- if (adapter_state == BT_ADAPTER_ENABLED &&
- result == BT_ERROR_NONE) {
- tet_printf("Callback: BT was enabled.");
- bt_adapter_start_device_discovery();
- } else {
- tet_printf("Callback: BT was not enabled. DTS will be started but DTS may fail.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-void device_discovery_state_changed_cb_for_socket_p(int result,
- bt_adapter_device_discovery_state_e discovery_state,
- bt_adapter_device_discovery_info_s *discovery_info,
- void *user_data)
-{
- tet_printf("Callback: bt_adapter_device_discovery_state_changed_cb() was called");
- if (user_data != NULL &&
- !strcmp((char *)user_data, "startup")) {
- if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FINISHED) {
- tet_printf("Callback: Device discovery finished. DTS will be started.");
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- } else if (discovery_state == BT_ADAPTER_DEVICE_DISCOVERY_FOUND) {
- tet_printf("Callback: Devices were founded (%s)",
- discovery_info->remote_name);
- if (discovery_info->remote_name != NULL &&
- !strcmp(discovery_info->remote_name, target_name)) {
- discovery_result = true;
- tet_printf("Callback: dts_test device was found.");
- strncpy(target_address,
- discovery_info->remote_address, 18);
- tet_printf("Callback: device address: %s",
- discovery_info->remote_address);
- if (bt_adapter_stop_device_discovery() == BT_ERROR_NONE) {
- tet_printf("Callback: Device discovery will be stopped");
- }
- }
- }
- }
-}
-
-void device_bonded_cb_for_socket_p(int result,
- bt_device_info_s *device_info, void *user_data)
-{
- if ((user_data != NULL) &&
- !strcmp((char *)user_data, "startup")) {
- if ((device_info->remote_address != NULL) &&
- !strcmp(device_info->remote_address, target_address)) {
- if (result == BT_ERROR_NONE) {
- tet_printf("Callback: Bonding succeeded");
- bonding_result = true;
- } else {
- tet_printf("Callback: Bonding failed");
- }
- }
- }
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
-}
-
-void socket_data_received_cb_for_socket_p(
- bt_socket_received_data_s *data,
- void *user_data)
-{
-}
-
-void socket_connection_state_changed_cb_for_socket_p(int result,
- bt_socket_connection_state_e connection_state,
- bt_socket_connection_s *connection,
- void *user_data)
-{
- tet_printf("Callback: bt_socket_connection_state_changed_cb() was called");
- if (connection_state == BT_SOCKET_CONNECTED)
- tet_printf("Callback: Connected");
- else
- tet_printf("Callback: Disconnected");
-
- if (connection_state == BT_SOCKET_CONNECTED) {
- tet_printf("Callback: [BT_SOCKET_CONNECTED] result = %d",
- result);
- if (result == BT_ERROR_NONE && is_connecting == true) {
- callback_result = true;
- socket_fd = connection->socket_fd;
- tet_printf("Callback: socket_fd = %d", socket_fd);
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- } else if (connection_state == BT_SOCKET_DISCONNECTED) {
- tet_printf("Callback: [BT_SOCKET_DISCONNECTED] result = %d",
- result);
- if (result == BT_ERROR_NONE && is_connecting == false) {
- callback_result = true;
- socket_fd = connection->socket_fd;
- tet_printf("Callback: socket_fd = %d", socket_fd);
-
- if (mainloop) {
- g_main_loop_quit(mainloop);
- }
- }
- }
-}
-
-/**
- * @brief Positive test case of bt_socket_set_data_received_cb()
- */
-static void utc_network_bluetooth_socket_set_data_received_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_set_data_received_cb(
- socket_data_received_cb_for_socket_p,
- NULL);
- dts_check_eq("bt_socket_set_data_received_cb",
- ret, BT_ERROR_NONE,
- "bt_socket_set_data_received_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_set_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_socket_set_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_set_connection_state_changed_cb(
- socket_connection_state_changed_cb_for_socket_p,
- NULL);
- dts_check_eq("bt_socket_set_connection_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_socket_set_connection_state_changed_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_create_rfcomm()
- */
-static void utc_network_bluetooth_socket_create_rfcomm_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_create_rfcomm(
- rfcomm_test_uuid_spp, &socket_fd);
- dts_check_eq("bt_socket_create_rfcomm",
- ret, BT_ERROR_NONE,
- "bt_socket_create_rfcomm() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_listen_and_accept_rfcomm()
- */
-static void utc_network_bluetooth_socket_listen_and_accept_rfcomm_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_listen_and_accept_rfcomm(socket_fd, 1);
- dts_check_eq("bt_socket_listen_and_accept_rfcomm",
- ret, BT_ERROR_NONE,
- "bt_socket_listen_and_accept_rfcomm() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_destroy_rfcomm()
- */
-static void utc_network_bluetooth_socket_destroy_rfcomm_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_destroy_rfcomm(socket_fd);
- dts_check_eq("bt_socket_destroy_rfcomm",
- ret, BT_ERROR_NONE,
- "bt_socket_destroy_rfcomm() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_connect_rfcomm()
- */
-static void utc_network_bluetooth_socket_connect_rfcomm_p(void)
-{
- int ret = BT_ERROR_NONE;
- int timeout_id = 0;
-
- is_connecting = true;
- callback_result = false;
- ret = bt_socket_connect_rfcomm(target_address,
- rfcomm_test_uuid_spp);
- if (ret == BT_ERROR_NONE) {
- dts_check_eq("bt_socket_connect_rfcomm",
- ret, BT_ERROR_NONE,
- "bt_socket_connect_rfcomm() failed.");
- tet_printf("bt_socket_connect_rfcomm() succeeded.");
- timeout_id = g_timeout_add(60000,
- timeout_func, mainloop);
- g_main_loop_run(mainloop);
- g_source_remove(timeout_id);
- } else {
- dts_fail("bt_socket_connect_rfcomm",
- "bt_socket_connect_rfcomm() failed");
- }
-}
-
-/**
- * @brief Positive test case of bt_socket_disconnect_rfcomm()
- */
-static void utc_network_bluetooth_socket_disconnect_rfcomm_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_disconnect_rfcomm(socket_fd);
- dts_check_eq("bt_socket_disconnect_rfcomm",
- ret, BT_ERROR_NONE,
- "bt_socket_disconnect_rfcomm() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_send_data()
- */
-static void utc_network_bluetooth_socket_send_data_p(void)
-{
- int ret = BT_ERROR_NONE;
- char *dts_test = "dts_test";
- int socket_fd = 1;
- ret = bt_socket_send_data(socket_fd,
- "dts_test", sizeof(dts_test));
- dts_check_eq("bt_socket_send_data",
- ret, BT_ERROR_NONE,
- "bt_socket_send_data() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_unset_data_received_cb()
- */
-static void utc_network_bluetooth_socket_unset_data_received_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_unset_data_received_cb();
- dts_check_eq("bt_socket_unset_data_received_cb",
- ret, BT_ERROR_NONE,
- "bt_socket_unset_data_received_cb() failed.");
-}
-
-/**
- * @brief Positive test case of bt_socket_unset_connection_state_changed_cb()
- */
-static void utc_network_bluetooth_socket_unset_connection_state_changed_cb_p(void)
-{
- int ret = BT_ERROR_NONE;
-
- ret = bt_socket_unset_connection_state_changed_cb();
- dts_check_eq("bt_socket_unset_connection_state_changed_cb",
- ret, BT_ERROR_NONE,
- "bt_socket_unset_connection_state_changed_cb() failed.");
-}
+++ /dev/null
-all
- ^TEST
-##### Scenarios for TEST #####
-
-# Test scenario
-TEST
- :include:/testcase/tslist
+++ /dev/null
-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?
+++ /dev/null
-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
+++ /dev/null
-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 ?
+++ /dev/null
-BT_ADDR_HEADSET=00:21:19:14:29:52
-BT_ADDR_MOBILE=E4:32:CB:41:1D:7A
-BT_ADDR_HDP=00:22:58:07:77:BB
-BT_ADDR_LE=E4:32:CB:41:1F:A6
-
+++ /dev/null
-/usr/include/*
-/usr/include/*/*
-/usr/lib/pkgconfig/*.pc
-
+++ /dev/null
-/usr/lib/lib*.so*
+++ /dev/null
-capi-network-bluetooth (0.1.36-1) unstable; urgency=low
-
- * Implement AVRCP callback functions
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.36-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 28 Nov 2012 10:45:13 +0900
-
-capi-network-bluetooth (0.1.35-1) unstable; urgency=low
-
- * Add GATT api for BTLE support
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.35-1
-
- -- Chethan T N <chethan.tn@samsung.com> Fri, 23 Nov 2012 19:15:01 +0900
-
-capi-network-bluetooth (0.1.34-1) unstable; urgency=low
-
- * Correct the spelling
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.34-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 14 Nov 2012 17:16:04 +0900
-
-capi-network-bluetooth (0.1.33-1) unstable; urgency=low
-
- * Implement bt_ag_is_nrec_enabled API
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.33-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 14 Nov 2012 11:33:49 +0900
-
-capi-network-bluetooth (0.1.32-1) unstable; urgency=low
-
- * Add the duration parameter in bt_adapter_get_visibility
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.32-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 07 Nov 2012 17:30:49 +0900
-
-capi-network-bluetooth (0.1.31-1) unstable; urgency=low
-
- * Update version number
- * Git: magnolia/framework/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.31-1
-
- -- Jaekyun Lee <jkyun.lee@samsung.com> Tue, 06 Nov 2012 17:28:40 +0900
-
-capi-network-bluetooth (0.1.30-1) unstable; urgency=low
-
- * Implement bt_device_foreach_connected_profiles
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.30-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 06 Nov 2012 16:22:58 +0900
-
-capi-network-bluetooth (0.1.29-1) unstable; urgency=low
-
- * Fix the build break
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.29-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 17 Oct 2012 14:24:53 +0900
-
-capi-network-bluetooth (0.1.28-1) unstable; urgency=low
-
- * Add the device events
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.28-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 16 Oct 2012 11:17:10 +0900
-
-capi-network-bluetooth (0.1.27-1) unstable; urgency=low
-
- * Add license file in each rpm
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.27-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 11 Oct 2012 16:08:24 +0900
-
-capi-network-bluetooth (0.1.26-1) unstable; urgency=low
-
- * Assign the error code to result
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.26-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 26 Sep 2012 15:00:30 +0900
-
-capi-network-bluetooth (0.1.25-1) unstable; urgency=low
-
- * Add the address parameter in network connected event
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.25-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 26 Sep 2012 13:09:45 +0900
-
-capi-network-bluetooth (0.1.24-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.24-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 25 Sep 2012 15:11:44 +0900
-
-capi-network-bluetooth (0.1.23-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.23-1
-
- -- Sangki Park <sangki79.park@samsung.com> Tue, 25 Sep 2012 10:48:46 +0900
-
-capi-network-bluetooth (0.1.22-1) unstable; urgency=low
-
- * Apply smack manifest file
- * slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.22-1
-
- -- Sangki Park <sangki79.park@samsung.com> Fri, 21 Sep 2012 11:09:41 +0900
-
-capi-network-bluetooth (0.1.21-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.21-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 18 Sep 2012 16:23:52 +0900
-
-capi-network-bluetooth (0.1.20-1) natty; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.20-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 18 Sep 2012 13:52:44 +0900
-
-capi-network-bluetooth (0.1.19-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.19-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 17 Sep 2012 15:31:29 +0900
-
-capi-network-bluetooth (0.1.17-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.17-1
-
- -- Sangki Park <sangki79.park@samsung.com> Thu, 13 Sep 2012 12:47:12 +0900
-
-capi-network-bluetooth (0.1.16-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.16-1
-
- -- Sangki Park <sangki79.park@samsung.com> Thu, 13 Sep 2012 11:03:33 +0900
-
-capi-network-bluetooth (0.1.15-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.15-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 11 Sep 2012 16:08:53 +0900
-
-capi-network-bluetooth (0.1.14-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.14-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 11 Sep 2012 09:56:47 +0900
-
-capi-network-bluetooth (0.1.13-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.13-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 10 Sep 2012 12:56:50 +0900
-
-capi-network-bluetooth (0.1.12-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.12-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 16 Aug 2012 16:56:23 +0900
-
-capi-network-bluetooth (0.1.11-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.11-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 08 Aug 2012 19:26:30 +0900
-
-capi-network-bluetooth (0.1.10-1) unstable; urgency=low
-
- * Tagging and upload the package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.10-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 08 Aug 2012 17:08:38 +0900
-
-capi-network-bluetooth (0.1.9-1) unstable; urgency=low
-
- * Modify the HID APIs
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.9-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 07 Aug 2012 17:39:52 +0900
-
-capi-network-bluetooth (0.1.8-1) unstable; urgency=low
-
- * Implement bt_socket_set_connection_requested_cb APIs
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.8-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Mon, 06 Aug 2012 18:08:24 +0900
-
-capi-network-bluetooth (0.1.7-1) unstable; urgency=low
-
- * Implement bt_get_device_info API
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.7-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 01 Aug 2012 14:03:45 +0900
-
-capi-network-bluetooth (0.1.6-1) unstable; urgency=low
-
- * Modify the RFCOMM implement
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.6-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 25 Jul 2012 11:02:31 +0900
-
-capi-network-bluetooth (0.1.5-1) unstable; urgency=low
-
- * Add bt_get_device_info API
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.5-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Tue, 17 Jul 2012 13:51:51 +0900
-
-capi-network-bluetooth (0.1.4-1) unstable; urgency=low
-
- * Add HDP API / Fix inapposite data type (rssi)
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.4-1
-
- -- Sangki Park <sangki79.park@samsung.com> Fri, 29 Jun 2012 17:10:28 +0900
-
-capi-network-bluetooth (0.1.3-1) unstable; urgency=low
-
- * Implement the requirements from OSP
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.3-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 13 Jun 2012 09:14:03 +0900
-
-capi-network-bluetooth (0.1.2-1) unstable; urgency=low
-
- * Fix the DTS testcase
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.2-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 12 Apr 2012 15:48:47 +0900
-
-capi-network-bluetooth (0.1.1-1) unstable; urgency=low
-
- * Fix the crash in DTS test
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.1-1
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Thu, 29 Mar 2012 14:45:08 +0900
-
-capi-network-bluetooth (0.1.0-14) unstable; urgency=low
-
- * Initialize the pointer to NULL after free
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-14
-
- -- DoHyun Pyun <dh79.pyun@samsung.com> Wed, 21 Mar 2012 17:15:59 +0900
-
-capi-network-bluetooth (0.1.0-13) unstable; urgency=low
-
- * Correct dependent package
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-13
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Thu, 15 Mar 2012 13:13:36 +0900
-
-capi-network-bluetooth (0.1.0-12) unstable; urgency=low
-
- * Modify coding style
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-12
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 20 Feb 2012 15:50:45 +0900
-
-capi-network-bluetooth (0.1.0-11) unstable; urgency=low
-
- * Add versioning of library
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-11
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Tue, 14 Feb 2012 17:09:56 +0900
-
-capi-network-bluetooth (0.1.0-10) unstable; urgency=low
-
- * Clean codes
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-10
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Thu, 02 Feb 2012 14:49:58 +0900
-
-capi-network-bluetooth (0.1.0-9) unstable; urgency=low
-
- * Add LICENSE, remove COPYING and Convert TIZEN_ERROR_OK to TIZEN_ERROR_NONE
- * Git: slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-9
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 05 Dec 2011 13:04:56 +0900
-
-capi-network-bluetooth (0.1.0-8) unstable; urgency=low
-
- * Fix bug in destroying a bond
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-8
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Wed, 30 Nov 2011 21:07:06 +0900
-
-capi-network-bluetooth (0.1.0-7) unstable; urgency=low
-
- * Add service_uuid to bt_device_info_s and bt_device_sdp_info_s instead of service_list and modify log
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-7
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Wed, 30 Nov 2011 19:49:10 +0900
-
-capi-network-bluetooth (0.1.0-6) unstable; urgency=low
-
- * Convert SLP into TIZEN
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-6
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Wed, 23 Nov 2011 13:09:26 +0900
-
-capi-network-bluetooth (0.1.0-5) unstable; urgency=low
-
- * Change bt_device_cancel_bonding() and bt_adapter_set_visibility() into synchronous function, and Add BT_ERROR_SERVICE_SEARCH_ERROR to bt_error_e.
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-5
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Wed, 02 Nov 2011 18:58:16 +0900
-
-capi-network-bluetooth (0.1.0-4) unstable; urgency=low
-
- * Modify bt_error_e and change bt_device_cancel_service_search() and bt_device_cancel_bonding() into synchronous function
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-4
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Thu, 27 Oct 2011 16:59:18 +0900
-
-capi-network-bluetooth (0.1.0-3) unstable; urgency=low
-
- * Change bt_adapter_set_name into synchronous function
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-3
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 17 Oct 2011 18:34:03 +0900
-
-capi-network-bluetooth (0.1.0-2) unstable; urgency=low
-
- * Correct bug which happens when set local name and modify bt_error_e
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-2
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 10 Oct 2011 18:37:32 +0900
-
-capi-network-bluetooth (0.1.0-1) unstable; urgency=low
-
- * Modify error code of bt_initialize() and bt_deinitialize()
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.1.0-1
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Tue, 27 Sep 2011 22:17:33 +0900
-
-capi-network-bluetooth (0.0.1-9) unstable; urgency=low
-
- * Remove undefined enum type
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-9
-
- -- Kangho Hur <kangho.hur@samsung.com> Mon, 26 Sep 2011 21:31:34 +0900
-
-capi-network-bluetooth (0.0.1-8) unstable; urgency=low
-
- * Change device_address to remote_address
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-8
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Fri, 23 Sep 2011 20:02:07 +0900
-
-capi-network-bluetooth (0.0.1-7) unstable; urgency=low
-
- * Remove BT_MAJOR_SERVICE_CLASS_UNKNOWN
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-7
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Tue, 20 Sep 2011 17:17:01 +0900
-
-capi-network-bluetooth (0.0.1-6) unstable; urgency=low
-
- * Rename class to bt_class
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-6
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Thu, 08 Sep 2011 10:54:58 +0900
-
-capi-network-bluetooth (0.0.1-5) unstable; urgency=low
-
- * Remove parameters of bt_adapter_start_device_discovery()
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-5
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 05 Sep 2011 20:22:36 +0900
-
-capi-network-bluetooth (0.0.1-4) unstable; urgency=low
-
- * Add bt_adapter_device_discovery_info_s
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-4
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 22 Aug 2011 15:41:37 +0900
-
-capi-network-bluetooth (0.0.1-3) unstable; urgency=low
-
- * Fix build break
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-3
-
- -- Kangho Hur <kangho.hur@samsung.com> Sat, 13 Aug 2011 01:07:56 +0900
-
-capi-network-bluetooth (0.0.1-2) unstable; urgency=low
-
- * Modify how to copy service list
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-2
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Thu, 11 Aug 2011 19:45:20 +0900
-
-capi-network-bluetooth (0.0.1-1) unstable; urgency=low
-
- * Initial upload
- * Git: slp-source.sec.samsung.net:slp/api/bluetooth
- * Tag: capi-network-bluetooth_0.0.1-1
-
- -- ByungWoo Lee <bw1212.lee@samsung.com> Mon, 08 Aug 2011 10:12:25 +0900
-
+++ /dev/null
-Source: capi-network-bluetooth
-Section: libs
-Priority: extra
-Maintainer: Kangho Hur <kangho.hur@samsung.com>, ByungWoo Lee <bw1212.lee@samsung.com>
-Build-Depends: debhelper (>= 5), dlog-dev, capi-base-common-dev, libglib2.0-dev, libbluetooth-frwk-dev
-
-Package: capi-network-bluetooth
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}
-Description: A Network Bluetooth library in Tizen Native API
-
-Package: capi-network-bluetooth-dev
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-bluetooth (= ${Source-Version}), capi-base-common-dev
-Description: A Network Bluetooth library in Tizen Native API (DEV)
-
-Package: capi-network-bluetooth-dbg
-Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, capi-network-bluetooth (= ${Source-Version})
-Description: A Network Bluetooth library in Tizen Native API (DBG)
-
+++ /dev/null
-#!/usr/bin/make -f
-
-FULLVER ?= $(shell dpkg-parsechangelog | grep Version: | cut -d ' ' -f 2 | cut -d '-' -f 1)
-MAJORVER ?= $(shell echo $(FULLVER) | cut -d '.' -f 1)
-
-CFLAGS = -Wall -g
-
-ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
- CFLAGS += -O0
-else
- CFLAGS += -O2
-endif
-CMAKE_ROOT_DIR ?= $(CURDIR)
-CMAKE_BUILD_DIR ?= $(CURDIR)/cmake_build_tmp
-
-configure: configure-stamp
-configure-stamp:
- dh_testdir
- mkdir -p $(CMAKE_BUILD_DIR) && cd $(CMAKE_BUILD_DIR) && cmake .. -DFULLVER=${FULLVER} -DMAJORVER=${MAJORVER}
- touch configure-stamp
-
-
-build: build-stamp
-build-stamp: configure-stamp
- dh_testdir
- cd $(CMAKE_BUILD_DIR) && $(MAKE)
- touch $@
-
-clean:
- cd $(CMAKE_ROOT_DIR)
- dh_testdir
- dh_testroot
- rm -f build-stamp configure-stamp
- rm -f `find . -name *.pc`
- rm -rf $(CMAKE_BUILD_DIR)
- dh_clean
-
-install: build
- dh_testdir
- dh_testroot
- dh_clean -k
- dh_installdirs
-
- cd $(CMAKE_BUILD_DIR) && $(MAKE) DESTDIR=$(CURDIR)/debian/tmp install
-
-binary-indep: build install
-
-binary-arch: build install
- dh_testdir
- dh_testroot
- dh_installchangelogs
- dh_installdocs
- dh_installexamples
- dh_install --sourcedir=debian/tmp
- dh_installman
- dh_link
- dh_strip --dbg-package=capi-network-bluetooth-dbg
- dh_fixperms
- dh_makeshlibs
- dh_installdeb
- dh_shlibdeps
- dh_gencontrol
- dh_md5sums
- dh_builddeb
-
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install configure
-