1 /******************************************************************************
2  *
3  *  Copyright 1999-2013 Broadcom Corporation
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at:
8  *
9  *  http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  *
17  ******************************************************************************/
18 
19 #ifndef SRVC_ENG_INT_H
20 #define SRVC_ENG_INT_H
21 
22 #include "gatt_api.h"
23 #include "internal_include/bt_target.h"
24 #include "srvc_api.h"
25 #include "types/raw_address.h"
26 
27 #define SRVC_MAX_APPS GATT_MAX_APPS
28 
29 #define SRVC_ID_NONE 0
30 #define SRVC_ID_DIS 1
31 #define SRVC_ID_MAX SRVC_ID_DIS
32 
33 #define SRVC_ACT_IGNORE 0
34 #define SRVC_ACT_RSP 1
35 #define SRVC_ACT_PENDING 2
36 
37 typedef struct {
38   bool in_use;
39   tCONN_ID conn_id;
40   bool connected;
41   RawAddress bda;
42   uint32_t trans_id;
43   uint8_t cur_srvc_id;
44 
45   tDIS_VALUE dis_value;
46 } tSRVC_CLCB;
47 
48 /* service engine control block */
49 typedef struct {
50   tSRVC_CLCB clcb[SRVC_MAX_APPS]; /* connection link*/
51   tGATT_IF gatt_if;
52   bool enabled;
53 } tSRVC_ENG_CB;
54 
55 /* Global GATT data */
56 extern tSRVC_ENG_CB srvc_eng_cb;
57 
58 tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(tCONN_ID conn_id);
59 
60 void srvc_eng_release_channel(tCONN_ID conn_id);
61 bool srvc_eng_request_channel(const RawAddress& remote_bda, uint8_t srvc_id);
62 #endif
63