• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
29 class StartupConfig
30 {
31 public:
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     **                  newContentLen: total length of newContent.
69     **
70     ** Returns:         True if ok.
71     **
72     *******************************************************************************/
73     bool append (const UINT8* newContent, UINT8 newContentLen);
74 
75 
76     /*******************************************************************************
77     **
78     ** Function:        disableSecureElement
79     **
80     ** Description:     Adjust a TLV to disable secure element(s).  The TLV's type is 0xC2.
81     **                  bitmask: 0xC0 = do not detect any secure element.
82     **                           0x40 = do not detect secure element in slot 0.
83     **                           0x80 = do not detect secure element in slot 1.
84     **
85     ** Returns:         True if ok.
86     **
87     *******************************************************************************/
88     bool disableSecureElement (UINT8 bitmask);
89 
90 private:
91     static const UINT8 mMaxLength;
92     uint8_string mBuffer;
93 };
94