• 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 "enabled_notification_callback_data.h"
22 #include "notification.h"
23 #include "notification_constant.h"
24 #include "notification_do_not_disturb_date.h"
25 #include "notification_request.h"
26 #include "notification_sorting.h"
27 #include "notification_sorting_map.h"
28 
29 namespace OHOS {
30 namespace Notification {
31 class AnsSubscriberInterface : public IRemoteBroker {
32 public:
33     AnsSubscriberInterface() = default;
34     virtual ~AnsSubscriberInterface() override = default;
35     DISALLOW_COPY_AND_MOVE(AnsSubscriberInterface);
36 
37     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Notification.AnsSubscriberInterface");
38 
39     /**
40      * @brief The callback function for the subscriber to establish a connection.
41      */
42     virtual void OnConnected() = 0;
43 
44     /**
45      * @brief The callback function for subscriber disconnected.
46      */
47     virtual void OnDisconnected() = 0;
48 
49     /**
50      * @brief The callback function on a notification published.
51      *
52      * @param notification Indicates the consumed notification.
53      */
54     virtual void OnConsumed(const sptr<Notification> &notification) = 0;
55 
56     /**
57      * @brief The callback function on a notification published.
58      *
59      * @param notification Indicates the consumed notification.
60      * @param notificationMap Indicates the NotificationSortingMap object.
61      */
62     virtual void OnConsumed(
63         const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap) = 0;
64 
65     /**
66      * @brief The callback function on a notification canceled.
67      *
68      * @param notification Indicates the canceled notification.
69      * @param notificationMap Indicates the NotificationSortingMap object.
70      * @param deleteReason Indicates the delete reason.
71      */
72     virtual void OnCanceled(const sptr<Notification> &notification, const sptr<NotificationSortingMap> &notificationMap,
73         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 protected:
97     enum TransactId : uint32_t {
98         ON_CONNECTED = FIRST_CALL_TRANSACTION,
99         ON_DISCONNECTED,
100         ON_CONSUMED,
101         ON_CONSUMED_MAP,
102         ON_CANCELED_MAP,
103         ON_UPDATED,
104         ON_DND_DATE_CHANGED,
105         ON_ENABLED_NOTIFICATION_CHANGED,
106     };
107 };
108 }  // namespace Notification
109 }  // namespace OHOS
110 
111 #endif  // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_INTERFACE_H
112