2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "bluetooth-api.h"
19 #include "bt-internal-types.h"
21 #include "bt-common.h"
22 #include "bt-request-sender.h"
23 #include "bt-event-handler.h"
25 BT_EXPORT_API int bluetooth_otp_server_init(const char *directory)
27 int result = BLUETOOTH_ERROR_INTERNAL;
28 bt_user_info_t *user_info;
29 char dir_name[BLUETOOTH_MAX_OTP_SERVER_DIR_NAME];
32 BT_CHECK_ENABLED(return);
34 user_info = _bt_get_user_data(BT_COMMON);
35 retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
38 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
41 g_strlcpy(dir_name, directory, sizeof(dir_name));
45 g_array_append_vals(in_param1, dir_name, BLUETOOTH_MAX_OTP_SERVER_DIR_NAME);
47 result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_OTP_SERVER_INIT,
48 in_param1, in_param2, in_param3, in_param4,
49 user_info->cb, user_info->user_data);
51 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
57 BT_EXPORT_API int bluetooth_otp_server_deinit()
59 int result = BLUETOOTH_ERROR_INTERNAL;
60 bt_user_info_t *user_info;
63 BT_CHECK_ENABLED(return);
65 user_info = _bt_get_user_data(BT_COMMON);
66 retv_if(user_info->cb == NULL, BLUETOOTH_ERROR_INTERNAL);
69 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
72 result = _bt_send_request_async(BT_BLUEZ_SERVICE, BT_OTP_SERVER_DEINIT,
73 in_param1, in_param2, in_param3, in_param4,
74 user_info->cb, user_info->user_data);
76 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);