1 /*
2  * Copyright (c) 2023 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_DIALOG_CALLBACK_INTERFACE_H
17 #define BASE_NOTIFICATION_ANS_DIALOG_CALLBACK_INTERFACE_H
18 
19 #include "iremote_broker.h"
20 
21 #include "nocopyable.h"
22 #include "parcel.h"
23 
24 namespace OHOS::Notification {
25 
26 enum class EnabledDialogStatus {
27     ALLOW_CLICKED,
28     DENY_CLICKED,
29     CRASHED
30 };
31 
32 class DialogStatusData : public Parcelable {
33 public:
DialogStatusData(EnabledDialogStatus status)34     explicit DialogStatusData(EnabledDialogStatus status): status_(static_cast<int32_t>(status)) {}
35 
36     bool Marshalling(Parcel &parcel) const override;
37     static DialogStatusData* Unmarshalling(Parcel &parcel);
38 
GetStatus()39     inline int32_t GetStatus() const { return status_; }
40 
41 private:
42     int32_t status_;
43 };
44 
45 class AnsDialogCallback : public IRemoteBroker {
46 public:
47     DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.Notification.AnsDialogCallback");
48 
49     AnsDialogCallback() = default;
50     ~AnsDialogCallback() override = default;
51     DISALLOW_COPY_AND_MOVE(AnsDialogCallback);
52 
53     virtual void OnDialogStatusChanged(const DialogStatusData& statusData) = 0;
54 
55     enum {
56         // ipc id for OnDialogStatusChanged
57         ON_DIALOG_STATUS_CHANGED = 1,
58     };
59 };
60 } // namespace OHOS::Notification
61 
62 #endif // BASE_NOTIFICATION_ANS_DIALOG_CALLBACK_INTERFACE_H
63