2 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef NOTIFICATION_EX_MANAGER_H_
18 #define NOTIFICATION_EX_MANAGER_H_
24 #include "notification-ex/common.h"
25 #include "notification-ex/abstract_item.h"
26 #include "notification-ex/event_observer_interface.h"
27 #include "notification-ex/event_sender_interface.h"
28 #include "notification-ex/event_listener_interface.h"
31 #define EXPORT_API __attribute__((visibility("default")))
34 namespace notification {
36 class EXPORT_API Manager : public IEventObserver {
38 Manager(std::unique_ptr<IEventSender> sender,
39 std::unique_ptr<IEventListener> listener, std::string receiver_group = "");
42 std::list<std::unique_ptr<item::AbstractItem>> Get(std::string channel = "");
43 int Update(std::shared_ptr<item::AbstractItem> noti);
44 int Delete(std::shared_ptr<item::AbstractItem> noti);
46 int DeleteByChannel(std::string channel);
47 int Hide(std::shared_ptr<item::AbstractItem> noti);
48 std::unique_ptr<item::AbstractItem> FindByRootID(std::string id);
49 int SendEvent(const IEventInfo& info, std::shared_ptr<item::AbstractItem> noti);
50 void OnEvent(const IEventInfo& info,
51 std::list<tizen_base::Bundle> serialized) override;
52 std::list<tizen_base::Bundle> OnRequest(const IEventInfo& info) override;
53 int OnRequestNumber(const IEventInfo& info) override;
54 void SendError(const IEventInfo& info, NotificationError error);
56 static std::string GetPath();
59 virtual void OnAdd(const IEventInfo& info, std::list<std::shared_ptr<item::AbstractItem>> addedItem);
60 virtual void OnUpdate(const IEventInfo& info, std::shared_ptr<item::AbstractItem> updatedItem);
61 virtual void OnDelete(const IEventInfo& info, std::shared_ptr<item::AbstractItem> deletedItem);
62 virtual void OnError(NotificationError error, int requestId);
63 virtual std::list<std::shared_ptr<item::AbstractItem>> OnRequestEvent(
64 const IEventInfo& info);
65 virtual int OnRequestNumberEvent(const IEventInfo& info);
69 std::unique_ptr<Impl> impl_;
72 } // namespace notification
74 #endif // NOTIFICATION_EX_MANAGER_H_