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 
30 namespace OHOS {
31 namespace Notification {
32 class AnsSubscriberInterface : public IRemoteBroker {
33 public:
34     AnsSubscriberInterface() = default;
35     virtual ~AnsSubscriberInterface() override = default;
36     DISALLOW_COPY_AND_MOVE(AnsSubscriberInterface);
37 
38     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Notification.AnsSubscriberInterface");
39 
40     /**
41      * @brief The callback function for the subscriber to establish a connection.
42      */
43     virtual void OnConnected() = 0;
44 
45     /**
46      * @brief The callback function for subscriber disconnected.
47      */
48     virtual void OnDisconnected() = 0;
49 
50     /**
51      * @brief The callback function on a notification published.
52      *
53      * @param notification Indicates the consumed notification.
54      * @param notificationMap Indicates the NotificationSortingMap object.
55      */
56     virtual void OnConsumed(
57         const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap) = 0;
58 
59     virtual void OnConsumedList(
60         const std::vector<sptr<Notification>> &notifications, const sptr<NotificationSortingMap> &notificationMap) = 0;
61 
62     /**
63      * @brief The callback function on a notification canceled.
64      *
65      * @param notification Indicates the canceled notification.
66      * @param notificationMap Indicates the NotificationSortingMap object.
67      * @param deleteReason Indicates the delete reason.
68      */
69     virtual void OnCanceled(const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap,
70         int32_t deleteReason) = 0;
71 
72     virtual void OnCanceledList(const std::vector<sptr<Notification>> &notifications,
73         const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason) = 0;
74 
75     /**
76      * @brief The callback function on the notifications updated.
77      *
78      * @param notificationMap Indicates the NotificationSortingMap object.
79      */
80     virtual void OnUpdated(const sptr<NotificationSortingMap> &notificationMap) = 0;
81 
82     /**
83      * @brief The callback function on the do not disturb date changed.
84      *
85      * @param date Indicates the NotificationDoNotDisturbDate object.
86      */
87     virtual void OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) = 0;
88 
89     /**
90      * @brief The callback function on the notification enabled flag changed.
91      *
92      * @param callbackData Indicates the EnabledNotificationCallbackData object.
93      */
94     virtual void OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) = 0;
95 
96     /**
97      * @brief The callback function on the badge number changed.
98      *
99      * @param badgeData Indicates the BadgeNumberCallbackData object.
100      */
101     virtual void OnBadgeChanged(const sptr<BadgeNumberCallbackData> &badgeData) = 0;
102 
103     /**
104      * @brief The callback function on the badge enabled state changed.
105      *
106      * @param callbackData Indicates the EnabledNotificationCallbackData object.
107      */
108     virtual void OnBadgeEnabledChanged(const sptr<EnabledNotificationCallbackData> &callbackData) = 0;
109 };
110 }  // namespace Notification
111 }  // namespace OHOS
112 
113 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_INTERFACE_H
114