1 /*
2  * Copyright (c) 2022-2022 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 #ifndef LOG_TAG
16 #define LOG_TAG "VolumeGroupInfo"
17 #endif
18 
19 #include "audio_system_manager.h"
20 
21 namespace OHOS {
22 namespace AudioStandard {
VolumeGroupInfo(int32_t volumeGroupId,int32_t mappingId,std::string groupName,std::string networkId,ConnectType type)23 VolumeGroupInfo::VolumeGroupInfo(int32_t volumeGroupId, int32_t mappingId, std::string groupName, std::string networkId,
24     ConnectType type) : volumeGroupId_(volumeGroupId), mappingId_(mappingId), groupName_(groupName),
25     networkId_(networkId), connectType_(type)
26 {}
27 
VolumeGroupInfo()28 VolumeGroupInfo::VolumeGroupInfo()
29 {}
30 
~VolumeGroupInfo()31 VolumeGroupInfo::~VolumeGroupInfo()
32 {}
33 
Marshalling(Parcel & parcel) const34 bool VolumeGroupInfo::Marshalling(Parcel &parcel) const
35 {
36     parcel.WriteInt32(volumeGroupId_);
37     parcel.WriteInt32(mappingId_);
38     parcel.WriteString(groupName_);
39     parcel.WriteString(networkId_);
40     parcel.WriteInt32(connectType_);
41     return true;
42 }
43 
Unmarshalling(Parcel & in)44 sptr<VolumeGroupInfo> VolumeGroupInfo::Unmarshalling(Parcel &in)
45 {
46     sptr<VolumeGroupInfo> volumeGroupInfo = new(std::nothrow) VolumeGroupInfo();
47     if (volumeGroupInfo == nullptr) {
48         return nullptr;
49     }
50 
51     volumeGroupInfo->volumeGroupId_ = in.ReadInt32();
52     volumeGroupInfo->mappingId_ = in.ReadInt32();
53     volumeGroupInfo->groupName_ = in.ReadString();
54     volumeGroupInfo->networkId_ = in.ReadString();
55     volumeGroupInfo->connectType_ = static_cast<ConnectType>(in.ReadInt32());
56     return volumeGroupInfo;
57 }
58 } // namespace AudioStandard
59 } // namespace OHOS
60