Imported Upstream version 1.0.1
[platform/upstream/iotivity.git] / resource / csdk / connectivity / lib / tizen / ble / inc / mobile / bluetooth_product.h
1 /*
2  * Copyright (c) 2011 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  * @file
19  *
20  *
21  */
22
23 #ifndef __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__
24 #define __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__
25
26 #include "bluetooth_type.h"
27 #include "bluetooth_type_product.h"
28
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif /* __cplusplus */
33
34 /**
35  * @internal
36  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
37  * @brief Sets the manufacturer data of local Bluetooth adapter.
38  * @since_tizen 2.3
39  * @privlevel platform
40  * @privilege %http://tizen.org/privilege/bluetooth.admin
41  *
42  * @param[in]   data    The manufacturer specific data of the Bluetooth device.
43  * @param[in]   len     The length of @a data.Maximaum length is 240 bytes.
44  *
45  * @return 0 on success, otherwise a negative error value.
46  * @retval #BT_ERROR_NONE  Successful
47  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
48  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
49  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
50  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
51  *
52  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
53  * @post bt_adapter_manufacturer_data_changed_cb() will be invoked
54  * if this function returns #BT_ERROR_NONE.
55  *
56  * @see bt_adapter_manufacturer_data_changed_cb
57  * @see bt_adapter_set_manufacturer_data_changed_cb()
58  * @see bt_adapter_unset_manufacturer_data_changed_cb()
59  */
60 int bt_adapter_set_manufacturer_data(char *data, int len);
61
62 /**
63  * @internal
64  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
65  * @brief  Registers a callback function to be invoked
66  * when the manufacturer data of Bluetooth adapter changes.
67  * @since_tizen 2.3
68  *
69  * @param[in]   callback        The callback function to invoke
70  * @param[in]   user_data       The user data to be passed to the callback function
71  *
72  * @return   0 on success, otherwise a negative error value.
73  * @retval #BT_ERROR_NONE  Successful
74  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
75  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
76  *
77  * @pre The Bluetooth service must be initialized with bt_initialize().
78  * @post  bt_adapter_manufacturer_data_changed_cb() will be invoked.
79  *
80  * @see bt_initialize()
81  * @see bt_adapter_unset_manufacturer_data_changed_cb()
82  */
83 int bt_adapter_set_manufacturer_data_changed_cb(
84                 bt_adapter_manufacturer_data_changed_cb callback,
85                 void *user_data);
86
87 /**
88  * @internal
89  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
90  * @brief       Unregisters the callback function.
91  * @since_tizen 2.3
92  *
93  * @return      0 on success, otherwise a negative error value.
94  * @retval #BT_ERROR_NONE  Successful
95  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
96  *
97  * @pre The Bluetooth service must be initialized with bt_initialize().
98  *
99  * @see bt_initialize()
100  * @see bt_adapter_set_manufacturer_data_changed_cb()
101  */
102 int bt_adapter_unset_manufacturer_data_changed_cb(void);
103
104 /**
105  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
106  * @brief Sets the scan interval and widow, synchronously.
107  * @since_tizen 2.3
108  * @privlevel platform
109  * @privilege %http://tizen.org/privilege/bluetooth.admin
110  * @param[in]  scan_params  The parameters of le scanning \n
111  *                              If NULL is passed, default values which are defined in driver / controller are used.
112  *
113  * @return 0 on success, otherwise a negative error value.
114  * @retval #BT_ERROR_NONE Successful
115  * @retval #BT_ERROR_NOT_ENABLED Adapter is not enabled
116  * @retval #BT_ERROR_INVALID_PARAM Parameter is invalid
117  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
118  * @pre The Bluetooth service must be initialized with bt_initialize().
119  * @see bt_initialize()
120  */
121 int bt_adapter_le_set_scan_parameter(bt_adapter_le_scan_params_s *scan_params);
122
123 /**
124  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
125  * @brief Enables RSSI monitoring and sets threshold for LE/ACL link present with the remote device.
126  * @since_tizen 2.3
127  * @privlevel platform
128  * @privilege %http://tizen.org/privilege/bluetooth.admin
129  *
130  * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored
131  * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
132  * @param[in] low_threshold Lower threshold value for the LE Link in dBm.
133  * @param[in] in_range_threshold In-Range threshold value for the LE Link in dBm.
134  * @param[in] cb_enable Callback to be called when RSSI monitoring is enabled.
135  * @param[in] user_data_enable Data to be passed to RSSI enable callback.
136  * @param[in] cb_alert Callback to receive RSSI Alert values.
137  * @param[in] user_data_alert Data to be passed to RSSI Alert callback.
138  *
139  * @return 0 on success, otherwise a negative error value.
140  * @retval #BT_ERROR_NONE  Successful
141  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
142  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
143  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
144  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
145  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
146  *
147  * @remarks High Threshold value is set to 127.
148  *
149  * @see bt_device_unset_rssi_alert_cb()
150  * @see bt_device_disable_rssi_monitor()
151  */
152 int bt_device_enable_rssi_monitor(const char *remote_address,
153                 bt_device_connection_link_type_e link_type,
154                 int low_threshold, int in_range_threshold,
155                 bt_rssi_monitor_enabled_cb cb_enable, void *user_data_enable,
156                 bt_rssi_alert_cb cb_alert, void *user_data_alert);
157
158 /**
159  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
160  * @brief Disables RSSI monitoring for LE/ACL link present with the remote device.
161  * @since_tizen 2.3
162  * @privlevel platform
163  * @privilege %http://tizen.org/privilege/bluetooth.admin
164  *
165  * @param[in] remote_address The address of the remote Bluetooth device for which RSSI monitoring is to be disabled
166  * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
167  * @param[in] cb_disable Callback to be called when RSSI monitoring is disabled.
168  * @param[in] user_data_enable Data to be passed to RSSI enable callback.
169  *
170  * @return 0 on success, otherwise a negative error value.
171  * @retval #BT_ERROR_NONE  Successful
172  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
173  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
174  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
175  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
176  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
177  *
178  * @remarks Low Threshold, In-range Threshold and High Threshold value are set to 0 to disable RSSI monitoring.
179  * @remarks This also calls bt_device_unset_rssi_alert_cb()
180  *
181  * @see bt_device_unset_rssi_alert_cb()
182  * @see bt_device_enable_rssi_monitor()
183  */
184 int bt_device_disable_rssi_monitor(const char *remote_address,
185                 bt_device_connection_link_type_e link_type,
186                 bt_rssi_monitor_enabled_cb cb_disable, void *user_data_disable);
187
188 /**
189  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
190  * @brief Get Raw RSSI for LE link present with the remote device.
191  * @since_tizen 2.3
192  * @privlevel platform
193  * @privilege %http://tizen.org/privilege/bluetooth.admin
194  *
195  * @param[in] remote_address The address of the remote Bluetooth device for which RSSI is to be monitored
196  * @param[in] link_type Link type for the connection (@c 0 = BR/EDR link, @c 1 = LE link).
197  * @param[in] callback Callback to receive Raw RSSI values.
198  * @param[in] user_data Data to be passed to Raw RSSI callback.
199  *
200  * @return 0 on success, otherwise a negative error value.
201  * @retval #BT_ERROR_NONE  Successful
202  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
203  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
204  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
205  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
206  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
207  *
208  * @see bt_device_le_unset_rssi_strength_cb()
209  */
210 int bt_device_get_rssi_strength(const char *remote_address,
211                 bt_device_connection_link_type_e link_type,
212                 bt_rssi_strength_cb callback, void *user_data);
213
214 /**
215  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
216  * @brief Unset the callback to receive RSSI Alert values.
217  * @since_tizen 2.3
218  *
219  * @return 0 on success, otherwise a negative error value.
220  *
221  * @see bt_device_le_enable_rssi()
222  */
223 int bt_device_unset_rssi_alert_cb(void);
224
225 /**
226  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
227  * @brief Notifies the XSAT vendor command to the remote.
228  * @since_tizen 2.3
229  * @privlevel platform
230  * @privilege %http://tizen.org/privilege/bluetooth.admin
231  * @param[in] state  The XSAT vendor dependent command string. Ex: "AT+SAT= 00,TY,WA"
232  * @return 0 on success, otherwise a negative error value.
233  * @retval #BT_ERROR_NONE  Successful
234  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
235  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
236  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
237  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
238  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
239  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
240  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
241  * @see bt_audio_connect()
242  */
243 int bt_ag_notify_vendor_cmd(const char *command);
244
245 /**
246  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
247  * @brief  Registers a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free.
248  * @since_tizen 2.3
249  * @param[in] callback The callback function to register
250  * @param[in] user_data The user data to be passed to the callback function
251  * @return   0 on success, otherwise a negative error value.
252  * @retval #BT_ERROR_NONE  Successful
253  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
254  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
255  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
256  * @see bt_audio_initialize()
257  * @see bt_ag_vendor_cmd_cb()
258  * @see bt_ag_unset_vendor_cmd_cb()
259  */
260 int bt_ag_set_vendor_cmd_cb(bt_ag_vendor_cmd_cb callback, void *user_data);
261
262 /**
263  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
264  * @brief  Unregisters a callback function that will be invoked when a XSATvendor AT command is transmitted from Hands-Free
265  * @since_tizen 2.3
266  * @return   0 on success, otherwise a negative error value.
267  * @retval #BT_ERROR_NONE  Successful
268  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
269  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
270  * @see bt_audio_initialize()
271  * @see bt_ag_vendor_cmd_cb()
272  * @see bt_ag_set_vendor_cmd_cb()
273  */
274 int bt_ag_unset_vendor_cmd_cb(void);
275
276 /**
277  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
278  * @brief Checks whether the remoted device is wbs (Wide Band Speech) mode or not.
279  * @since_tizen 2.3
280  * @param[out] wbs_mode The wbs status: (@c true = wide band speech, @c  false = narrow band speech)
281  * @return   0 on success, otherwise a negative error value.
282  * @retval #BT_ERROR_NONE  Successful
283  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
284  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
285  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
286  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
287  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
288  * @see bt_audio_connect()
289  */
290 int bt_ag_is_wbs_mode(bool *wbs_mode);
291
292 /**
293  * @ingroup  CAPI_NETWORK_BLUETOOTH_AUDIO_A2DP_MODULE
294  * @brief  Sets copy protection. streaming application that needs to have the copy protection for the streaming data, shall invoke this API.
295  * @since_tizen 2.3
296  * @privlevel platform
297  * @privilege %http://tizen.org/privilege/bluetooth.admin
298  * @param[in] status - TRUE/FALSE
299  * @return  0 on success, otherwise negative error value.
300  * @retval  #BT_ERROR_NONE  Successful
301  * @retval  #BT_ERROR_OPERATION_FAILED  on failure
302  */
303 int bt_a2dp_set_content_protection(bool status);
304
305
306 /**
307  * @}
308  */
309
310
311 #ifdef __cplusplus
312 }
313 #endif /* __cplusplus */
314
315 #endif // __TIZEN_NETWORK_BLUETOOTH_PRODUCT_H__