1 /******************************************************************************
2  *
3  *  Copyright 2018-2020 NXP
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 #pragma once
20 
21 #include <string>
22 #include <vector>
23 
24 #include <config.h>
25 
26 #ifndef __CONFIG_H
27 #define __CONFIG_H
28 
29 #define NAME_SE_DEBUG_ENABLED "SE_DEBUG_ENABLED"
30 #define NAME_NXP_JCOPDL_AT_BOOT_ENABLE "NXP_JCOPDL_AT_BOOT_ENABLE"
31 #define NAME_NXP_WTX_COUNT_VALUE "NXP_WTX_COUNT_VALUE"
32 #define NAME_NXP_MAX_RSP_TIMEOUT "NXP_MAX_RSP_TIMEOUT"
33 #define NAME_NXP_POWER_SCHEME "NXP_POWER_SCHEME"
34 #define NAME_NXP_SOF_WRITE "NXP_SOF_WRITE"
35 #define NAME_NXP_TP_MEASUREMENT "NXP_TP_MEASUREMENT"
36 #define NAME_NXP_SPI_INTF_RST_ENABLE "NXP_SPI_INTF_RST_ENABLE"
37 #define NAME_NXP_MAX_RNACK_RETRY "NXP_MAX_RNACK_RETRY"
38 #define NAME_NXP_SPI_WRITE_TIMEOUT "NXP_SPI_WRITE_TIMEOUT"
39 #define NAME_NXP_ESE_DEV_NODE "NXP_ESE_DEV_NODE"
40 #define NAME_NXP_VISO_DPD_ENABLED "NXP_VISO_DPD_ENABLED"
41 #define NAME_NXP_NAD_POLL_RETRY_TIME "NXP_NAD_POLL_RETRY_TIME"
42 #define NAME_RNACK_RETRY_DELAY "RNACK_RETRY_DELAY"
43 #define NAME_NXP_P61_JCOP_DEFAULT_INTERFACE "NXP_P61_JCOP_DEFAULT_INTERFACE"
44 #define NAME_NXP_ESE_IFSD_VALUE "NXP_ESE_IFSD_VALUE"
45 #define NAME_NXP_EUICC_IFSD_VALUE "NXP_EUICC_IFSD_VALUE"
46 #define NAME_NXP_P61_COLD_RESET_INTERFACE "NXP_P61_COLD_RESET_INTERFACE"
47 #define NAME_NXP_OS_VERSION "NXP_OS_VERSION"
48 #define NAME_NXP_WTX_NTF_COUNT "NXP_WTX_NTF_COUNT"
49 #define NAME_NXP_OSU_MAX_WTX_COUNT "NXP_OSU_MAX_WTX_COUNT"
50 #define NAME_NXP_TRANSPORT "NXP_TRANSPORT"
51 #endif
52 
53 class EseConfig {
54  public:
55   static bool hasKey(const std::string& key);
56   static std::string getString(const std::string& key);
57   static std::string getString(const std::string& key,
58                                std::string default_value);
59   static unsigned getUnsigned(const std::string& key);
60   static unsigned getUnsigned(const std::string& key, unsigned default_value);
61   static std::vector<uint8_t> getBytes(const std::string& key);
62   static void clear();
63 
64  private:
65   static EseConfig& getInstance();
66   EseConfig();
67 
68   ConfigFile config_;
69 };
70