1 // Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 
7 //     http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 /*******************************************************************************
16  *
17  *  Filename:      btc/btc_profile_queue.h
18  *
19  *  Description:   Bluetooth remote device connection queuing
20  *
21  *******************************************************************************/
22 
23 #ifndef __BTC_PROFILE_QUEUE_H__
24 #define __BTC_PROFILE_QUEUE_H__
25 
26 #include "common/bt_defs.h"
27 #include "btc/btc_task.h"
28 
29 typedef enum {
30     BTC_PRF_QUE_CONNECT = 0,
31     BTC_PRF_QUE_ADVANCE
32 } btc_prf_que_act_t;
33 
34 typedef bt_status_t (*btc_connect_cb_t) (bt_bdaddr_t *bda, uint16_t uuid);
35 
36 typedef struct connect_node_t {
37     bt_bdaddr_t bda;
38     uint16_t uuid;
39     bool busy;
40     btc_connect_cb_t connect_cb;
41 } connect_node_t;
42 
43 /* btc_prf_que_args_t */
44 typedef union {
45     // BTC_PRF_QUE_CONNECT
46     connect_node_t connect_node;
47 } btc_prf_que_args_t;
48 
49 bt_status_t btc_queue_connect(uint16_t uuid, const bt_bdaddr_t *bda, btc_connect_cb_t connect_cb);
50 void btc_queue_advance(void);
51 bt_status_t btc_queue_connect_next(void);
52 void btc_queue_release(void);
53 
54 void btc_profile_queue_handler(btc_msg_t *msg);
55 #endif /* __BTC_PROFILE_QUEUE_H__ */
56