1 /* 2 * Copyright (C) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef TAG_INFO_H 16 #define TAG_INFO_H 17 #include "nfc_sdk_common.h" 18 #include "pac_map.h" 19 #include "parcel.h" 20 21 namespace OHOS { 22 namespace NFC { 23 namespace KITS { 24 class TagInfo { 25 public: 26 static const int MAX_TAG_TECH_NUM = 10; 27 static const int SEND_COMMAND_HEAD_LEN_2 = 2; 28 static const int SEND_COMMAND_MAX_LEN = 256; 29 30 // ISODEP 31 static constexpr const auto HISTORICAL_BYTES = "HistoricalBytes"; 32 static constexpr const auto HILAYER_RESPONSE = "HiLayerResponse"; 33 // iso 14443-3a 34 static constexpr const auto SAK = "Sak"; 35 static constexpr const auto ATQA = "Atqa"; 36 // iso 14443-3b 37 static constexpr const auto APP_DATA = "AppData"; 38 static constexpr const auto PROTOCOL_INFO = "ProtocolInfo"; 39 // NDEF 40 static constexpr const auto NDEF_MSG = "NdefMsg"; 41 static constexpr const auto NDEF_FORUM_TYPE = "NdefForumType"; 42 static constexpr const auto NDEF_TAG_LENGTH = "NdefTagLength"; 43 static constexpr const auto NDEF_TAG_MODE = "NdefTagMode"; 44 45 // MifareUltralight 46 static constexpr const auto MIFARE_ULTRALIGHT_C_TYPE = "MifareUltralightC"; 47 // Iso15693 48 static constexpr const auto RESPONSE_FLAGS = "ResponseFlags"; 49 static constexpr const auto DSF_ID = "DsfId"; 50 // NfcF, Feilica 51 static constexpr const auto NFCF_SC = "SystemCode"; 52 static constexpr const auto NFCF_PMM = "Pmm"; 53 54 public: 55 TagInfo(std::vector<int> tagTechList, 56 std::vector<AppExecFwk::PacMap> tagTechExtrasData, 57 std::string& tagUid, 58 int tagRfDiscId, 59 OHOS::sptr<IRemoteObject> tagServiceIface); 60 ~TagInfo(); 61 62 std::string GetTagUid() const; 63 std::vector<int> GetTagTechList() const; 64 65 AppExecFwk::PacMap GetTechExtrasByIndex(size_t techIndex); 66 AppExecFwk::PacMap GetTechExtrasByTech(KITS::TagTechnology tech); 67 std::string GetStringExtrasData(AppExecFwk::PacMap& extrasData, const std::string& extrasName); 68 int GetIntExtrasData(AppExecFwk::PacMap& extrasData, const std::string& extrasName); 69 bool GetBoolExtrasData(AppExecFwk::PacMap& extrasData, const std::string& extrasName); 70 71 bool IsTechSupported(KITS::TagTechnology tech); 72 int GetTagRfDiscId() const; 73 KITS::TagTechnology GetConnectedTagTech() const; 74 void SetConnectedTagTech(KITS::TagTechnology connectedTagTech); 75 static std::string GetStringTech(int tech); 76 private: 77 int tagRfDiscId_; 78 KITS::TagTechnology connectedTagTech_; 79 std::string tagUid_; 80 std::vector<int> tagTechList_; 81 std::vector<AppExecFwk::PacMap> tagTechExtrasData_; 82 }; 83 } // namespace KITS 84 } // namespace NFC 85 } // namespace OHOS 86 #endif // TAG_INFO_H 87