• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 WriteStreamCapability(MessageParcel &parcel, const StreamCapability &streamCapability);
32 StreamCapability ReadStreamCapability(MessageParcel &parcel);
33 
34 bool WriteMediaInfo(MessageParcel &parcel, const MediaInfo &mediaInfo);
35 std::unique_ptr<MediaInfo> ReadMediaInfo(MessageParcel &parcel);
36 
37 bool WriteMediaInfoHolder(MessageParcel &parcel, const MediaInfoHolder &mediaInfoHolder);
38 std::unique_ptr<MediaInfoHolder> ReadMediaInfoHolder(MessageParcel &parcel);
39 
40 bool WriteCastLocalDevice(Parcel &parcel, const CastLocalDevice &device);
41 std::unique_ptr<CastLocalDevice> ReadCastLocalDevice(Parcel &parcel);
42 
43 bool WriteCastSessionProperty(Parcel &parcel, const CastSessionProperty &property);
44 std::unique_ptr<CastSessionProperty> ReadCastSessionProperty(Parcel &parcel);
45 
46 bool WritePropertyContainer(Parcel &parcel, const PropertyContainer &device);
47 std::unique_ptr<PropertyContainer> ReadPropertyContainer(Parcel &parcel);
48 
49 bool WriteAuthInfo(Parcel &parcel, const AuthInfo &authInfo);
50 std::unique_ptr<AuthInfo> ReadAuthInfo(Parcel &parcel);
51 
52 bool WriteRemoteControlEvent(Parcel &parcel, const OHRemoteControlEvent &event);
53 std::unique_ptr<OHRemoteControlEvent> ReadRemoteControlEvent(Parcel &parcel);
54 
55 bool WriteDeviceStateInfo(Parcel &parcel, const DeviceStateInfo &stateInfo);
56 std::unique_ptr<DeviceStateInfo> ReadDeviceStateInfo(Parcel &parcel);
57 
58 bool WriteEvent(Parcel &parcel, const EventId &eventId, const std::string &jsonParam);
59 bool ReadEvent(Parcel &parcel, int32_t &eventId, std::string &jsonParam);
60 
61 void SetDataCapacity(MessageParcel &parcel, const FileFdMap &fileList, uint32_t tokenSize);
62 bool WriteFileList(MessageParcel &parcel, const FileFdMap &fileList);
63 bool ReadFileList(MessageParcel &parcel, FileFdMap &fileList);
64 
65 bool WriteRcvFdFileMap(MessageParcel &parcel, const RcvFdFileMap &rcvFdFileMap);
66 bool ReadRcvFdFileMap(MessageParcel &parcel, RcvFdFileMap &rcvFdFileMap);
67 } // namespace CastEngine
68 } // namespace OHOS
69 
70 #endif
71