Home | History | Annotate | Download | only in utils
      1 /******************************************************************************
      2  *
      3  *  Copyright 2018 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 #include <phNxpEseFeatures.h>
     26 
     27 #define NAME_SE_DEBUG_ENABLED "SE_DEBUG_ENABLED"
     28 #define NAME_NXP_JCOPDL_AT_BOOT_ENABLE "NXP_JCOPDL_AT_BOOT_ENABLE"
     29 #define NAME_NXP_WTX_COUNT_VALUE "NXP_WTX_COUNT_VALUE"
     30 #define NAME_NXP_MAX_RSP_TIMEOUT "NXP_MAX_RSP_TIMEOUT"
     31 #define NAME_NXP_POWER_SCHEME "NXP_POWER_SCHEME"
     32 #define NAME_NXP_SOF_WRITE "NXP_SOF_WRITE"
     33 #define NAME_NXP_TP_MEASUREMENT "NXP_TP_MEASUREMENT"
     34 #define NAME_NXP_SPI_INTF_RST_ENABLE "NXP_SPI_INTF_RST_ENABLE"
     35 #define NAME_NXP_MAX_RNACK_RETRY "NXP_MAX_RNACK_RETRY"
     36 #define NAME_NXP_SPI_WRITE_TIMEOUT "NXP_SPI_WRITE_TIMEOUT"
     37 #define NAME_NXP_ESE_DEV_NODE "NXP_ESE_DEV_NODE"
     38 
     39 class EseConfig {
     40  public:
     41   static bool hasKey(const std::string& key);
     42   static std::string getString(const std::string& key);
     43   static std::string getString(const std::string& key,
     44                                std::string default_value);
     45   static unsigned getUnsigned(const std::string& key);
     46   static unsigned getUnsigned(const std::string& key, unsigned default_value);
     47   static std::vector<uint8_t> getBytes(const std::string& key);
     48   static void clear();
     49 
     50  private:
     51   static EseConfig& getInstance();
     52   EseConfig();
     53 
     54   ConfigFile config_;
     55 };
     56