1 /* 2 * Copyright (c) 2025-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 #ifndef AUDIO_WORKGROUP_IPC_H 16 #define AUDIO_WORKGROUP_IPC_H 17 18 #include <parcel.h> 19 20 namespace OHOS { 21 namespace AudioStandard { 22 23 struct AudioWorkgroupChangeInfo { 24 int32_t pid; 25 uint32_t groupId; 26 bool startAllowed; 27 }; 28 29 struct AudioWorkgroupChangeInfoIpc : public Parcelable { 30 AudioWorkgroupChangeInfo changeInfo; 31 MarshallingAudioWorkgroupChangeInfoIpc32 bool Marshalling(Parcel &parcel) const override 33 { 34 return parcel.WriteInt32(changeInfo.pid) && 35 parcel.WriteUint32(changeInfo.groupId) && 36 parcel.WriteBool(changeInfo.startAllowed); 37 } 38 UnmarshallingAudioWorkgroupChangeInfoIpc39 static AudioWorkgroupChangeInfoIpc *Unmarshalling(Parcel &parcel) 40 { 41 auto info = new(std::nothrow) AudioWorkgroupChangeInfoIpc(); 42 if (info == nullptr) { 43 return nullptr; 44 } 45 46 info->changeInfo.pid = parcel.ReadInt32(); 47 info->changeInfo.groupId = parcel.ReadUint32(); 48 info->changeInfo.startAllowed = parcel.ReadBool(); 49 return info; 50 } 51 }; 52 53 } // namespace AudioStandard 54 } // namespace OHOS 55 #endif // AUDIO_WORKGROUP_IPC_H