2 * Open Adaptation Layer (OAL)
4 * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 #ifndef _OAL_DEVICE_MGR_H_
21 #define _OAL_DEVICE_MGR_H_
24 #include <sys/types.h>
26 #include <oal-manager.h>
33 * @brief Connection type
35 * @see device_create_bond
39 CONN_TYPE_DEFAULT = 0xFF, /* represents that connection type can both BR/EDR and LE */
40 CONN_TYPE_BREDR = 0x00,
45 * @brief Request remote device attributes
47 * @details Attibutes such as name, vidpid, bond state etc are requested. remote_device_t is provided
48 * with OAL_EVENT_DEVICE_PROPERTIES
50 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
51 * @retval #OAL_STATUS_SUCCESS Successful
53 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
55 * @see OAL_EVENT_DEVICE_PROPERTIES
56 * @see remote_device_t
58 oal_status_t device_query_attributes(bt_address_t * addr);
61 * @brief Set alias for remote device
63 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
64 * @retval #OAL_STATUS_SUCCESS Successful
66 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
68 * @see remote_device_t
70 oal_status_t device_set_alias(bt_address_t * addr, char * alias);
74 * @brief Initiate bonding with remote device
76 * @details Based on IO capabilties of 2 devices, different events can be generated
78 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
79 * @retval #OAL_STATUS_SUCCESS Successful
81 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
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
91 oal_status_t device_create_bond(bt_address_t * addr, connection_type_e transport);
94 * @brief Cancel already in-progress bonding procedure
96 * @details Based on current progress different events can be recieved.
98 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
99 * @retval #OAL_STATUS_SUCCESS Successful
101 * @pre Bonding must be in progress by calling device_create_bond()
103 * @see OAL_EVENT_DEVICE_BONDING_SUCCESS
104 * @see OAL_EVENT_DEVICE_BONDING_FAILED
105 * @see OAL_EVENT_DEVICE_BONDING_REMOVED
107 oal_status_t device_stop_bond(bt_address_t * addr);
110 * @brief Remove the already created Bond with remote device
112 * @details Based on current progress different events can be recieved.
114 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
115 * @retval #OAL_STATUS_SUCCESS Successful
117 * @pre Bond should exist
119 * @see OAL_EVENT_DEVICE_BONDING_REMOVED
121 oal_status_t device_destroy_bond(bt_address_t * addr);
124 * @brief Request services supported by remote device
126 * @details List of services in form UUIDs will be provided in event data
128 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
129 * @retval #OAL_STATUS_SUCCESS Successful
131 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
133 * @see OAL_EVENT_DEVICE_SERVICES
134 * @see event_dev_services_t
136 oal_status_t device_query_services(bt_address_t * addr);
139 * @brief Cancel already in-progress SDP procedure
141 * @details Based on current progress different events can be recieved.
143 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
144 * @retval #OAL_STATUS_SUCCESS Successful
146 * @pre SDP must be in progress by calling device_query_services()
149 oal_status_t device_stop_query_sevices(bt_address_t * addr);
152 * @brief Accept PIN request as part of Bonding procedure
154 * @details Positive response to OAL_EVENT_DEVICE_PIN_REQUEST
156 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
157 * @retval #OAL_STATUS_SUCCESS Successful
159 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
161 * @see OAL_EVENT_DEVICE_PIN_REQUEST
163 oal_status_t device_accept_pin_request(bt_address_t * addr, const char * pin);
166 * @brief Reject PIN request as part of Bonding procedure
168 * @details Negative response to OAL_EVENT_DEVICE_PIN_REQUEST
170 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
171 * @retval #OAL_STATUS_SUCCESS Successful
173 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
175 * @see OAL_EVENT_DEVICE_PIN_REQUEST
177 oal_status_t device_reject_pin_request(bt_address_t * addr);
180 * @brief Accept passkey entry request as part of Bonding procedure
182 * @details Positive response to OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST
184 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
185 * @retval #OAL_STATUS_SUCCESS Successful
187 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
189 * @see OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST
191 oal_status_t device_accept_passkey_entry(bt_address_t * addr, uint32_t passkey);
194 * @brief Reject passkey entry request as part of Bonding procedure
196 * @details Negative response to OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST
198 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
199 * @retval #OAL_STATUS_SUCCESS Successful
201 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
203 * @see OAL_EVENT_DEVICE_PASSKEY_ENTRY_REQUEST
205 oal_status_t device_reject_passkey_entry(bt_address_t * addr);
208 * @brief Reply passkey confirmation request as part of Bonding procedure
210 * @details Response to OAL_EVENT_DEVICE_PASSKEY_CONFIRMATION_REQUEST
212 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
213 * @retval #OAL_STATUS_SUCCESS Successful
215 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
217 * @see OAL_EVENT_DEVICE_PASSKEY_CONFIRMATION_REQUEST
219 oal_status_t device_reply_passkey_confirmation(bt_address_t * addr, int accept);
222 * @brief Reply SSP consent request as part of Bonding procedure
224 * @details Response to OAL_EVENT_DEVICE_SSP_CONSENT_REQUEST
226 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
227 * @retval #OAL_STATUS_SUCCESS Successful
229 * @pre Adapter must be enabled with adapter_enable() followed by OAL_EVENT_ADAPTER_ENABLED
231 * @see OAL_EVENT_DEVICE_SSP_CONSENT_REQUEST
233 oal_status_t device_reply_ssp_consent(bt_address_t * addr, int accept);
236 * @brief Accept or reject authorization request for a connection from remote device
238 * @details authorize = TRUE: all connections from this device will be auto accepted without any auth-event
239 * authorize = FALSE: all connections from this device will result in auth request event
241 * @param[in] always If TRUE, future connection requests will be automatically accepted.
243 * @return OAL_STATUS_SUCCESS on success, otherwise a non-zero error value.
244 * @retval #OAL_STATUS_SUCCESS Successful
246 * @pre OAL_EVENT_DEVICE_AUTHORIZE_REQUEST should have been recieved by application.
248 * @see OAL_EVENT_DEVICE_AUTHORIZE_REQUEST
250 oal_status_t device_reply_auth_request(bt_address_t * addr, oal_service_t service_type, int accept, int always);
254 #endif /* __cplusplus */
255 #endif /*_OAL_DEVICE_MGR_H_*/