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 #include "deviceManager/dms_device_info.h"
17
18 #include "parcel_helper.h"
19 #include "string_ex.h"
20
21 namespace OHOS {
22 namespace DistributedSchedule {
23 namespace {
24 const std::string TAG = "DmsDeviceInfo";
25 }
GetDeviceName() const26 const std::string& DmsDeviceInfo::GetDeviceName() const
27 {
28 return deviceName_;
29 }
30
GetNetworkId() const31 const std::string& DmsDeviceInfo::GetNetworkId() const
32 {
33 return networkId_;
34 }
35
GetDeviceType() const36 int32_t DmsDeviceInfo::GetDeviceType() const
37 {
38 return deviceType_;
39 }
40
GetDeviceState() const41 int32_t DmsDeviceInfo::GetDeviceState() const
42 {
43 return deviceState_;
44 }
45
GetDeviceOSType() const46 int32_t DmsDeviceInfo::GetDeviceOSType() const
47 {
48 return osType_;
49 }
50
GetGetDeviceOSVersion() const51 const std::string& DmsDeviceInfo::GetGetDeviceOSVersion() const
52 {
53 return osVersion_;
54 }
55
Marshalling(Parcel& parcel) const56 bool DmsDeviceInfo::Marshalling(Parcel& parcel) const
57 {
58 PARCEL_WRITE_HELPER_RET(parcel, String16, Str8ToStr16(networkId_), false);
59 PARCEL_WRITE_HELPER_RET(parcel, String16, Str8ToStr16(deviceName_), false);
60 PARCEL_WRITE_HELPER_RET(parcel, Int32, deviceType_, false);
61 PARCEL_WRITE_HELPER_RET(parcel, Int32, deviceState_, false);
62 PARCEL_WRITE_HELPER_RET(parcel, Int32, osType_, false);
63 PARCEL_WRITE_HELPER_RET(parcel, String16, Str8ToStr16(osVersion_), false);
64 return true;
65 }
66 } // namespace DistributedSchedule
67 } // namespace OHOS