1 /* 2 * Copyright 2022 NXP 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 #include <unordered_set> 19 #include <vector> 20 21 #include "nfa_api.h" 22 23 class NfcDta { 24 public: 25 /******************************************************************************* 26 ** 27 ** Function: getInstance 28 ** 29 ** Description: Get a reference to the singleton NfcDta object. 30 ** 31 ** Returns: Reference to NfcDta object. 32 ** 33 *******************************************************************************/ 34 static NfcDta& getInstance(); 35 36 /******************************************************************************* 37 ** 38 ** Function: setNfccConfigParams 39 ** 40 ** Description: Set NCI config params from nfc.configTLV System Property. 41 ** 42 ** Returns: None. 43 ** 44 *******************************************************************************/ 45 void setNfccConfigParams(); 46 47 private: 48 std::vector<uint8_t> mDefaultTlv; 49 std::unordered_set<uint8_t> mUpdatedParamIds; 50 51 /******************************************************************************* 52 ** 53 ** Function: NfcDta 54 ** 55 ** Description: Initialize member variables. 56 ** 57 ** Returns: None 58 ** 59 *******************************************************************************/ 60 NfcDta(); 61 62 /******************************************************************************* 63 ** 64 ** Function: parseConfigParams 65 ** 66 ** Description: Parse config TLV from the String 67 ** 68 ** Returns: uint8_t vector 69 ** 70 *******************************************************************************/ 71 std::vector<uint8_t> parseConfigParams(std::string configParams); 72 73 /******************************************************************************* 74 ** 75 ** Function: getNonupdatedConfigParamIds 76 ** 77 ** Description: Get config parameter Ids whose values are not modified. 78 ** 79 ** Returns: config Parameter ids vector. 80 ** 81 *******************************************************************************/ 82 std::vector<uint8_t> getNonupdatedConfigParamIds( 83 std::vector<uint8_t> configTlv); 84 85 /******************************************************************************* 86 ** 87 ** Function: getConfigParamValues 88 ** 89 ** Description: Read the current config parameter values. 90 ** 91 ** Returns: None. 92 ** 93 *******************************************************************************/ 94 tNFA_STATUS getConfigParamValues(std::vector<uint8_t> paramIds); 95 96 /******************************************************************************* 97 ** 98 ** Function: setConfigParams 99 ** 100 ** Description: Set config param with new value. 101 ** 102 ** Returns: NFA_STATUS_OK if success 103 ** 104 *******************************************************************************/ 105 tNFA_STATUS setConfigParams(std::vector<uint8_t> configTlv); 106 }; 107