Remove OPP implementation code 61/208561/1
authorDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 26 Jun 2019 02:25:00 +0000 (11:25 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Wed, 26 Jun 2019 02:25:00 +0000 (11:25 +0900)
Change-Id: I6bdaba64a81129229932791b75d73ef23a061c1d
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
src/bluetooth-opp-client.c
src/bluetooth-opp-server.c

index cf24c649a54199b955f1c9b25bf7dd90d22a6654..83b3f5ed80935b603a50a3668979a162f12f361b 100644 (file)
  * limitations under the License.
  */
 
-#include <glib.h>
-#include <dlog.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <string.h>
-#include <bluetooth-api.h>
-
 #include "bluetooth.h"
 #include "bluetooth_private.h"
 
-GList *sending_files;
-static bool is_opp_client_initialized = false;
-
-#define BT_CHECK_OPP_CLIENT_SUPPORT() \
-{ \
-       BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
-       BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OPP); \
-}
-
-#define BT_CHECK_OPP_CLIENT_INIT_STATUS() \
-       if (__bt_check_opp_client_init_status() == BT_ERROR_NOT_INITIALIZED) { \
-               LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
-               return BT_ERROR_NOT_INITIALIZED; \
-       }
-
-int __bt_check_opp_client_init_status(void)
-{
-       if (is_opp_client_initialized != true) {
-               BT_ERR("NOT_INITIALIZED(0x%08x)", BT_ERROR_NOT_INITIALIZED);
-               return BT_ERROR_NOT_INITIALIZED;
-       }
-
-       return BT_ERROR_NONE;
-}
-/* LCOV_EXCL_START */
-char **__bt_opp_get_file_array(GList *file_list)
-{
-       char **files = NULL;
-       char *c_file = NULL;
-       int file_num = 0;
-       int i = 0;
-
-       if (file_list == NULL)
-               return NULL;
-
-       file_num = g_list_length(file_list);
-
-       if (file_num == 0)
-               return NULL;
-
-       files = (char **)calloc(file_num + 1, sizeof(char *));
-       if (!files)
-               return NULL;
-
-       for (i = 0; i < file_num; i++) {
-               c_file = (char *)g_list_nth_data(file_list, i);
-
-               if (c_file == NULL)
-                       continue;
-
-               files[i] = c_file;
-       }
-
-       for (i = 0; i < file_num; i++)
-               BT_DBG("file: %s", files[i]);
-
-       return files;
-} /* LCOV_EXCL_STOP */
-
 int bt_opp_client_initialize(void)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-
