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