Ignore vconfkey value change for AVC mode on
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / bt-ipsp.c
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  *              http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 #include "bluetooth-api.h"
19 #include "bluetooth-ipsp-api.h"
20 #include "bt-internal-types.h"
21
22 #include "bt-common.h"
23 #include "bt-request-sender.h"
24 #include "bt-event-handler.h"
25
26 BT_EXPORT_API int bluetooth_ipsp_init(void)
27 {
28         int ret = IPSP_ERROR_NONE;
29
30         BT_CHECK_ENABLED_LE(return);
31
32         BT_INIT_PARAMS();
33
34         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
35
36         ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_INIT,
37                 in_param1, in_param2, in_param3, in_param4, &out_param);
38
39         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
40
41         return ret;
42 }
43
44 BT_EXPORT_API int bluetooth_ipsp_deinit(void)
45 {
46         int ret = IPSP_ERROR_NONE;
47
48         BT_CHECK_ENABLED_LE(return);
49
50         BT_INIT_PARAMS();
51
52         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
53
54         ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_DEINIT,
55                 in_param1, in_param2, in_param3, in_param4, &out_param);
56
57         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
58
59         return ret;
60 }
61
62 BT_EXPORT_API int bluetooth_ipsp_connect(const ipsp_device_address_t *device_address)
63 {
64         int ret = IPSP_ERROR_NONE;
65
66         BT_CHECK_PARAMETER(device_address, return);
67         BT_CHECK_ENABLED_LE(return);
68
69         BT_INIT_PARAMS();
70         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
71
72         g_array_append_vals(in_param1, device_address, sizeof(ipsp_device_address_t));
73
74         ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_CONNECT,
75                 in_param1, in_param2, in_param3, in_param4, &out_param);
76
77         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
78
79         return ret;
80 }
81
82 BT_EXPORT_API int bluetooth_ipsp_disconnect(const ipsp_device_address_t *device_address)
83 {
84         int ret = IPSP_ERROR_NONE;
85
86         BT_CHECK_PARAMETER(device_address, return);
87         BT_CHECK_ENABLED_LE(return);
88
89         BT_INIT_PARAMS();
90         BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
91
92         g_array_append_vals(in_param1, device_address, sizeof(ipsp_device_address_t));
93
94         ret = _bt_send_request(BT_BLUEZ_SERVICE, BT_LE_IPSP_DISCONNECT,
95                 in_param1, in_param2, in_param3, in_param4, &out_param);
96
97         BT_FREE_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
98
99         return ret;
100 }