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
Marshalling(Parcel & parcel) const46 bool DmsDeviceInfo::Marshalling(Parcel& parcel) const
47 {
48 PARCEL_WRITE_HELPER_RET(parcel, String16, Str8ToStr16(networkId_), false);
49 PARCEL_WRITE_HELPER_RET(parcel, String16, Str8ToStr16(deviceName_), false);
50 PARCEL_WRITE_HELPER_RET(parcel, Int32, deviceType_, false);
51 PARCEL_WRITE_HELPER_RET(parcel, Int32, deviceState_, false);
52 return true;
53 }
54 } // namespace DistributedSchedule
55 } // namespace OHOS