1 /*
2 * Copyright (c) 2025 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 "local_service_info.h"
17
18 #include "cJSON.h"
19
20 #include "macro_utils.h"
21
22 namespace OHOS {
23 namespace DistributedDeviceProfile {
24 namespace {
25 const std::string TAG = "LocalServiceInfo";
26 }
27
LocalServiceInfo()28 LocalServiceInfo::LocalServiceInfo()
29 {
30 }
31
~LocalServiceInfo()32 LocalServiceInfo::~LocalServiceInfo()
33 {
34 }
35
GetBundleName() const36 std::string LocalServiceInfo::GetBundleName() const
37 {
38 return bundleName_;
39 }
40
SetBundleName(const std::string & bundleName)41 void LocalServiceInfo::SetBundleName(const std::string& bundleName)
42 {
43 bundleName_ = bundleName;
44 }
45
GetAuthBoxType() const46 int32_t LocalServiceInfo::GetAuthBoxType() const
47 {
48 return authBoxType_;
49 }
50
SetAuthBoxType(const int32_t authBoxType)51 void LocalServiceInfo::SetAuthBoxType(const int32_t authBoxType)
52 {
53 authBoxType_ = authBoxType;
54 }
55
GetAuthType() const56 int32_t LocalServiceInfo::GetAuthType() const
57 {
58 return authType_;
59 }
60
SetAuthType(const int32_t authType)61 void LocalServiceInfo::SetAuthType(const int32_t authType)
62 {
63 authType_ = authType;
64 }
65
GetPinExchangeType() const66 int32_t LocalServiceInfo::GetPinExchangeType() const
67 {
68 return pinExchangeType_;
69 }
70
SetPinExchangeType(const int32_t pinExchangeType)71 void LocalServiceInfo::SetPinExchangeType(const int32_t pinExchangeType)
72 {
73 pinExchangeType_ = pinExchangeType;
74 }
75
GetPinCode() const76 std::string LocalServiceInfo::GetPinCode() const
77 {
78 return pinCode_;
79 }
80
SetPinCode(const std::string & pinCode)81 void LocalServiceInfo::SetPinCode(const std::string& pinCode)
82 {
83 pinCode_ = pinCode;
84 }
85
GetDescription() const86 std::string LocalServiceInfo::GetDescription() const
87 {
88 return description_;
89 }
90
SetDescription(const std::string & description)91 void LocalServiceInfo::SetDescription(const std::string& description)
92 {
93 description_ = description;
94 }
95
GetExtraInfo() const96 std::string LocalServiceInfo::GetExtraInfo() const
97 {
98 return extraInfo_;
99 }
100
SetExtraInfo(const std::string & extraInfo)101 void LocalServiceInfo::SetExtraInfo(const std::string& extraInfo)
102 {
103 extraInfo_ = extraInfo;
104 }
105
Marshalling(MessageParcel & parcel) const106 bool LocalServiceInfo::Marshalling(MessageParcel& parcel) const
107 {
108 WRITE_HELPER_RET(parcel, String, bundleName_, false);
109 WRITE_HELPER_RET(parcel, Int32, authBoxType_, false);
110 WRITE_HELPER_RET(parcel, Int32, authType_, false);
111 WRITE_HELPER_RET(parcel, Int32, pinExchangeType_, false);
112 WRITE_HELPER_RET(parcel, String, pinCode_, false);
113 WRITE_HELPER_RET(parcel, String, description_, false);
114 WRITE_HELPER_RET(parcel, String, extraInfo_, false);
115 return true;
116 }
117
UnMarshalling(MessageParcel & parcel)118 bool LocalServiceInfo::UnMarshalling(MessageParcel& parcel)
119 {
120 READ_HELPER_RET(parcel, String, bundleName_, false);
121 READ_HELPER_RET(parcel, Int32, authBoxType_, false);
122 READ_HELPER_RET(parcel, Int32, authType_, false);
123 READ_HELPER_RET(parcel, Int32, pinExchangeType_, false);
124 READ_HELPER_RET(parcel, String, pinCode_, false);
125 READ_HELPER_RET(parcel, String, description_, false);
126 READ_HELPER_RET(parcel, String, extraInfo_, false);
127 return true;
128 }
129
dump() const130 std::string LocalServiceInfo::dump() const
131 {
132 return "";
133 }
134 } // namespace DistributedDeviceProfile
135 } // namespace OHOS
136