1 /* 2 * Copyright (c) 2021-2024 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_INTERFACE_H 17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_INTERFACE_H 18 19 #include "iremote_broker.h" 20 21 #include "badge_number_callback_data.h" 22 #include "enabled_notification_callback_data.h" 23 #include "notification.h" 24 #include "notification_constant.h" 25 #include "notification_do_not_disturb_date.h" 26 #include "notification_request.h" 27 #include "notification_sorting.h" 28 #include "notification_sorting_map.h" 29 #include "notification_operation_info.h" 30 31 namespace OHOS { 32 namespace Notification { 33 class AnsSubscriberInterface : public IRemoteBroker { 34 public: 35 AnsSubscriberInterface() = default; 36 virtual ~AnsSubscriberInterface() override = default; 37 DISALLOW_COPY_AND_MOVE(AnsSubscriberInterface); 38 39 DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Notification.AnsSubscriberInterface"); 40 41 /** 42 * @brief The callback function for the subscriber to establish a connection. 43 */ 44 virtual void OnConnected() = 0; 45 46 /** 47 * @brief The callback function for subscriber disconnected. 48 */ 49 virtual void OnDisconnected() = 0; 50 51 /** 52 * @brief The callback function on a notification published. 53 * 54 * @param notification Indicates the consumed notification. 55 * @param notificationMap Indicates the NotificationSortingMap object. 56 */ 57 virtual void OnConsumed( 58 const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap) = 0; 59 60 virtual void OnConsumedList( 61 const std::vector<sptr<Notification>> ¬ifications, const sptr<NotificationSortingMap> ¬ificationMap) = 0; 62 63 /** 64 * @brief The callback function on a notification canceled. 65 * 66 * @param notification Indicates the canceled notification. 67 * @param notificationMap Indicates the NotificationSortingMap object. 68 * @param deleteReason Indicates the delete reason. 69 */ 70 virtual void OnCanceled(const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap, 71 int32_t deleteReason) = 0; 72 73 virtual void OnCanceledList(const std::vector<sptr<Notification>> ¬ifications, 74 const sptr<NotificationSortingMap> ¬ificationMap, int32_t deleteReason) = 0; 75 76 /** 77 * @brief The callback function on the notifications updated. 78 * 79 * @param notificationMap Indicates the NotificationSortingMap object. 80 */ 81 virtual void OnUpdated(const sptr<NotificationSortingMap> ¬ificationMap) = 0; 82 83 /** 84 * @brief The callback function on the do not disturb date changed. 85 * 86 * @param date Indicates the NotificationDoNotDisturbDate object. 87 */ 88 virtual void OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) = 0; 89 90 /** 91 * @brief The callback function on the notification enabled flag changed. 92 * 93 * @param callbackData Indicates the EnabledNotificationCallbackData object. 94 */ 95 virtual void OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) = 0; 96 97 /** 98 * @brief The callback function on the badge number changed. 99 * 100 * @param badgeData Indicates the BadgeNumberCallbackData object. 101 */ 102 virtual void OnBadgeChanged(const sptr<BadgeNumberCallbackData> &badgeData) = 0; 103 104 /** 105 * @brief The callback function on the badge enabled state changed. 106 * 107 * @param callbackData Indicates the EnabledNotificationCallbackData object. 108 */ 109 virtual void OnBadgeEnabledChanged(const sptr<EnabledNotificationCallbackData> &callbackData) = 0; 110 111 virtual void OnApplicationInfoNeedChanged(const std::string& bundleName) = 0; 112 113 /** 114 * @brief The callback function on the response. 115 * 116 * @param notification Indicates the received Notification object. 117 */ 118 virtual ErrCode OnOperationResponse(const sptr<NotificationOperationInfo>& operationInfo) = 0; 119 }; 120 } // namespace Notification 121 } // namespace OHOS 122 123 #endif // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_INTERFACE_H 124