• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "device_profile_log.h"
19 #include "parcel_helper.h"
20 
21 namespace OHOS {
22 namespace DeviceProfile {
23 namespace {
24 const std::string TAG = "ServiceCharacteristicProfile";
25 }
26 
SetServiceId(const std::string & serviceId)27 void ServiceCharacteristicProfile::SetServiceId(const std::string& serviceId)
28 {
29     serviceId_ = serviceId;
30 }
31 
SetServiceType(const std::string & serviceType)32 void ServiceCharacteristicProfile::SetServiceType(const std::string& serviceType)
33 {
34     serviceType_ = serviceType;
35 }
36 
SetServiceProfileJson(const std::string & profileJson)37 void ServiceCharacteristicProfile::SetServiceProfileJson(const std::string& profileJson)
38 {
39     serviceProfileJson_ = profileJson;
40 }
41 
SetCharacteristicProfileJson(const std::string & profileJson)42 void ServiceCharacteristicProfile::SetCharacteristicProfileJson(const std::string& profileJson)
43 {
44     characteristicProfileJson_ = profileJson;
45 }
46 
GetServiceId() const47 const std::string& ServiceCharacteristicProfile::GetServiceId() const
48 {
49     return serviceId_;
50 }
51 
GetServiceType() const52 const std::string& ServiceCharacteristicProfile::GetServiceType() const
53 {
54     return serviceType_;
55 }
56 
GetServiceProfileJson() const57 const std::string& ServiceCharacteristicProfile::GetServiceProfileJson() const
58 {
59     return serviceProfileJson_;
60 }
61 
GetCharacteristicProfileJson() const62 const std::string& ServiceCharacteristicProfile::GetCharacteristicProfileJson() const
63 {
64     return characteristicProfileJson_;
65 }
66 
Marshalling(Parcel & parcel) const67 bool ServiceCharacteristicProfile::Marshalling(Parcel& parcel) const
68 {
69     PARCEL_WRITE_HELPER_RET(parcel, String, serviceId_, false);
70     PARCEL_WRITE_HELPER_RET(parcel, String, serviceType_, false);
71     PARCEL_WRITE_HELPER_RET(parcel, String, characteristicProfileJson_, false);
72     PARCEL_WRITE_HELPER_RET(parcel, String, serviceProfileJson_, false);
73     return true;
74 }
75 
Unmarshalling(Parcel & parcel)76 bool ServiceCharacteristicProfile::Unmarshalling(Parcel& parcel)
77 {
78     PARCEL_READ_HELPER_RET(parcel, String, serviceId_, false);
79     PARCEL_READ_HELPER_RET(parcel, String, serviceType_, false);
80     PARCEL_READ_HELPER_RET(parcel, String, characteristicProfileJson_, false);
81     PARCEL_READ_HELPER_RET(parcel, String, serviceProfileJson_, false);
82     return true;
83 }
84 } // namespace DeviceProfile
85 } // namespace OHOS
86