2 * Copyright (c) 2015 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 "bluetooth-ipsp-api.h"
20 #include "bt-internal-types.h"
22 #include "bt-common.h"
23 #include "bt-request-sender.h"
24 #include "bt-event-handler.h"
26 BT_EXPORT_API int bluetooth_le_ipsp_init(void)
28 int ret = IPSP_ERROR_NONE;
30 BT_CHECK_ENABLED_LE(return);
34 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
36 ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_INIT,
37 in_param1, in_param2, in_param3, in_param4, &out_param);
39 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
44 BT_EXPORT_API int bluetooth_le_ipsp_deinit(void)
46 int ret = IPSP_ERROR_NONE;
48 BT_CHECK_ENABLED_LE(return);
52 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
54 ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_DEINIT,
55 in_param1, in_param2, in_param3, in_param4, &out_param);
57 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
62 BT_EXPORT_API int bluetooth_le_ipsp_connect(const ipsp_device_address_t *device_address)
64 int ret = IPSP_ERROR_NONE;
66 BT_CHECK_PARAMETER(device_address, return);
67 BT_CHECK_ENABLED_LE(return);
70 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
72 g_array_append_vals(in_param1, device_address, sizeof(ipsp_device_address_t));
74 ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_CONNECT,
75 in_param1, in_param2, in_param3, in_param4, &out_param);
77 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
82 BT_EXPORT_API int bluetooth_le_ipsp_disconnect(const ipsp_device_address_t *device_address)
84 int ret = IPSP_ERROR_NONE;
86 BT_CHECK_PARAMETER(device_address, return);
87 BT_CHECK_ENABLED_LE(return);
90 BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
92 g_array_append_vals(in_param1, device_address, sizeof(ipsp_device_address_t));
94 ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_DISCONNECT,
95 in_param1, in_param2, in_param3, in_param4, &out_param);
97 BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);