• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 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 
16 #ifndef OHOS_DM_IPC_MODEL_CODEC_H
17 #define OHOS_DM_IPC_MODEL_CODEC_H
18 
19 #include "dm_device_info.h"
20 #include "dm_device_profile_info.h"
21 #include "message_parcel.h"
22 
23 namespace OHOS {
24 namespace DistributedHardware {
25 class IpcModelCodec {
26 public:
27     static void DecodeDmDeviceBasicInfo(MessageParcel &parcel, DmDeviceBasicInfo &devInfo);
28     static bool EncodePeerTargetId(const PeerTargetId &targetId, MessageParcel &parcel);
29     static void DecodePeerTargetId(MessageParcel &parcel, PeerTargetId &targetId);
30     static bool EncodeDmAccessCaller(const DmAccessCaller &caller, MessageParcel &parcel);
31     static bool EncodeDmAccessCallee(const DmAccessCallee &callee, MessageParcel &parcel);
32     static int32_t DecodeDmDeviceProfileInfoFilterOptions(MessageParcel &parcel,
33         DmDeviceProfileInfoFilterOptions &filterOptions);
34     static bool EncodeDmDeviceProfileInfoFilterOptions(const DmDeviceProfileInfoFilterOptions &filterOptions,
35         MessageParcel &parcel);
36     static void DecodeDmServiceProfileInfo(MessageParcel &parcel, DmServiceProfileInfo &svrInfo);
37     static void DecodeDmServiceProfileInfos(MessageParcel &parcel, std::vector<DmServiceProfileInfo> &svrInfos);
38     static void DecodeDmDeviceProfileInfo(MessageParcel &parcel, DmDeviceProfileInfo &devInfo);
39     static bool EncodeDmServiceProfileInfo(const DmServiceProfileInfo &svrInfo, MessageParcel &parcel);
40     static bool EncodeDmServiceProfileInfos(const std::vector<DmServiceProfileInfo> &svrInfos, MessageParcel &parcel);
41     static bool EncodeDmDeviceProfileInfo(const DmDeviceProfileInfo &devInfo, MessageParcel &parcel);
42     static std::string GetDeviceIconInfoUniqueKey(const DmDeviceIconInfoFilterOptions &iconFiter);
43     static std::string GetDeviceIconInfoUniqueKey(const DmDeviceIconInfo &iconInfo);
44     static void DecodeDmDeviceIconInfo(MessageParcel &parcel, DmDeviceIconInfo &deviceIconInfo);
45     static bool EncodeDmDeviceIconInfo(const DmDeviceIconInfo &deviceIconInfo, MessageParcel &parcel);
46     static void DecodeDmDeviceIconInfoFilterOptions(MessageParcel &parcel,
47         DmDeviceIconInfoFilterOptions &filterOptions);
48     static bool EncodeDmDeviceIconInfoFilterOptions(const DmDeviceIconInfoFilterOptions &filterOptions,
49         MessageParcel &parcel);
50     static void DecodeDmDeviceInfo(MessageParcel &parcel, DmDeviceInfo &devInfo);
51     static bool EncodeLocalServiceInfo(const DMLocalServiceInfo &serviceInfo, MessageParcel &parcel);
52     static bool EncodeLocalServiceInfos(const std::vector<DMLocalServiceInfo> &serviceInfos, MessageParcel &parcel);
53     static bool DecodeLocalServiceInfo(MessageParcel &parcel, DMLocalServiceInfo &serviceInfo);
54     static bool DecodeLocalServiceInfos(MessageParcel &parcel, std::vector<DMLocalServiceInfo> &serviceInfos);
55     static bool EncodeNetworkIdQueryFilter(const NetworkIdQueryFilter &queryFilter, MessageParcel &parcel);
56     static bool DecodeNetworkIdQueryFilter(MessageParcel &parcel, NetworkIdQueryFilter &queryFilter);
57     static bool EncodeStringVector(const std::vector<std::string> &vec, MessageParcel &parcel);
58     static bool DecodeStringVector(MessageParcel &parcel, std::vector<std::string> &vec);
59 };
60 } // namespace DistributedHardware
61 } // namespace OHOS
62 #endif // OHOS_DM_IPC_MODEL_CODEC_H
63