[Adaprt: OAL] Implement create and remove bond
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / include / oal-device-mgr.h
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #ifndef _OAL_DEVICE_MGR_H_
21 #define _OAL_DEVICE_MGR_H_
22
23 #include <glib.h>
24 #include <sys/types.h>
25
26 #include <oal-manager.h>
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33  * @brief Connection type
34  *
35  * @see  device_create_bond
36  */
37
38 typedef enum {
39         CONN_TYPE_DEFAULT = 0xFF, /* represents that connection type can both BR/EDR and LE */
40         CONN_TYPE_BREDR = 0x00,
41         CONN_TYPE_LE = 0x01,
42 } connection_type_e;
43
44 /**
45  * @brief Request remote device attributes
46  *
47  * @details Attibutes such as name, vidpid, bond state etc are requested. remote_device_t is provided
48  *                 with OAL_EVENT_DEVICE_PROPERTIES
49  *
50  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
51  * @retval #OAL_STATUS_SUCCESS  Successful
52  *
53  * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
54  *
55  * @see  OAL_EVENT_DEVICE_PROPERTIES
56  * @see  remote_device_t
57  */
58 oal_status_t device_query_attributes(bt_address_t * addr);
59
60 /**
61  * @brief Set alias for remote device
62  *
63  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
64  * @retval #OAL_STATUS_SUCCESS  Successful
65  *
66  * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
67  *
68  * @see  remote_device_t
69  */
70 oal_status_t device_set_alias(bt_address_t * addr, char * alias);
71
72
73 /**
74  * @brief Initiate bonding with remote device
75  *
76  * @details Based on IO capabilties of 2 devices, different events can be generated
77  *
78  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
79  * @retval #OAL_STATUS_SUCCESS  Successful
80  *
81  * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
82  *
83  * @see  OAL_EVENT_DEVICE_PIN_REQUEST
84  * @see  OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST
85  * @see  OAL_EVENT_DEVICE_PASSKEY_CONFIRMATION_REQUEST
86  * @see  OAL_EVENT_DEVICE_PASSKEY_DISPLAY
87  * @see  OAL_EVENT_DEVICE_SSP_CONSENT_REQUEST
88  * @see  OAL_EVENT_DEVICE_BONDING_SUCCESS
89  * @see  OAL_EVENT_DEVICE_BONDING_FAILED
90  */
91 oal_status_t device_create_bond(bt_address_t * addr, connection_type_e transport);
92
93 /**
94  * @brief Cancel already in-progress bonding procedure
95  *
96  * @details Based on current progress different events can be recieved.
97  *
98  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
99  * @retval #OAL_STATUS_SUCCESS  Successful
100  *
101  * @pre Bonding must be in progress by calling device_create_bond()
102  *
103  * @see  OAL_EVENT_DEVICE_BONDING_SUCCESS
104  * @see  OAL_EVENT_DEVICE_BONDING_FAILED
105  * @see  OAL_EVENT_DEVICE_BONDING_REMOVED
106  */
107 oal_status_t device_stop_bond(bt_address_t * addr);
108
109
110 /**
111  * @brief Remove the already created Bond with remote device
112  *
113  * @details Based on current progress different events can be recieved.
114  *
115  * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
116  * @retval #OAL_STATUS_SUCCESS  Successful
117  *
118  * @pre Bond should exist
119  *
120  * @see  OAL_EVENT_DEVICE_BONDING_REMOVED
121  */
122 oal_status_t device_destroy_bond(bt_address_t * addr);
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126 #endif /*_OAL_DEVICE_MGR_H_*/
127