• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-2022 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     /**
60      * @brief The callback function on a notification canceled.
61      *
62      * @param notification Indicates the canceled notification.
63      * @param notificationMap Indicates the NotificationSortingMap object.
64      * @param deleteReason Indicates the delete reason.
65      */
66     virtual void OnCanceled(const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap,
67         int32_t deleteReason) = 0;
68 
69     virtual void OnCanceledList(const std::vector<sptr<Notification>> &notifications,
70         const sptr<NotificationSortingMap> &notificationMap, int32_t deleteReason) = 0;
71 
72     /**
73      * @brief The callback function on the notifications updated.
74      *
75      * @param notificationMap Indicates the NotificationSortingMap object.
76      */
77     virtual void OnUpdated(const sptr<NotificationSortingMap> &notificationMap) = 0;
78 
79     /**
80      * @brief The callback function on the do not disturb date changed.
81      *
82      * @param date Indicates the NotificationDoNotDisturbDate object.
83      */
84     virtual void OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) = 0;
85 
86     /**
87      * @brief The callback function on the notification enabled flag changed.
88      *
89      * @param callbackData Indicates the EnabledNotificationCallbackData object.
90      */
91     virtual void OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) = 0;
92 
93     /**
94      * @brief The callback function on the badge number changed.
95      *
96      * @param badgeData Indicates the BadgeNumberCallbackData object.
97      */
98     virtual void OnBadgeChanged(const sptr<BadgeNumberCallbackData> &badgeData) = 0;
99 };
100 }  // namespace Notification
101 }  // namespace OHOS
102 
103 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_INTERFACE_H
104