• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2023 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 OHOS_DISTRIBUTED_DMS_DEVICE_INFO_H
17 #define OHOS_DISTRIBUTED_DMS_DEVICE_INFO_H
18 
19 #include <iosfwd>
20 #include <string>
21 
22 #include "parcel.h"
23 
24 #include "dms_constant.h"
25 
26 namespace OHOS {
27 namespace DistributedSchedule {
28 enum {
29     UNKNOWN_TYPE = 0x00,
30 };
31 
32 enum {
33     UNKNOWN_STATE = 0,
34     ONLINE = 1,
35     OFFLINE = 2,
36 };
37 
38 class DmsDeviceInfo : public Parcelable {
39 public:
40     DmsDeviceInfo(const std::string& deviceName, int32_t deviceType, const std::string& networkId,
41         int32_t deviceState = ONLINE, int32_t osType = Constants::OH_OS_TYPE, std::string osVersion = "")
deviceName_(deviceName)42         : deviceName_(deviceName), deviceType_(deviceType), networkId_(networkId), deviceState_(deviceState),
43         osType_(osType), osVersion_(osVersion) {}
44     ~DmsDeviceInfo() = default;
45 
46     const std::string& GetDeviceName() const;
47     const std::string& GetNetworkId() const;
48     int32_t GetDeviceType() const;
49     int32_t GetDeviceState() const;
50     int32_t GetDeviceOSType() const;
51     const std::string& GetGetDeviceOSVersion() const;
52     bool Marshalling(Parcel& parcel) const override;
53 
54 private:
55     std::string deviceName_;
56     int32_t deviceType_ = UNKNOWN_TYPE;
57     std::string networkId_;
58     int32_t deviceState_ = UNKNOWN_STATE;
59     int32_t osType_ = Constants::OH_OS_TYPE;
60     std::string osVersion_ = "";
61 };
62 } // namespace DistributedSchedule
63 } // namespace OHOS
64 
65 #endif /* OHOS_DISTRIBUTED_DMS_DEVICE_INFO_H */
66