• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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_DP_DISTRIBUTED_DEVICE_PROFILE_STUB_H
17 #define OHOS_DP_DISTRIBUTED_DEVICE_PROFILE_STUB_H
18 
19 #include <map>
20 #include <unordered_set>
21 
22 #include "iremote_stub.h"
23 
24 #include "distributed_device_profile_errors.h"
25 #include "i_distributed_device_profile.h"
26 #include "ipc_utils.h"
27 
28 namespace OHOS {
29 namespace DistributedDeviceProfile {
30 class DistributedDeviceProfileStubNew : public IRemoteStub<IDistributedDeviceProfile> {
31 public:
32     DistributedDeviceProfileStubNew();
33     ~DistributedDeviceProfileStubNew();
34 
35     int32_t OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) override;
36 
37     int32_t PutAccessControlProfileInner(MessageParcel& data, MessageParcel& reply);
38     int32_t UpdateAccessControlProfileInner(MessageParcel& data, MessageParcel& reply);
39     int32_t GetTrustDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
40     int32_t GetAllTrustDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
41     int32_t GetAccessControlProfileInner(MessageParcel& data, MessageParcel& reply);
42     int32_t GetAllAccessControlProfileInner(MessageParcel& data, MessageParcel& reply);
43     int32_t GetAllAclIncludeLnnAclInner(MessageParcel& data, MessageParcel& reply);
44     int32_t DeleteAccessControlProfileInner(MessageParcel& data, MessageParcel& reply);
45     int32_t PutSessionKeyInner(MessageParcel& data, MessageParcel& reply);
46     int32_t GetSessionKeyInner(MessageParcel& data, MessageParcel& reply);
47     int32_t UpdateSessionKeyInner(MessageParcel& data, MessageParcel& reply);
48     int32_t PutDeviceProfileBatchInner(MessageParcel& data, MessageParcel& reply);
49     int32_t DeleteSessionKeyInner(MessageParcel& data, MessageParcel& reply);
50     int32_t PutServiceProfileInner(MessageParcel& data, MessageParcel& reply);
51     int32_t PutServiceProfileBatchInner(MessageParcel& data, MessageParcel& reply);
52     int32_t PutCharacteristicProfileInner(MessageParcel& data, MessageParcel& reply);
53     int32_t PutCharacteristicProfileBatchInner(MessageParcel& data, MessageParcel& reply);
54     int32_t GetDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
55     int32_t GetServiceProfileInner(MessageParcel& data, MessageParcel& reply);
56     int32_t GetCharacteristicProfileInner(MessageParcel& data, MessageParcel& reply);
57     int32_t DeleteServiceProfileInner(MessageParcel& data, MessageParcel& reply);
58     int32_t DeleteCharacteristicProfileInner(MessageParcel& data, MessageParcel& reply);
59     int32_t SubscribeDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
60     int32_t UnSubscribeDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
61     int32_t SyncDeviceProfileInner(MessageParcel& data, MessageParcel& reply);
62     int32_t SendSubscribeInfosInner(MessageParcel& data, MessageParcel& reply);
63     int32_t SubscribeDeviceProfileInitedInner(MessageParcel& data, MessageParcel& reply);
64     int32_t UnSubscribeDeviceProfileInitedInner(MessageParcel& data, MessageParcel& reply);
65     int32_t PutAllTrustedDevicesInner(MessageParcel& data, MessageParcel& reply);
66     int32_t PutLocalServiceInfoInner(MessageParcel& data, MessageParcel& reply);
67     int32_t UpdateLocalServiceInfoInner(MessageParcel& data, MessageParcel& reply);
68     int32_t GetLocalServiceInfoByBundleAndPinTypeInner(MessageParcel& data, MessageParcel& reply);
69     int32_t DeleteLocalServiceInfoInner(MessageParcel& data, MessageParcel& reply);
70     int32_t GetDeviceProfilesInner(MessageParcel& data, MessageParcel& reply);
71     int32_t DeleteDeviceProfileBatchInner(MessageParcel& data, MessageParcel& reply);
72     int32_t PutProductInfoBatchInner(MessageParcel& data, MessageParcel& reply);
73     int32_t PutDeviceIconInfoBatchInner(MessageParcel& data, MessageParcel& reply);
74     int32_t GetDeviceIconInfosInner(MessageParcel& data, MessageParcel& reply);
75     int32_t PutServiceInfoProfileInner(MessageParcel& data, MessageParcel& reply);
76     int32_t DeleteServiceInfoProfileInner(MessageParcel& data, MessageParcel& reply);
77     int32_t UpdateServiceInfoProfileInner(MessageParcel& data, MessageParcel& reply);
78     int32_t GetServiceInfoProfileByUniqueKeyInner(MessageParcel& data, MessageParcel& reply);
79     int32_t GetServiceInfoProfileListByTokenIdInner(MessageParcel& data, MessageParcel& reply);
80     int32_t GetAllServiceInfoProfileListInner(MessageParcel& data, MessageParcel& reply);
81     int32_t GetServiceInfoProfileListByBundleNameInner(MessageParcel& data, MessageParcel& reply);
82     int32_t SubscribePinCodeInvalidInner(MessageParcel& data, MessageParcel& reply);
83     int32_t UnSubscribePinCodeInvalidInner(MessageParcel& data, MessageParcel& reply);
84     virtual void DelayUnloadTask() = 0;
85     virtual bool IsInited() = 0;
86     int32_t RegisterBusinessCallbackInner(MessageParcel& data, MessageParcel& reply);
87     int32_t UnRegisterBusinessCallbackInner(MessageParcel& data, MessageParcel& reply);
88     int32_t PutBusinessEventInner(MessageParcel& data, MessageParcel& reply);
89     int32_t GetBusinessEventInner(MessageParcel& data, MessageParcel& reply);
90 
91 private:
92     using Func = int32_t(DistributedDeviceProfileStubNew::*)(MessageParcel& data, MessageParcel& reply);
93     bool IsInterfaceTokenValid(MessageParcel& data);
94     void InitAclAndSubscribe();
95     int32_t NotifyEventInner(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option);
96     int32_t NotifyAclEventInner(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option);
97     int32_t NotifyProfileDataEventInner(uint32_t code, MessageParcel& data,
98         MessageParcel& reply, MessageOption& option);
99     int32_t NotifyLocalServiceEventInner(uint32_t code, MessageParcel& data, MessageParcel& reply,
100         MessageOption& option);
101 private:
102     std::unordered_set<uint32_t> aclAndSubscribeFuncs_;
103 };
104 } // namespace DeviceProfile
105 } // namespace OHOS
106 #endif // OHOS_DP_DISTRIBUTED_DEVICE_PROFILE_STUB_H
107