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
16 #include "service_characteristic_profile.h"
17
18 #include <iosfwd>
19 #include <string>
20
21 #include "device_profile_log.h"
22 #include "parcel.h"
23 #include "parcel_helper.h"
24
25 namespace OHOS {
26 namespace DeviceProfile {
27 namespace {
28 const std::string TAG = "ServiceCharacteristicProfile";
29 }
30
SetServiceId(const std::string & serviceId)31 void ServiceCharacteristicProfile::SetServiceId(const std::string& serviceId)
32 {
33 serviceId_ = serviceId;
34 }
35
SetServiceType(const std::string & serviceType)36 void ServiceCharacteristicProfile::SetServiceType(const std::string& serviceType)
37 {
38 serviceType_ = serviceType;
39 }
40
SetServiceProfileJson(const std::string & profileJson)41 void ServiceCharacteristicProfile::SetServiceProfileJson(const std::string& profileJson)
42 {
43 serviceProfileJson_ = profileJson;
44 }
45
SetCharacteristicProfileJson(const std::string & profileJson)46 void ServiceCharacteristicProfile::SetCharacteristicProfileJson(const std::string& profileJson)
47 {
48 characteristicProfileJson_ = profileJson;
49 }
50
GetServiceId() const51 const std::string& ServiceCharacteristicProfile::GetServiceId() const
52 {
53 return serviceId_;
54 }
55
GetServiceType() const56 const std::string& ServiceCharacteristicProfile::GetServiceType() const
57 {
58 return serviceType_;
59 }
60
GetServiceProfileJson() const61 const std::string& ServiceCharacteristicProfile::GetServiceProfileJson() const
62 {
63 return serviceProfileJson_;
64 }
65
GetCharacteristicProfileJson() const66 const std::string& ServiceCharacteristicProfile::GetCharacteristicProfileJson() const
67 {
68 return characteristicProfileJson_;
69 }
70
Marshalling(Parcel & parcel) const71 bool ServiceCharacteristicProfile::Marshalling(Parcel& parcel) const
72 {
73 PARCEL_WRITE_HELPER_RET(parcel, String, serviceId_, false);
74 PARCEL_WRITE_HELPER_RET(parcel, String, serviceType_, false);
75 PARCEL_WRITE_HELPER_RET(parcel, String, characteristicProfileJson_, false);
76 PARCEL_WRITE_HELPER_RET(parcel, String, serviceProfileJson_, false);
77 return true;
78 }
79
Unmarshalling(Parcel & parcel)80 bool ServiceCharacteristicProfile::Unmarshalling(Parcel& parcel)
81 {
82 PARCEL_READ_HELPER_RET(parcel, String, serviceId_, false);
83 PARCEL_READ_HELPER_RET(parcel, String, serviceType_, false);
84 PARCEL_READ_HELPER_RET(parcel, String, characteristicProfileJson_, false);
85 PARCEL_READ_HELPER_RET(parcel, String, serviceProfileJson_, false);
86 return true;
87 }
88 } // namespace DeviceProfile
89 } // namespace OHOS
90