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_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_LOCAL_LIVE_VIEW_STUB_H 17 #define BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_LOCAL_LIVE_VIEW_STUB_H 18 19 #include "ans_subscriber_local_live_view_interface.h" 20 #include "distributed_notification_service_ipc_interface_code.h" 21 #include "iremote_stub.h" 22 23 namespace OHOS { 24 namespace Notification { 25 class AnsSubscriberLocalLiveViewStub : public IRemoteStub<AnsSubscriberLocalLiveViewInterface> { 26 public: 27 AnsSubscriberLocalLiveViewStub(); 28 ~AnsSubscriberLocalLiveViewStub() override; 29 DISALLOW_COPY_AND_MOVE(AnsSubscriberLocalLiveViewStub); 30 31 /** 32 * @brief Handle remote request. 33 * 34 * @param data Indicates the input parcel. 35 * @param reply Indicates the output parcel. 36 * @param option Indicates the message option. 37 * @return Returns ERR_OK on success, others on failure. 38 */ 39 virtual int32_t OnRemoteRequest( 40 uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) override; 41 42 /** 43 * @brief The callback function for the subscriber to establish a connection. 44 */ 45 void OnConnected() override; 46 47 /** 48 * @brief The callback function for subscriber disconnected. 49 */ 50 void OnDisconnected() override; 51 52 void OnResponse(int32_t notificationId, sptr<NotificationButtonOption> buttonOption) override; 53 54 private: 55 56 ErrCode HandleOnConnected(MessageParcel &data, MessageParcel &reply); 57 ErrCode HandleOnDisconnected(MessageParcel &data, MessageParcel &reply); 58 ErrCode HandleOnResponse(MessageParcel &data, MessageParcel &reply); 59 60 template<typename T> 61 bool ReadParcelableVector(std::vector<sptr<T>> &parcelableInfos, MessageParcel &data); 62 }; 63 } // namespace Notification 64 } // namespace OHOS 65 66 #endif // BASE_NOTIFICATION_ANS_STANDARD_FRAMEWORKS_ANS_CORE_INCLUDE_ANS_SUBSCRIBER_LOCAL_LIVE_VIEW_STUB_H 67