1 /* 2 * Copyright (c) 2021 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 BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_PROXY_H 17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_PROXY_H 18 19 #include "ans_subscriber_interface.h" 20 #include "iremote_proxy.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class AnsSubscriberProxy : public IRemoteProxy<AnsSubscriberInterface> { 25 public: 26 AnsSubscriberProxy() = delete; 27 explicit AnsSubscriberProxy(const sptr<IRemoteObject> &impl); 28 ~AnsSubscriberProxy() override; 29 DISALLOW_COPY_AND_MOVE(AnsSubscriberProxy); 30 31 /** 32 * @brief The callback function for the subscriber to establish a connection. 33 */ 34 void OnConnected() override; 35 36 /** 37 * @brief The callback function for subscriber disconnected. 38 */ 39 void OnDisconnected() override; 40 41 /** 42 * @brief The callback function on a notification published. 43 * 44 * @param notification Indicates the consumed notification. 45 */ 46 void OnConsumed(const sptr<Notification> ¬ification) override; 47 48 /** 49 * @brief The callback function on a notification published. 50 * 51 * @param notification Indicates the consumed notification. 52 * @param notificationMap Indicates the NotificationSortingMap object. 53 */ 54 void OnConsumed( 55 const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap) override; 56 57 /** 58 * @brief The callback function on a notification canceled. 59 * 60 * @param notification Indicates the canceled notification. 61 * @param notificationMap Indicates the NotificationSortingMap object. 62 * @param deleteReason Indicates the delete reason. 63 */ 64 void OnCanceled(const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap, 65 int32_t deleteReason) override; 66 67 /** 68 * @brief The callback function on the notifications updated. 69 * 70 * @param notificationMap Indicates the NotificationSortingMap object. 71 */ 72 void OnUpdated(const sptr<NotificationSortingMap> ¬ificationMap) override; 73 74 /** 75 * @brief The callback function on the do not disturb date changed. 76 * 77 * @param date Indicates the NotificationDoNotDisturbDate object. 78 */ 79 void OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) override; 80 81 /** 82 * @brief The callback function on the notification enabled flag changed. 83 * 84 * @param callbackData Indicates the EnabledNotificationCallbackData object. 85 */ 86 void OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) override; 87 88 private: 89 ErrCode InnerTransact(uint32_t code, MessageOption &flags, MessageParcel &data, MessageParcel &reply); 90 static inline BrokerDelegator<AnsSubscriberProxy> delegator_; 91 }; 92 } // namespace Notification 93 } // namespace OHOS 94 95 #endif // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_PROXY_H 96