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