-       error_code = _bt_get_error_code(bluetooth_opc_init());
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
-                               error_code); /* LCOV_EXCL_LINE */
-               return error_code; /* LCOV_EXCL_LINE */
-       }
-
-       is_opp_client_initialized = true;
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_client_deinitialize(void)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_CLIENT_INIT_STATUS();
-
-       error_code = _bt_get_error_code(bluetooth_opc_deinit());
-       bt_opp_client_clear_files();
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
-                               error_code); /* LCOV_EXCL_LINE */
-               return error_code; /* LCOV_EXCL_LINE */
-       }
-
-       is_opp_client_initialized = false;
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_client_add_file(const char *file)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_CLIENT_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(file);
-       BT_CHECK_ADAPTER_STATUS(); /* LCOV_EXCL_START */
-
-       if (access(file, F_OK) == 0) {
-               sending_files = g_list_append(sending_files, strdup(file));
-       } else {
-               if (errno == EACCES || errno == EPERM)
-                       error_code = BT_ERROR_PERMISSION_DENIED;
-               else
-                       error_code = BT_ERROR_INVALID_PARAMETER;
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       }
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_client_clear_files(void)
 {
-       int i = 0;
-       int file_num = 0;
-       char *c_file = NULL;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_CLIENT_INIT_STATUS();
-       BT_CHECK_ADAPTER_STATUS();
-
-       if (sending_files) { /* LCOV_EXCL_START */
-               file_num = g_list_length(sending_files);
-
-               for (i = 0; i < file_num; i++) {
-                       c_file = (char *)g_list_nth_data(sending_files, i);
-
-                       if (c_file == NULL)
-                               continue;
-
-                       free(c_file);
-               }
-
-               g_list_free(sending_files);
-               sending_files = NULL; /* LCOV_EXCL_STOP */
-       }
-
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_client_push_files(const char *remote_address,
@@ -183,53 +43,11 @@ int bt_opp_client_push_files(const char *remote_address,
                        bt_opp_client_push_finished_cb finished_cb,
                        void *user_data)
 {
-       int error_code = BT_ERROR_NONE;
-       bluetooth_device_address_t addr_hex = { {0,} };
-       char **files = NULL;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS(); /* LCOV_EXCL_START */
-       BT_CHECK_OPP_CLIENT_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(remote_address);
-
-       _bt_convert_address_to_hex(&addr_hex, remote_address);
-
-       files = __bt_opp_get_file_array(sending_files);
-
-       error_code = _bt_get_error_code(bluetooth_opc_push_files(&addr_hex, files));
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       } else {
-               _bt_set_cb(BT_EVENT_OPP_CLIENT_PUSH_RESPONSED, responded_cb, user_data);
-               _bt_set_cb(BT_EVENT_OPP_CLIENT_PUSH_PROGRESS, progress_cb, user_data);
-               _bt_set_cb(BT_EVENT_OPP_CLIENT_PUSH_FINISHED, finished_cb, user_data);
-       }
-
-       bt_opp_client_clear_files();
-
-       if (files)
-               free(files);
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_client_cancel_push(void)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_CLIENT_SUPPORT();
-       BT_CHECK_INIT_STATUS(); /* LCOV_EXCL_START */
-       BT_CHECK_OPP_CLIENT_INIT_STATUS();
-
-       error_code = _bt_get_error_code(bluetooth_opc_cancel_push());
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       }
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
index 22cfcc358260270cb8083a5a0c0753e3cb27200c..6da52eac5605c97259f2df02837d14a46855da74 100644 (file)
  * limitations under the License.
  */
 
-#include <dlog.h>
-#include <stdio.h>
-#include <stdbool.h>
-#include <bluetooth-api.h>
-
 #include "bluetooth.h"
 #include "bluetooth_private.h"
 
-static bool is_opp_server_initialized = false;
-
-#define BT_CHECK_OPP_SERVER_SUPPORT() \
-{ \
-       BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_COMMON); \
-       BT_CHECK_SUPPORTED_FEATURE(BT_FEATURE_OPP); \
-}
-
-
-#define BT_CHECK_OPP_SERVER_INIT_STATUS() \
-       if (__bt_check_opp_server_init_status() == BT_ERROR_NOT_INITIALIZED) { \
-               LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, \
-                                       BT_ERROR_NOT_INITIALIZED); \
-               return BT_ERROR_NOT_INITIALIZED; \
-       }
-
-int __bt_check_opp_server_init_status(void)
-{
-       if (is_opp_server_initialized != true) {
-               BT_ERR("NOT_INITIALIZED(0x%08x)", BT_ERROR_NOT_INITIALIZED);
-               return BT_ERROR_NOT_INITIALIZED;
-       }
-
-       return BT_ERROR_NONE;
-}
-
 /* LCOV_EXCL_START */
 int bt_opp_server_initialize(const char *destination,
                        bt_opp_server_push_requested_cb push_requested_cb,
                        void *user_data)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(destination);
-
-       error_code = _bt_get_error_code(bluetooth_obex_server_init(destination));
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-               return error_code;
-       }
-
-       _bt_set_cb(BT_EVENT_OPP_PUSH_REQUESTED, push_requested_cb, user_data);
-
-       is_opp_server_initialized = true;
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 /* LCOV_EXCL_START */
@@ -78,52 +30,12 @@ int bt_opp_server_initialize_by_connection_request(const char *destination,
                bt_opp_server_connection_requested_cb connection_requested_cb,
                void *user_data)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(destination);
