1 /******************************************************************************
2  *
3  *  Copyright (C) 2009-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 #include <string.h>
20 
21 #include "bt_target.h"
22 #include "bt_utils.h"
23 #include "gap_int.h"
24 
25 tGAP_CB  gap_cb;
26 
27 /*******************************************************************************
28 **
29 ** Function         GAP_SetTraceLevel
30 **
31 ** Description      This function sets the trace level for GAP.  If called with
32 **                  a value of 0xFF, it simply returns the current trace level.
33 **
34 ** Returns          The new or current trace level
35 **
36 *******************************************************************************/
GAP_SetTraceLevel(UINT8 new_level)37 UINT8 GAP_SetTraceLevel (UINT8 new_level)
38 {
39     if (new_level != 0xFF)
40         gap_cb.trace_level = new_level;
41 
42     return (gap_cb.trace_level);
43 }
44 
45 /*******************************************************************************
46 **
47 ** Function         GAP_Init
48 **
49 ** Description      Initializes the control blocks used by GAP.
50 **
51 **                  This routine should not be called except once per
52 **                      stack invocation.
53 **
54 ** Returns          Nothing
55 **
56 *******************************************************************************/
GAP_Init(void)57 void GAP_Init(void)
58 {
59     memset (&gap_cb, 0, sizeof (tGAP_CB));
60 
61 #if defined(GAP_INITIAL_TRACE_LEVEL)
62     gap_cb.trace_level = GAP_INITIAL_TRACE_LEVEL;
63 #else
64     gap_cb.trace_level = BT_TRACE_LEVEL_NONE;    /* No traces */
65 #endif
66 
67 #if GAP_CONN_INCLUDED == TRUE
68     gap_conn_init();
69 #endif
70 
71 #if BLE_INCLUDED == TRUE
72     gap_attr_db_init();
73 #endif
74 }
75 
76