• 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 BASIC_TAG_SESSION_H
16 #define BASIC_TAG_SESSION_H
17 
18 #include "itag_session.h"
19 #include "taginfo.h"
20 
21 namespace OHOS {
22 namespace NFC {
23 namespace KITS {
24 class BasicTagSession {
25 public:
26     explicit BasicTagSession(std::weak_ptr<TagInfo> tagInfo, KITS::TagTechnology technology);
~BasicTagSession()27     virtual ~BasicTagSession() {}
28 
29     int Connect();
30     bool IsConnected() const;
31     int Close();
32     int SetTimeout(int timeout);
33     int GetTimeout(int &timeout);
34     std::string GetTagUid();
35     int SendCommand(std::string& hexCmdData, bool raw, std::string &hexRespData);
36     int GetMaxSendCommandLength(int &maxSize) const;
37     std::weak_ptr<TagInfo> GetTagInfo() const;
38 
39 protected:
40     OHOS::sptr<TAG::ITagSession> GetTagSessionProxy() const;
41     int GetTagRfDiscId() const;
42     void SetConnectedTagTech(KITS::TagTechnology tech) const;
43     KITS::TagTechnology GetConnectedTagTech() const;
44 
45 private:
46     std::weak_ptr<TagInfo> tagInfo_;
47     KITS::TagTechnology tagTechnology_;
48     bool isConnected_;
49 };
50 }  // namespace KITS
51 }  // namespace NFC
52 }  // namespace OHOS
53 #endif  // BASIC_TAG_SESSION_H
54