-
-       error_code = _bt_get_error_code(bluetooth_obex_server_init_without_agent(destination));
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
-                               error_code);
-               return error_code; /* LCOV_EXCL_LINE */
-       }
-
-       _bt_set_cb(BT_EVENT_OPP_CONNECTION_REQUESTED, connection_requested_cb, user_data);
-
-       is_opp_server_initialized = true;
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_server_deinitialize(void)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_SERVER_INIT_STATUS();
-
-       if (_bt_check_cb(BT_EVENT_OPP_CONNECTION_REQUESTED) == false) {
-               error_code = _bt_get_error_code(bluetooth_obex_server_deinit()); /* LCOV_EXCL_LINE */
-       } else {
-               /* BADA API */
-               error_code = _bt_get_error_code(bluetooth_obex_server_deinit_without_agent());
-       }
-
-       _bt_unset_cb(BT_EVENT_OPP_CONNECTION_REQUESTED);
-       _bt_unset_cb(BT_EVENT_OPP_PUSH_REQUESTED);
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
-                               error_code);
-               return error_code; /* LCOV_EXCL_LINE */
-       }
-
-       is_opp_server_initialized = false;
-       return BT_ERROR_NONE;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_server_accept(bt_opp_server_transfer_progress_cb progress_cb,
@@ -132,114 +44,28 @@ int bt_opp_server_accept(bt_opp_server_transfer_progress_cb progress_cb,
                        void *user_data,
                        int *transfer_id)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_SERVER_INIT_STATUS(); /* LCOV_EXCL_START */
-
-       /* Unset the transfer callbacks */
-       _bt_unset_cb(BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS);
-       _bt_unset_cb(BT_EVENT_OPP_SERVER_TRANSFER_FINISHED);
-
-       if (_bt_check_cb(BT_EVENT_OPP_CONNECTION_REQUESTED) == false) {
-               error_code = _bt_get_error_code(bluetooth_obex_server_accept_authorize(name));
-       } else {
-               /* BADA API */
-               error_code = _bt_get_error_code(bluetooth_obex_server_accept_connection());
-       }
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       } else {
-               _bt_set_cb(BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS, progress_cb, user_data);
-               _bt_set_cb(BT_EVENT_OPP_SERVER_TRANSFER_FINISHED, finished_cb, user_data);
-       }
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_server_reject(void)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_SERVER_INIT_STATUS(); /* LCOV_EXCL_START */
-
-       if (_bt_check_cb(BT_EVENT_OPP_CONNECTION_REQUESTED) == false) {
-               error_code = _bt_get_error_code(bluetooth_obex_server_reject_authorize());
-       } else {
-               /* BADA API */
-               error_code = _bt_get_error_code(bluetooth_obex_server_reject_connection());
-       }
-
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       }
-
-       /* Unset the transfer callbacks */
-       _bt_unset_cb(BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS);
-       _bt_unset_cb(BT_EVENT_OPP_SERVER_TRANSFER_FINISHED);
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_server_set_destination(const char *destination)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_SERVER_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(destination);
-
-       error_code = _bt_get_error_code(bluetooth_obex_server_set_destination_path(destination));
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), /* LCOV_EXCL_LINE */
-                               error_code);
-       }
-
-       return error_code;
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 int bt_opp_server_cancel_transfer(int transfer_id)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_OPP_SERVER_INIT_STATUS(); /* LCOV_EXCL_START */
-
-       error_code = _bt_get_error_code(bluetooth_obex_server_cancel_transfer(transfer_id));
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       }
-
-       return error_code; /* LCOV_EXCL_STOP */
+       return BT_ERROR_NOT_SUPPORTED;
 }
 
 /* LCOV_EXCL_START */
 int bt_opp_get_transfer_progress(bt_opp_transfer_type_t transfer_type,
                int transfer_id, unsigned char *progress)
 {
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_OPP_SERVER_SUPPORT();
-       BT_CHECK_INIT_STATUS();
-       BT_CHECK_INPUT_PARAMETER(progress);
-
-       error_code = _bt_get_error_code(bluetooth_opp_get_transfer_progress(transfer_type, transfer_id, progress));
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-               *progress = 0;
-       }
-
-       return error_code;
-
+       return BT_ERROR_NOT_SUPPORTED;
 }
 /* LCOV_EXCL_STOP */