/* * Copyright (c) 2019 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef NOTIFICATION_EX_MANAGER_H_ #define NOTIFICATION_EX_MANAGER_H_ #include #include #include #include "notification-ex/common.h" #include "notification-ex/abstract_item.h" #include "notification-ex/event_observer_interface.h" #include "notification-ex/event_sender_interface.h" #include "notification-ex/event_listener_interface.h" #ifndef EXPORT_API #define EXPORT_API __attribute__((visibility("default"))) #endif namespace notification { class EXPORT_API Manager : public IEventObserver { public: Manager(std::unique_ptr sender, std::unique_ptr listener, std::string receiver_group = ""); virtual ~Manager(); std::list> Get(std::string channel = ""); int Update(std::shared_ptr noti); int Delete(std::shared_ptr noti); int DeleteAll(); int DeleteByChannel(std::string channel); int Hide(std::shared_ptr noti); std::unique_ptr FindByRootID(std::string id); int SendEvent(const IEventInfo& info, std::shared_ptr noti); void OnEvent(const IEventInfo& info, std::list serialized) override; std::list OnRequest(const IEventInfo& info) override; int OnRequestNumber(const IEventInfo& info) override; void SendError(const IEventInfo& info, NotificationError error); int GetCount() const; static std::string GetPath(); protected: virtual void OnAdd(const IEventInfo& info, std::list> addedItem); virtual void OnUpdate(const IEventInfo& info, std::shared_ptr updatedItem); virtual void OnDelete(const IEventInfo& info, std::shared_ptr deletedItem); virtual void OnError(NotificationError error, int requestId); virtual std::list> OnRequestEvent( const IEventInfo& info); virtual int OnRequestNumberEvent(const IEventInfo& info); private: class Impl; std::unique_ptr impl_; }; } // namespace notification #endif // NOTIFICATION_EX_MANAGER_H_