• 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 
16 #ifndef SCAN_DEVICE_INFO_H
17 #define SCAN_DEVICE_INFO_H
18 #define TDD_ENABLE 1
19 
20 #include <map>
21 #include "parcel.h"
22 
23 namespace OHOS::Scan {
24 class ScanDeviceInfoTCP final : public Parcelable {
25 public:
26     explicit ScanDeviceInfoTCP();
27 
28     ScanDeviceInfoTCP(const ScanDeviceInfoTCP &right);
29 
30     ScanDeviceInfoTCP &operator=(const ScanDeviceInfoTCP &ScanDeviceInfoTCP);
31 
32     ~ScanDeviceInfoTCP() = default;
33 
34     void SetDeviceName(const std::string &deviceName_);
35     void SetUuid(const std::string &uuid_);
36     void SetModel(const std::string &model_);
37     void SetManufacturer(const std::string &manufacturer_);
38     void SetDeviceType(const std::string &deviceType_);
39     void SetPort(const std::string &port_);
40     void SetAddr(const std::string &addr_);
41     void SetButton(const std::string &button_);
42     void SetFeeder(const std::string &feeder_);
43     void SetDeviceState(const uint32_t &deviceState_);
44     void SetInfoType(const std::string &infoType_);
45 
46     [[nodiscard]] const std::string &GetDeviceName() const;
47     [[nodiscard]] const std::string &GetUuid() const;
48     [[nodiscard]] const std::string &GetModel() const;
49     [[nodiscard]] const std::string &GetManufacturer() const;
50     [[nodiscard]] const std::string &GetDeviceType() const;
51     [[nodiscard]] const std::string &GetPort() const;
52     [[nodiscard]] const std::string &GetAddr() const;
53     [[nodiscard]] const std::string &GetButton() const;
54     [[nodiscard]] const std::string &GetFeeder() const;
55     [[nodiscard]] const uint32_t &GetDeviceState() const;
56     [[nodiscard]] const std::string &GetInfoType() const;
57 
58     virtual bool Marshalling(Parcel &parcel) const override;
59 
60     static std::shared_ptr<ScanDeviceInfoTCP> Unmarshalling(Parcel &parcel);
61 
62 #ifndef TDD_ENABLE
63 private:
64 #endif
65     bool ReadFromParcel(Parcel &parcel);
66 
67 #ifndef TDD_ENABLE
68 private:
69 #endif
70     std::string deviceName;
71     std::string uuid;
72     std::string model;
73     std::string manufacturer;
74     std::string deviceType;
75     std::string port;
76     std::string addr;
77     std::string button;
78     std::string feeder;
79     uint32_t deviceState;
80 };
81 
82 class ScanDeviceInfo final : public Parcelable {
83 public:
84     explicit ScanDeviceInfo();
85 
86     ScanDeviceInfo(const ScanDeviceInfo &right);
87 
88     ScanDeviceInfo &operator=(const ScanDeviceInfo &ScanDeviceInfo);
89 
90     ~ScanDeviceInfo() = default;
91 
92     void SetDeviceId(const std::string &newDeviceId);
93     void SetManufacturer(const std::string &newManufacturer);
94     void SetModel(const std::string &newModel);
95     void SetDeviceType(const std::string &newDeviceType);
96     void SetDeviceState(const uint32_t &newDeviceState);
97     void Dump() const;
98     void SetDiscoverMode(const std::string &newDiscoverMode);
99     void SetSerialNumber(const std::string &newSerialNumber);
100     void SetDeviceName(const std::string &newDeviceName);
101     void SetUniqueId(const std::string &uniqueId);
102     void SetUuid(const std::string &uuid);
103     void SetDeviceAvailable(bool deviceAvailable);
104 
105     [[nodiscard]] const std::string &GetDeviceId() const;
106     [[nodiscard]] const std::string &GetManufacturer() const;
107     [[nodiscard]] const std::string &GetModel() const;
108     [[nodiscard]] const std::string &GetDeviceType() const;
109     [[nodiscard]] const uint32_t &GetDeviceState() const;
110     [[nodiscard]] const std::string &GetDiscoverMode() const;
111     [[nodiscard]] const std::string &GetSerialNumber() const;
112     [[nodiscard]] const std::string &GetDeviceName() const;
113     [[nodiscard]] const std::string &GetUniqueId() const;
114     [[nodiscard]] const std::string &GetUuid() const;
115     [[nodiscard]] bool GetDeviceAvailable() const;
116 
117     virtual bool Marshalling(Parcel &parcel) const override;
118 
119     static std::shared_ptr<ScanDeviceInfo> Unmarshalling(Parcel &parcel);
120 
121 #ifndef TDD_ENABLE
122 private:
123 #endif
124     bool ReadFromParcel(Parcel &parcel);
125 
126 #ifndef TDD_ENABLE
127 private:
128 #endif
129     std::string deviceId;
130     std::string manufacturer;
131     std::string model;
132     std::string deviceType;
133     uint32_t deviceState;
134     std::string discoverMode;
135     std::string serialNumber;
136     std::string deviceName;
137     std::string uniqueId;
138     std::string uuid;
139     bool deviceAvailable;
140 };
141 
142 class ScanDeviceInfoSync final : public Parcelable {
143 public:
144     explicit ScanDeviceInfoSync();
145 
146     ScanDeviceInfoSync(const ScanDeviceInfoSync &right);
147 
148     ScanDeviceInfoSync &operator=(const ScanDeviceInfoSync &ScanDeviceInfoSync);
149 
150     ~ScanDeviceInfoSync() = default;
151 
152     void SetDeviceId(const std::string &newDeviceId);
153     void SetDiscoverMode(const std::string &newDiscoverMode);
154     void SetSerialNumber(const std::string &newSerialNumber);
155     void SetSyncMode(const std::string &newSyncMode);
156     void SetDeviceState(const uint32_t &newDeviceState);
157     void SetOldDeviceId(const std::string &oldDeviceId);
158     void SetUniqueId(const std::string &uniqueId);
159 
160     [[nodiscard]] const std::string &GetDeviceId() const;
161     [[nodiscard]] const std::string &GetDiscoverMode() const;
162     [[nodiscard]] const std::string &GetSerialNumber() const;
163     [[nodiscard]] const std::string &GetSyncMode() const;
164     [[nodiscard]] const uint32_t &GetDeviceState() const;
165     [[nodiscard]] const std::string &GetOldDeviceId() const;
166     [[nodiscard]] const std::string &GetUniqueId() const;
167 
168     virtual bool Marshalling(Parcel &parcel) const override;
169 
170     static std::shared_ptr<ScanDeviceInfoSync> Unmarshalling(Parcel &parcel);
171 
172     void Dump() const;
173 #ifndef TDD_ENABLE
174 private:
175 #endif
176     void ReadFromParcel(Parcel &parcel);
177 
178 #ifndef TDD_ENABLE
179 private:
180 #endif
181     std::string deviceId;
182     std::string discoverMode;
183     std::string serialNumber;
184     std::string syncMode;
185     uint32_t deviceState;
186     std::string oldDeviceId;
187     std::string uniqueId;
188 };
189 
190 } // namespace OHOS::Scan
191 #endif // SCAN_DEVICE_INFO_H
192