1 /*
2  * Copyright (c) 2021 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 DEVICE_INFO_H
16 #define DEVICE_INFO_H
17 
18 #include <atomic>
19 #include <string>
20 
21 #include "device_manager.h"
22 #include "dm_device_info.h"
23 #include "ipc/i_daemon.h"
24 
25 namespace OHOS {
26 namespace Storage {
27 namespace DistributedFile {
28 class DeviceInfo final {
29 public:
30     DeviceInfo() = default;
31     ~DeviceInfo() = default;
32     explicit DeviceInfo(const DistributedHardware::DmDeviceInfo &nodeInfo);
33     DeviceInfo(const DeviceInfo &nodeInfo);
34     DeviceInfo &operator=(const DistributedHardware::DmDeviceInfo &nodeInfo);
35 
36     void SetCid(const std::string &cid);
37 
38     const std::string &GetCid() const;
39     const std::string &GetExtraData() const;
40     const std::string &GetDeviceId() const;
41 
42 private:
43     friend class DeviceManagerAgent;
44     std::atomic<bool> initCidFlag_ { false };
45     std::string cid_;
46     std::string udid_;
47     std::string extraData_;
48     std::string deviceId_;
49 };
50 } // namespace DistributedFile
51 } // namespace Storage
52 } // namespace OHOS
53 #endif // DEVICE_INFO_H