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   uint16_t 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 
47 } tSRVC_CLCB;
48 
49 /* service engine control block */
50 typedef struct {
51   tSRVC_CLCB clcb[SRVC_MAX_APPS]; /* connection link*/
52   tGATT_IF gatt_if;
53   bool enabled;
54 
55 } tSRVC_ENG_CB;
56 
57 /* Global GATT data */
58 extern tSRVC_ENG_CB srvc_eng_cb;
59 
60 tSRVC_CLCB* srvc_eng_find_clcb_by_conn_id(uint16_t conn_id);
61 
62 void srvc_eng_release_channel(uint16_t conn_id);
63 bool srvc_eng_request_channel(const RawAddress& remote_bda, uint8_t srvc_id);
64 #endif
65