1 /*
2  * Copyright (c) 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  */
15 
16 #ifndef OHOS_DP_IPC_SERIALIZATION_UTILS_H
17 #define OHOS_DP_IPC_SERIALIZATION_UTILS_H
18 
19 #include <string>
20 #include <vector>
21 #include <map>
22 #include "trust_device_profile.h"
23 #include "access_control_profile.h"
24 #include "accesser.h"
25 #include "accessee.h"
26 #include "device_profile.h"
27 #include "service_profile.h"
28 #include "characteristic_profile.h"
29 #include "distributed_device_profile_errors.h"
30 #include "distributed_device_profile_constants.h"
31 #include "distributed_device_profile_log.h"
32 #include "parcel.h"
33 #include "message_parcel.h"
34 #include "dp_subscribe_info.h"
35 
36 namespace OHOS {
37 namespace DistributedDeviceProfile {
38 class IpcUtils {
39 public:
40     static bool Marshalling(MessageParcel& parcel, const std::vector<TrustDeviceProfile>& trustDeviceProfiles);
41     static bool Marshalling(MessageParcel& parcel, const std::vector<AccessControlProfile>& aclProfiles);
42     static bool Marshalling(MessageParcel& parcel, const std::vector<ServiceProfile>& serviceProfiles);
43     static bool Marshalling(MessageParcel& parcel, const std::vector<CharacteristicProfile>& charProfiles);
44     static bool Marshalling(MessageParcel& parcel, const std::map<std::string, std::string>& params);
45     static bool Marshalling(MessageParcel& parcel, const std::map<std::string,
46         OHOS::DistributedDeviceProfile::SubscribeInfo>& listenerMap);
47     static bool Marshalling(MessageParcel& parcel, const std::unordered_set<ProfileChangeType>& changeTypes);
48     static bool UnMarshalling(MessageParcel& parcel, std::vector<TrustDeviceProfile>& trustDeviceProfiles);
49     static bool UnMarshalling(MessageParcel& parcel, std::vector<AccessControlProfile>& aclProfiles);
50     static bool UnMarshalling(MessageParcel& parcel, std::vector<ServiceProfile>& serviceProfiles);
51     static bool UnMarshalling(MessageParcel& parcel, std::vector<CharacteristicProfile>& charProfiles);
52     static bool UnMarshalling(MessageParcel& parcel, std::map<std::string, std::string>& params);
53     static bool UnMarshalling(MessageParcel& parcel, std::map<std::string,
54         OHOS::DistributedDeviceProfile::SubscribeInfo>& listenerMap);
55     static bool UnMarshalling(MessageParcel& parcel, std::unordered_set<ProfileChangeType>& changeTypes);
56 };
57 } // namespace DistributedDeviceProfile
58 } // namespace OHOS
59 #endif // OHOS_DP_IPC_SERIALIZATION_UTILS_H
60