1 /* 2 * Copyright (c) 2021 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_STUB_H 17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_STUB_H 18 19 #include "ans_subscriber_interface.h" 20 #include "iremote_stub.h" 21 22 namespace OHOS { 23 namespace Notification { 24 class AnsSubscriberStub : public IRemoteStub<IAnsSubscriber> { 25 public: 26 AnsSubscriberStub(); 27 ~AnsSubscriberStub() override; 28 DISALLOW_COPY_AND_MOVE(AnsSubscriberStub); 29 30 virtual int OnRemoteRequest( 31 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 32 33 void OnConnected() override; 34 void OnDisconnected() override; 35 void OnConsumed(const sptr<Notification> ¬ification) override; 36 void OnConsumed( 37 const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap) override; 38 void OnCanceled(const sptr<Notification> ¬ification) override; 39 void OnCanceled(const sptr<Notification> ¬ification, const sptr<NotificationSortingMap> ¬ificationMap, 40 int deleteReason) override; 41 void OnUpdated(const sptr<NotificationSortingMap> ¬ificationMap) override; 42 void OnDoNotDisturbDateChange(const sptr<NotificationDoNotDisturbDate> &date) override; 43 void OnEnabledNotificationChanged(const sptr<EnabledNotificationCallbackData> &callbackData) override; 44 45 private: 46 std::map<uint32_t, std::function<ErrCode(MessageParcel &, MessageParcel &)>> interfaces_; 47 48 ErrCode HandleOnConnected(MessageParcel &data, MessageParcel &reply); 49 ErrCode HandleOnDisconnected(MessageParcel &data, MessageParcel &reply); 50 ErrCode HandleOnConsumed(MessageParcel &data, MessageParcel &reply); 51 ErrCode HandleOnConsumedMap(MessageParcel &data, MessageParcel &reply); 52 ErrCode HandleOnCanceled(MessageParcel &data, MessageParcel &reply); 53 ErrCode HandleOnCanceledMap(MessageParcel &data, MessageParcel &reply); 54 ErrCode HandleOnUpdated(MessageParcel &data, MessageParcel &reply); 55 ErrCode HandleOnDoNotDisturbDateChange(MessageParcel &data, MessageParcel &reply); 56 ErrCode HandleOnEnabledNotificationChanged(MessageParcel &data, MessageParcel &reply); 57 }; 58 } // namespace Notification 59 } // namespace OHOS 60 61 #endif // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_STUB_H 62