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_SUBSCRIBE_PROFILE_LISTENER_H
17 #define OHOS_DP_SUBSCRIBE_PROFILE_LISTENER_H
18 
19 #include "i_profile_change_listener.h"
20 #include "iremote_broker.h"
21 #include "iremote_proxy.h"
22 #include "refbase.h"
23 
24 namespace OHOS {
25 namespace DistributedDeviceProfile {
26 class ProfileListenerProxy : public IRemoteProxy<IProfileChangeListener> {
27 public:
ProfileListenerProxy(const sptr<IRemoteObject> & impl)28     explicit ProfileListenerProxy(const sptr<IRemoteObject>& impl)
29         : IRemoteProxy<IProfileChangeListener>(impl) {}
30     ~ProfileListenerProxy() = default;
31     int32_t OnTrustDeviceProfileAdd(const TrustDeviceProfile& profile) override;
32     int32_t OnTrustDeviceProfileDelete(const TrustDeviceProfile& profile) override;
33     int32_t OnTrustDeviceProfileUpdate(const TrustDeviceProfile& oldProfile,
34         const TrustDeviceProfile& newProfile) override;
35     int32_t OnDeviceProfileAdd(const DeviceProfile& profile) override;
36     int32_t OnDeviceProfileDelete(const DeviceProfile& profile) override;
37     int32_t OnDeviceProfileUpdate(const DeviceProfile& oldProfile, const DeviceProfile& newProfile) override;
38     int32_t OnServiceProfileAdd(const ServiceProfile& profile) override;
39     int32_t OnServiceProfileDelete(const ServiceProfile& profile) override;
40     int32_t OnServiceProfileUpdate(const ServiceProfile& oldProfile, const ServiceProfile& newProfile) override;
41     int32_t OnCharacteristicProfileAdd(const CharacteristicProfile& profile) override;
42     int32_t OnCharacteristicProfileDelete(const CharacteristicProfile& profile) override;
43     int32_t OnCharacteristicProfileUpdate(const CharacteristicProfile& oldProfile,
44         const CharacteristicProfile& newProfile) override;
45 
46 private:
47     static inline BrokerDelegator<ProfileListenerProxy> delegator_;
48 };
49 } // namespace DistributedDeviceProfile
50 } // namespace OHOS
51 #endif // OHOS_DP_SUBSCRIBE_PROFILE_LISTENER_H
52