1/****************************************************************************** 2 * 3 * Copyright (C) 1999-2012 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/****************************************************************************** 20 * Construct a buffer that contains multiple Type-Length-Value contents 21 * that is used by the HAL in a CORE_SET_CONFIG NCI command. 22 ******************************************************************************/ 23 24#pragma once 25#include "bt_types.h" 26#include <string> 27 28 29class StartupConfig 30{ 31public: 32 typedef std::basic_string<UINT8> uint8_string; 33 StartupConfig (); 34 35 36 /******************************************************************************* 37 ** 38 ** Function: initialize 39 ** 40 ** Description: Reset all member variables. 41 ** 42 ** Returns: None 43 ** 44 *******************************************************************************/ 45 void initialize (); 46 47 48 /******************************************************************************* 49 ** 50 ** Function: getInternalBuffer 51 ** 52 ** Description: Get the pointer to buffer that contains multiple 53 ** Type-Length-Value contents. 54 ** 55 ** Returns: Pointer to buffer. 56 ** 57 *******************************************************************************/ 58 const UINT8* getInternalBuffer (); 59 60 61 /******************************************************************************* 62 ** 63 ** Function: append 64 ** 65 ** Description: Append new config data to internal buffer. 66 ** newContent: buffer containing new content; newContent[0] is 67 ** payload length; newContent[1..end] is payload. 68 ** 69 ** Returns: True if ok. 70 ** 71 *******************************************************************************/ 72 bool append (const UINT8* newContent); 73 74 75 /******************************************************************************* 76 ** 77 ** Function: append 78 ** 79 ** Description: Append new config data to internal buffer. 80 ** newContent: buffer containing new content; newContent[0] is 81 ** payload length; newContent[1..end] is payload. 82 ** newContentLen: total length of newContent. 83 ** 84 ** Returns: True if ok. 85 ** 86 *******************************************************************************/ 87 bool append (const UINT8* newContent, UINT8 newContentLen); 88 89 90 /******************************************************************************* 91 ** 92 ** Function: disableSecureElement 93 ** 94 ** Description: Adjust a TLV to disable secure element(s). The TLV's type is 0xC2. 95 ** bitmask: 0xC0 = do not detect any secure element. 96 ** 0x40 = do not detect secure element in slot 0. 97 ** 0x80 = do not detect secure element in slot 1. 98 ** 99 ** Returns: True if ok. 100 ** 101 *******************************************************************************/ 102 bool disableSecureElement (UINT8 bitmask); 103 104private: 105 static const UINT8 mMaxLength; 106 uint8_string mBuffer; 107}; 108