/* * Copyright 2017 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include #include #include /* Configs from libnfc-nci.conf */ #define NAME_NFC_DEBUG_ENABLED "NFC_DEBUG_ENABLED" #define NAME_NFA_STORAGE "NFA_STORAGE" #define NAME_PRESERVE_STORAGE "PRESERVE_STORAGE" #define NAME_POLLING_TECH_MASK "POLLING_TECH_MASK" #define NAME_P2P_LISTEN_TECH_MASK "P2P_LISTEN_TECH_MASK" #define NAME_UICC_LISTEN_TECH_MASK "UICC_LISTEN_TECH_MASK" #define NAME_NFA_DM_CFG "NFA_DM_CFG" #define NAME_SCREEN_OFF_POWER_STATE "SCREEN_OFF_POWER_STATE" #define NAME_NFA_MAX_EE_SUPPORTED "NFA_MAX_EE_SUPPORTED" #define NAME_NFA_DM_DISC_DURATION_POLL "NFA_DM_DISC_DURATION_POLL" #define NAME_POLL_FREQUENCY "POLL_FREQUENCY" #define NAME_NFA_AID_BLOCK_ROUTE "NFA_AID_BLOCK_ROUTE" #define NAME_AID_FOR_EMPTY_SELECT "AID_FOR_EMPTY_SELECT" #define NAME_AID_MATCHING_MODE "AID_MATCHING_MODE" #define NAME_OFFHOST_AID_ROUTE_PWR_STATE "OFFHOST_AID_ROUTE_PWR_STATE" #define NAME_LEGACY_MIFARE_READER "LEGACY_MIFARE_READER" /* Configs from vendor interface */ #define NAME_NFA_POLL_BAIL_OUT_MODE "NFA_POLL_BAIL_OUT_MODE" #define NAME_PRESENCE_CHECK_ALGORITHM "PRESENCE_CHECK_ALGORITHM" #define NAME_NFA_PROPRIETARY_CFG "NFA_PROPRIETARY_CFG" #define NAME_DEFAULT_OFFHOST_ROUTE "DEFAULT_OFFHOST_ROUTE" #define NAME_OFFHOST_ROUTE_ESE "OFFHOST_ROUTE_ESE" #define NAME_OFFHOST_ROUTE_UICC "OFFHOST_ROUTE_UICC" #define NAME_DEFAULT_NFCF_ROUTE "DEFAULT_NFCF_ROUTE" #define NAME_DEFAULT_SYS_CODE "DEFAULT_SYS_CODE" #define NAME_DEFAULT_SYS_CODE_ROUTE "DEFAULT_SYS_CODE_ROUTE" #define NAME_DEFAULT_SYS_CODE_PWR_STATE "DEFAULT_SYS_CODE_PWR_STATE" #define NAME_DEFAULT_ROUTE "DEFAULT_ROUTE" #define NAME_OFF_HOST_ESE_PIPE_ID "OFF_HOST_ESE_PIPE_ID" #define NAME_OFF_HOST_SIM_PIPE_ID "OFF_HOST_SIM_PIPE_ID" #define NAME_ISO_DEP_MAX_TRANSCEIVE "ISO_DEP_MAX_TRANSCEIVE" #define NAME_DEVICE_HOST_WHITE_LIST "DEVICE_HOST_WHITE_LIST" #define NAME_DEFAULT_ISODEP_ROUTE "DEFAULT_ISODEP_ROUTE" class NfcConfig { public: static bool hasKey(const std::string& key); static std::string getString(const std::string& key); static std::string getString(const std::string& key, std::string default_value); static unsigned getUnsigned(const std::string& key); static unsigned getUnsigned(const std::string& key, unsigned default_value); static std::vector getBytes(const std::string& key); static void clear(); private: void loadConfig(); static NfcConfig& getInstance(); NfcConfig(); ConfigFile config_; };