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_SESSION_PROXY_H 16 #define TAG_SESSION_PROXY_H 17 18 #include "element_name.h" 19 #include "iforeground_callback.h" 20 #include "ireader_mode_callback.h" 21 #include "iremote_proxy.h" 22 #include "itag_session.h" 23 #include "nfc_basic_proxy.h" 24 25 namespace OHOS { 26 namespace NFC { 27 namespace TAG { 28 using OHOS::AppExecFwk::ElementName; 29 class TagSessionProxy final : public OHOS::IRemoteProxy<ITagSession>, public NfcBasicProxy { 30 public: TagSessionProxy(const OHOS::sptr<OHOS::IRemoteObject> & remote)31 explicit TagSessionProxy(const OHOS::sptr<OHOS::IRemoteObject>& remote) 32 : OHOS::IRemoteProxy<ITagSession>(remote), NfcBasicProxy(remote) 33 { 34 } ~TagSessionProxy()35 ~TagSessionProxy() override {} 36 37 int Connect(int tagRfDiscId, int technology) override; 38 int IsConnected(int tagRfDiscId, bool &isConnected) override; 39 int Reconnect(int tagRfDiscId) override; 40 void Disconnect(int tagRfDiscId) override; 41 int GetMaxTransceiveLength(int technology, int &maxSize) override; 42 int SetTimeout(int tagRfDiscId, int timeout, int technology) override; 43 int GetTimeout(int tagRfDiscId, int technology, int &timeout) override; 44 void ResetTimeout(int tagRfDiscId) override; 45 int SendRawFrame(const int tagRfDiscId, std::string hexCmdData, bool raw, std::string &hexRespData) override; 46 47 std::vector<int> GetTechList(int tagRfDiscId) override; 48 bool IsTagFieldOn(int tagRfDiscId) override; 49 bool IsNdef(int tagRfDiscId) override; 50 int NdefRead(int tagRfDiscId, std::string &ndefMessage) override; 51 int NdefWrite(int tagRfDiscId, std::string msg) override; 52 int NdefMakeReadOnly(int tagRfDiscId) override; 53 int FormatNdef(int tagRfDiscId, const std::string& key) override; 54 int CanMakeReadOnly(int ndefType, bool &canSetReadOnly) override; 55 int IsSupportedApdusExtended(bool &isSupported) override; 56 int RegForegroundDispatch(ElementName &element, std::vector<uint32_t> &discTech, 57 const sptr<KITS::IForegroundCallback> &callback) override; 58 int UnregForegroundDispatch(ElementName &element) override; 59 int RegReaderMode(ElementName &element, std::vector<uint32_t> &discTech, 60 const sptr<KITS::IReaderModeCallback> &callback) override; 61 int UnregReaderMode(ElementName &element) override; 62 }; 63 } // namespace TAG 64 } // namespace NFC 65 } // namespace OHOS 66 #endif // TAG_SESSION_PROXY_H 67