1 /* 2 * Copyright (C) 2023-2023 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 * Description: supply a helper to write/read common cast engine structures through ipc 15 * Author: zhangge 16 * Create: 2022-06-15 17 */ 18 19 #ifndef CAST_ENGINE_COMMON_HELPER_H 20 #define CAST_ENGINE_COMMON_HELPER_H 21 22 #include "cast_engine_common.h" 23 #include "oh_remote_control_event.h" 24 25 namespace OHOS { 26 namespace CastEngine { 27 bool WriteCastRemoteDevice(Parcel &parcel, const CastRemoteDevice &device); 28 std::unique_ptr<CastRemoteDevice> ReadCastRemoteDevice(Parcel &parcel); 29 bool ReadCastRemoteDevice(Parcel &parcel, CastRemoteDevice &device); 30 31 bool WriteMediaInfo(MessageParcel &parcel, const MediaInfo &mediaInfo); 32 std::unique_ptr<MediaInfo> ReadMediaInfo(MessageParcel &parcel); 33 34 bool WriteMediaInfoHolder(MessageParcel &parcel, const MediaInfoHolder &mediaInfoHolder); 35 std::unique_ptr<MediaInfoHolder> ReadMediaInfoHolder(MessageParcel &parcel); 36 37 bool WriteCastLocalDevice(Parcel &parcel, const CastLocalDevice &device); 38 std::unique_ptr<CastLocalDevice> ReadCastLocalDevice(Parcel &parcel); 39 40 bool WriteCastSessionProperty(Parcel &parcel, const CastSessionProperty &property); 41 std::unique_ptr<CastSessionProperty> ReadCastSessionProperty(Parcel &parcel); 42 43 bool WritePropertyContainer(Parcel &parcel, const PropertyContainer &device); 44 std::unique_ptr<PropertyContainer> ReadPropertyContainer(Parcel &parcel); 45 46 bool WriteAuthInfo(Parcel &parcel, const AuthInfo &authInfo); 47 std::unique_ptr<AuthInfo> ReadAuthInfo(Parcel &parcel); 48 49 bool WriteRemoteControlEvent(Parcel &parcel, const OHRemoteControlEvent &event); 50 std::unique_ptr<OHRemoteControlEvent> ReadRemoteControlEvent(Parcel &parcel); 51 52 bool WriteDeviceStateInfo(Parcel &parcel, const DeviceStateInfo &stateInfo); 53 std::unique_ptr<DeviceStateInfo> ReadDeviceStateInfo(Parcel &parcel); 54 55 bool WriteEvent(Parcel &parcel, const EventId &eventId, const std::string &jsonParam); 56 bool ReadEvent(Parcel &parcel, int32_t &eventId, std::string &jsonParam); 57 58 void SetDataCapacity(MessageParcel &parcel, const FileFdMap &fileList, uint32_t tokenSize); 59 bool WriteFileList(MessageParcel &parcel, const FileFdMap &fileList); 60 bool ReadFileList(MessageParcel &parcel, FileFdMap &fileList); 61 62 bool WriteRcvFdFileMap(MessageParcel &parcel, const RcvFdFileMap &rcvFdFileMap); 63 bool ReadRcvFdFileMap(MessageParcel &parcel, RcvFdFileMap &rcvFdFileMap); 64 } // namespace CastEngine 65 } // namespace OHOS 66 67 #endif 68