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 ******************************************************************************/ 37 uint8_t GAP_SetTraceLevel(uint8_t new_level) { 38 if (new_level != 0xFF) gap_cb.trace_level = new_level; 39 40 return (gap_cb.trace_level); 41 } 42 43 /******************************************************************************* 44 * 45 * Function GAP_Init 46 * 47 * Description Initializes the control blocks used by GAP. 48 * 49 * This routine should not be called except once per 50 * stack invocation. 51 * 52 * Returns Nothing 53 * 54 ******************************************************************************/ 55 void GAP_Init(void) { 56 memset(&gap_cb, 0, sizeof(tGAP_CB)); 57 58 #if defined(GAP_INITIAL_TRACE_LEVEL) 59 gap_cb.trace_level = GAP_INITIAL_TRACE_LEVEL; 60 #else 61 gap_cb.trace_level = BT_TRACE_LEVEL_NONE; /* No traces */ 62 #endif 63 64 #if (GAP_CONN_INCLUDED == TRUE) 65 gap_conn_init(); 66 #endif 67 68 gap_attr_db_init(); 69 } 70