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