#include <dlog.h>
#include <stdio.h>
#include <stdlib.h>
+
#include <iostream>
#include <sstream>
#include <algorithm>
#include "debug.h"
#include "notification_ex_service.h"
-using namespace notification;
using namespace std;
+using namespace notification;
using namespace notification::item;
class DPMFacade {
- public:
- DPMFacade(unique_ptr<Reporter> reporter, unique_ptr<Manager> manager)
- : reporter_(move(reporter)), manager_(move(manager)) {
- DBManager::InitializeDB();
- DBManager::InitializeData();
- hide_map_ = DBManager::GetHideMap();
- }
-
- void DelegateReporterEvent(const IEventInfo& info, shared_ptr<item::AbstractItem> item) {
- reporter_->SendEvent(info, item);
- }
-
- void DelegateManagerEvent(const IEventInfo& info, shared_ptr<item::AbstractItem> noti) {
- manager_->SendEvent(info, noti);
- }
-
- unique_ptr<Reporter> reporter_;
- unique_ptr<Manager> manager_;
- map<string, string> hide_map_;
+ public:
+ DPMFacade(unique_ptr<Reporter> reporter, unique_ptr<Manager> manager)
+ : reporter_(move(reporter)), manager_(move(manager)) {
+ DBManager::InitializeDB();
+ DBManager::InitializeData();
+ hide_map_ = DBManager::GetHideMap();
+ }
+
+ void DelegateReporterEvent(const IEventInfo& info, shared_ptr<item::AbstractItem> item) {
+ reporter_->SendEvent(info, item);
+ }
+
+ void DelegateManagerEvent(const IEventInfo& info, shared_ptr<item::AbstractItem> noti) {
+ manager_->SendEvent(info, noti);
+ }
+
+ unique_ptr<Reporter> reporter_;
+ unique_ptr<Manager> manager_;
+ map<string, string> hide_map_;
};
static DPMFacade* facade_;
class DPMReporter : public Reporter {
protected:
-
void OnUpdate(const IEventInfo& info,
shared_ptr<item::AbstractItem> updatedItem) {
DBG("Update !!!");
} else {
SendError(info, static_cast<NotificationError>(ret));
}
-
}
void OnDelete(const IEventInfo& info,
} else {
SendError(info, static_cast<NotificationError>(ret));
}
-
}
void OnEvent(const IEventInfo& info,
LOGI("Event received (%d) !!", (int)info.GetEventType());
int type = info.GetEventType();
for (auto& i : noti_list) {
- switch(type) {
+ switch (type) {
case IEventInfo::EventType::Update:
OnUpdate(info, i);
break;
/* Check new hide app */
hide_list = noti->second;
for (auto& i : updated_hide_list) {
- if(hide_list.find(i + ";") == string::npos) {
+ if (hide_list.find(i + ";") == string::npos) {
string new_hide_list = hide_list + i + ";";
ret = DBManager::UpdateHideList(updatedItem, new_hide_list);
if (ret != ERROR_NONE)
}
}
- void OnAdd(const IEventInfo& info,
+ void OnAdd(const IEventInfo& info,
list<shared_ptr<item::AbstractItem>> addedItem) override {
DBG("Add !!!");
int ret;
} else {
DBG("SendError !!!");
SendError(info, static_cast<NotificationError>(ret));
-
}
}
} else {
SendError(info, static_cast<NotificationError>(ret));
}
-
}
list<shared_ptr<item::AbstractItem>> OnRequestEvent(const IEventInfo& info) override {
unique_ptr<Reporter>(
new DPMReporter(
unique_ptr<DBusSender>(new DBusSender(Manager::GetPath())),
- unique_ptr<DBusEventListener>(new DBusEventListener(Reporter::GetPath()))
- )
- ),
+ unique_ptr<DBusEventListener>(new DBusEventListener(Reporter::GetPath())))),
unique_ptr<Manager>(
new DPMManager(
unique_ptr<DBusSender>(new DBusSender(Reporter::GetPath())),
- unique_ptr<DBusEventListener>(new DBusEventListener(Manager::GetPath()))
- )
- )
- );
+ unique_ptr<DBusEventListener>(new DBusEventListener(Manager::GetPath())))));
return ERROR_NONE;
}