CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
-PROJECT(notification C)
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(EXEC_PREFIX "\${prefix}")
-SET(LIBDIR ${LIB_INSTALL_DIR})
-SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
-
-#ADD_SUBDIRECTORY(test-app)
-
-SET(INIT-SRCS
- ./src/notification_init.c
-)
-
-INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/include)
-AUX_SOURCE_DIRECTORY(src SRCS)
-LIST(REMOVE_ITEM SRCS ${INIT-SRCS})
-
-INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED
- sqlite3
- vconf
- bundle
- dlog
- aul
- dbus-1
- capi-appfw-app-control
- capi-appfw-package-manager
- pkgmgr-info
- libtzplatform-config
- glib-2.0
- gio-2.0
- gio-unix-2.0
- iniparser
- security-manager
- libsmack
-)
-
-FOREACH(flag ${pkgs_CFLAGS})
- SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall")
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
-
-SET(CMAKE_SKIP_BUILD_RPATH TRUE)
-
-ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
-TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
-
-ADD_EXECUTABLE(notification_init ${INIT-SRCS})
-TARGET_LINK_LIBRARIES(notification_init ${pkgs_LDFLAGS} notification "-pie")
-
-CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
-INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
-INSTALL(FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
-INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/
- DESTINATION include/notification
- FILES_MATCHING
- PATTERN "*_private.h" EXCLUDE
- PATTERN "*_group.h" EXCLUDE
- PATTERN "*_debug.h" EXCLUDE
- PATTERN "*.h")
-
-INSTALL(FILES ${CMAKE_BINARY_DIR}/11_notification-add.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d/)
-INSTALL(TARGETS notification_init DESTINATION bin)
+ADD_SUBDIRECTORY(notification)
+ADD_SUBDIRECTORY(notification-ex)
+ADD_SUBDIRECTORY(unittest)
--- /dev/null
+<manifest>
+ <request>
+ <domain name="_"/>
+ </request>
+</manifest>
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(notification-ex CXX)
+
+SET(PREFIX "${CMAKE_INSTALL_PREFIX}")
+SET(EXEC_PREFIX "\${prefix}")
+SET(PROJECT_NAME "${PROJECT_NAME}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+SET(VERSION_MAJOR 1)
+SET(VERSION "${VERSION_MAJOR}.0.0")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(notification-ex REQUIRED
+ glib-2.0
+ bundle
+ dlog
+ capi-appfw-app-control
+)
+
+FOREACH(flag ${notification-ex_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline -std=c++11")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS}")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/../)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} SOURCES)
+ADD_LIBRARY (${PROJECT_NAME} SHARED ${SOURCES})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${VERSION_MAJOR})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${VERSION})
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${notification-ex_LDFLAGS} "-lpthread")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_NAME}.pc")
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR})
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/item.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/manager.h DESTINATION include/${PROJECT_NAME})
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/repoter.h DESTINATION include/${PROJECT_NAME})
+#INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/ DESTINATION include/${PROJECT_NAME}
+# FILES_MATCHING PATTERN "*.h")
--- /dev/null
+/*
+ * 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_ABSTRACT_ACTION_H_
+#define NOTIFICATION_EX_ABSTRACT_ACTION_H_
+
+#include <app_control.h>
+
+#include <memory>
+#include <string>
+
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+namespace item {
+
+class AbstractItem;
+
+class EXPORT_API AbstractAction {
+ public:
+ AbstractAction();
+ virtual ~AbstractAction();
+
+ virtual bool IsLocal() const = 0;
+ virtual void Execute(std::shared_ptr<AbstractItem> item) = 0;
+ virtual Bundle Serialize() = 0;
+ virtual void Deserialize(Bundle b) = 0;
+ virtual std::string GetExtra() const = 0;
+};
+
+} // namespace item
+} // namespace notification
+
+#endif // NOTIFICATION_EX_ABSTRACT_ACTION_H_
--- /dev/null
+/*
+ * 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_ABSTRACT_ITEM_H_
+#define NOTIFICATION_EX_ABSTRACT_ITEM_H_
+
+#include <time.h>
+
+#include <memory>
+#include <string>
+
+#include "notification-ex/abstract_action.h"
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+namespace item {
+
+class EXPORT_API Color {
+ public:
+ Color() {
+ a_ = 0;
+ r_ = 0;
+ g_ = 0;
+ b_ = 0;
+ }
+ Color(unsigned char a, unsigned char r, unsigned char g, unsigned char b)
+ : a_(a), r_(r), g_(g), b_(b) {
+ }
+ virtual ~Color();
+
+ unsigned char GetAVal() const {
+ return a_;
+ }
+ unsigned char GetRVal() const {
+ return r_;
+ }
+ unsigned char GetGVal() const {
+ return g_;
+ }
+ unsigned char GetBVal() const {
+ return b_;
+ }
+
+ private:
+ unsigned char a_;
+ unsigned char r_;
+ unsigned char g_;
+ unsigned char b_;
+}; // class Color
+
+class EXPORT_API Padding {
+ public:
+ Padding() {
+ left_ = 0;
+ top_ = 0;
+ right_ = 0;
+ bottom_ = 0;
+ }
+ Padding(int left, int top, int right, int bottom)
+ : left_(left), top_(top), right_(right), bottom_(bottom) {
+ }
+ virtual ~Padding();
+
+ int GeLeft() const {
+ return left_;
+ }
+ int GetTop() const {
+ return top_;
+ }
+ int GetRight() const {
+ return right_;
+ }
+ int GetBottom() const {
+ return bottom_;
+ }
+
+ private:
+ int left_;
+ int top_;
+ int right_;
+ int bottom_;
+}; // class Padding
+
+class EXPORT_API Geometry {
+ public:
+ Geometry() {
+ x_ = 0;
+ y_ = 0;
+ w_ = 0;
+ h_ = 0;
+ }
+ Geometry(int x, int y, int w, int h) : x_(x), y_(y), w_(w), h_(h) {
+ }
+ virtual ~Geometry();
+
+ int GetX() const {
+ return x_;
+ }
+ int GetY() const {
+ return y_;
+ }
+ int GetWidth() const {
+ return w_;
+ }
+ int GetHeight() const {
+ return h_;
+ }
+
+ private:
+ int x_;
+ int y_;
+ int w_;
+ int h_;
+}; // class Geometry
+
+class EXPORT_API Style {
+ public:
+ Style(Color color, Padding padding, Geometry geometry);
+ virtual ~Style();
+
+ Padding GetPadding() const;
+ Color GetColor() const;
+ Geometry GetGeometry() const;
+
+ private:
+ Color color_;
+ Padding padding_;
+ Geometry geometry_;
+}; // class Style
+
+class EXPORT_API LEDInfo {
+ public:
+ LEDInfo() {
+ Color(0, 0, 0, 0);
+ }
+ explicit LEDInfo(Color color);
+ virtual ~LEDInfo();
+
+ void SetOffPeriod(int ms);
+ void SetOnPeriod(int ms);
+ Color GetColor() const;
+
+ private:
+ Color color_;
+ int period_ = 0;
+}; // clss LEDInfo
+
+class EXPORT_API AbstractItem {
+ public:
+ enum Type {
+ Text,
+ Image,
+ Icon,
+ Button,
+ ChatMessage,
+ CheckBox,
+ IconText,
+ InputSelector,
+ Group,
+ Effect,
+ Progress,
+ Custom,
+ };
+
+ enum Policy {
+ OnBootClear,
+ SimMode,
+ };
+
+ public:
+ AbstractItem();
+ virtual ~AbstractItem();
+
+ virtual Bundle Serialize() = 0;
+ virtual void Deserialize(Bundle b) = 0;
+ virtual std::shared_ptr<AbstractItem> FindByID(std::string id) = 0;
+ std::string GetId() const;
+ void SetId(std::string id);
+ std::shared_ptr<AbstractAction> GetAction() const;
+ Style GetStyle() const;
+ Type GetType() const;
+ void SetVisible(bool visible);
+ void SetEnable(bool enable);
+ void AddReceiver(std::string receiver_group);
+ void RemoveReceiver(std::string receiver_group);
+ bool CanReceive(std::string id) const;
+ void SetPolicy(Policy policy);
+ int GetVersion() const;
+ void SetVersion(int ver);
+ int GetHideTime() const;
+ int GetDeleteTime() const;
+
+ private:
+ Style style_;
+}; // class AbstractItem
+
+} // namespace item
+} // namespace notification
+
+#endif // NOTIFICATION_EX_ABSTRACT_ITEM_H_
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <string>
+#include <memory>
+
+#include "notification-ex/action.h"
+#include "notification-ex/bundle.h"
+#include "notification-ex/exception.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NOTIFICATION_EX"
+
+namespace notification {
+namespace item {
+
+AppControlAction::AppControlAction(app_control_h control)
+ : control_(control) {
+}
+
+AppControlAction::~AppControlAction() {
+}
+
+ReplyAction::ReplyAction() {
+}
+
+ReplyAction::~ReplyAction() {
+}
+
+VisibilityAction::VisibilityAction() {
+}
+
+VisibilityAction::~VisibilityAction() {
+}
+
+
+} //namespace item
+} //namespace notification
--- /dev/null
+/*
+ * 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_ACTION_H_
+#define NOTIFICATION_EX_ACTION_H_
+
+#include <app_control.h>
+
+#include <memory>
+#include <string>
+
+#include "notification-ex/abstract_action.h"
+#include "notification-ex/bundle.h"
+
+namespace notification {
+namespace item {
+
+class EXPORT_API AppControlAction : public AbstractAction {
+ public:
+ explicit AppControlAction(app_control_h control);
+ virtual ~AppControlAction();
+
+ bool IsLocal() const override;
+ void Execute(std::shared_ptr<AbstractItem> item) override;
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ void SetAppControl(app_control_h control);
+ app_control_h GetAppControl() const;
+
+ private:
+ app_control_h control_ = nullptr;
+};
+
+class EXPORT_API ReplyAction : public AbstractAction {
+ public:
+ ReplyAction();
+ virtual ~ReplyAction();
+
+ bool IsLocal() const override;
+ void Execute(std::shared_ptr<AbstractItem> item) override;
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+};
+
+class EXPORT_API VisibilityAction : public AbstractAction {
+ public:
+ VisibilityAction();
+ virtual ~VisibilityAction();
+
+ bool IsLocal() const override;
+ void Execute(std::shared_ptr<AbstractItem> item) override;
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ void SetVisibility(std::string id, bool visible);
+
+ private:
+ std::string id_ = NULL;
+ bool visible_ = false;
+};
+
+} // namespace item
+} // namespace notification
+
+#endif // NOTIFICATION_EX_ACTION_H_
--- /dev/null
+/*
+ * 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.
+ */
+
+#include "notification-ex/bundle.h"
+#include "notification-ex/exception.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NOTIFICATION_EX"
+
+namespace notification {
+namespace item {
+
+Bundle::Bundle() {
+ raw_ = bundle_create();
+}
+
+const char* Bundle::ToString() {
+ int str_len = 0;
+ bundle_raw* temp;
+
+ if (str_raw_ != NULL)
+ return str_raw_;
+
+ bundle_encode(raw_, &temp, &str_len);
+
+ str_raw_ = reinterpret_cast<char*>(temp);
+ return str_raw_;
+}
+
+Bundle::~Bundle() {
+ if (raw_) {
+ bundle_free(raw_);
+ raw_ = NULL;
+ }
+ if (str_raw_) {
+ free(str_raw_);
+ str_raw_ = NULL;
+ }
+}
+
+} //namespace item
+} //namespace notification
--- /dev/null
+/*
+ * 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_BUNDLE_H_
+#define NOTIFICATION_EX_BUNDLE_H_
+
+#include <bundle.h>
+
+#include <string>
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+namespace item {
+
+class EXPORT_API Bundle {
+ public:
+ Bundle();
+ ~Bundle();
+ const char* ToString();
+
+ private:
+ bundle* raw_ = NULL;
+ char* str_raw_ = NULL;
+};
+
+} // namespace item
+} // namespace notification
+
+#endif // NOTIFICATION_EX_BUNDLE_H_
--- /dev/null
+/*
+ * 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_COMMON_H_
+#define NOTIFICATION_EX_COMMON_H_
+
+namespace notification {
+
+typedef enum _notification_error {
+ NOTIFICATION_ERROR_NONE = TIZEN_ERROR_NONE, /**< Success */
+ NOTIFICATION_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ NOTIFICATION_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ NOTIFICATION_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< I/O error */
+ NOTIFICATION_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
+ NOTIFICATION_ERROR_INVALID_OPERATION = TIZEN_ERROR_INVALID_OPERATION, /**< Function not implemented (@b Since: @if MOBILE 2.4 @elseif WEARABLE 3.0 @endif) */
+ NOTIFICATION_ERROR_FROM_DB = TIZEN_ERROR_NOTIFICATION | 0x01, /**< Error from DB query */
+ NOTIFICATION_ERROR_ALREADY_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x02, /**< Already exist private ID */
+ NOTIFICATION_ERROR_FROM_DBUS = TIZEN_ERROR_NOTIFICATION | 0x03, /**< Error from DBus */
+ NOTIFICATION_ERROR_NOT_EXIST_ID = TIZEN_ERROR_NOTIFICATION | 0x04, /**< Not exist private ID */
+ NOTIFICATION_ERROR_SERVICE_NOT_READY = TIZEN_ERROR_NOTIFICATION | 0x05, /**< No response from notification service */
+ NOTIFICATION_ERROR_MAX_EXCEEDED = TIZEN_ERROR_NOTIFICATION | 0x06, /**< Max notification count exceeded (@b Since: 3.0) */
+} notification_error_e;
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_COMMON_H_
+
--- /dev/null
+/*
+ * 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_DBUS_LISTENER_H_
+#define NOTIFICATION_EX_DBUS_LISTENER_H_
+
+#include "notification-ex/observer_interface.h"
+
+namespace notification {
+
+class EXPORT_API DBusEventsListener : public IEventListener {
+ public:
+ DBusEventsListener();
+ ~DBusEventsListener();
+
+ void RegisterObserver(IEventObserver observer) override;
+ void UnRegisterObserver(IEventObserver observer) override;
+ void NotifyAll() override;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_DBUS_LISTENER_H_
--- /dev/null
+/*
+ * 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_DBUS_MANAGER_H_
+#define NOTIFICATION_EX_DBUS_MANAGER_H_
+
+#include <string>
+
+namespace notification {
+
+class DBusConnectionManager {
+ public:
+ static DBusConnectionManager& GetInst();
+ GDbusConnection& GetConnection();
+
+ private:
+ DBusConnectionManager();
+ ~DBusConnectionManager();
+ GDbusConnection connection_;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_DBUS_MANAGER_H_
--- /dev/null
+/*
+ * 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_DBUS_SENDER_H_
+#define NOTIFICATION_EX_DBUS_SENDER_H_
+
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API DBusSender : public IEventsSender {
+ public:
+ DBusSender();
+ virtual ~DBusSender();
+
+ void Notify(Bundle serialized) override;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_DBUS_SENDER_H_
--- /dev/null
+/*
+ * 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_EVENT_INFO_H_
+#define NOTIFICATION_EX_EVENT_INFO_H_
+
+#include <string>
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API EventInfo {
+ public:
+ EventInfo();
+ ~EventInfo();
+
+ int GetEventType() const;
+ std::string GetOwner() const;
+ int GetChannel();
+
+ private:
+ int type_;
+ std::string owner_;
+ int channel_;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_EVENT_INFO_H_
--- /dev/null
+/*
+ * 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_EVENT_LISTENER_INTERFACE_H_
+#define NOTIFICATION_EX_EVENT_LISTENER_INTERFACE_H_
+
+#include "notification-ex/observer_interface.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API IEventsListener {
+ public:
+ virtual ~IEventsListener() = 0;
+
+ virtual void RegisterObserver(IEventObserver observer) = 0;
+ virtual void UnRegisterObserver(IEventObserver observer) = 0;
+ virtual void NotifyAll() = 0;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_EVENT_LISTENER_INTERFACE_H_
--- /dev/null
+/*
+ * 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_EVENT_SENDER_INTERFACE_H_
+#define NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
+
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API IEventsSender {
+ public:
+ virtual ~IEventsSender() = 0;
+
+ virtual void Notify(Bundle serialized) = 0;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_EVENT_SENDER_INTERFACE_H_
--- /dev/null
+/*
+ * 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_EXCEPTION_H_
+#define NOTIFICATION_EX_EXCEPTION_H_
+
+#include <string>
+#include <exception>
+
+#include "notification-ex/common.h"
+
+#define THROW(error_code) throw Exception(error_code, __FILE__, __LINE__)
+
+namespace notification {
+
+class Exception : public std::exception {
+ public:
+ explicit Exception(int error_code, std::string file = __FILE__,
+ int line = __LINE__ ) {
+ error_code_ = error_code;
+ message_ = file.substr(file.find_last_of("/") + 1) + ":"
+ + std::to_string(line) + GetErrorString(error_code);
+ }
+ virtual ~Exception() {}
+ virtual const char *what(void) const noexcept {
+ return message_.c_str();
+ }
+ int GetErrorCode() {
+ return error_code_;
+ }
+
+ private:
+ int error_code_;
+ std::string message_;
+ std::string GetErrorString(int error_code) {
+ switch (error_code) {
+ case NOTIFICATION_ERROR_INVALID_PARAMETER:
+ return ": INVALID_PARAMETER";
+ case NOTIFICATION_ERROR_OUT_OF_MEMORY:
+ return ": OUT_OF_MEMORY";
+ case NOTIFICATION_ERROR_IO_ERROR:
+ return ": IO_ERROR";
+ case NOTIFICATION_ERROR_PERMISSION_DENIED:
+ return ": PERMISSION_DENIED";
+ case NOTIFICATION_ERROR_INVALID_OPERATION:
+ return ": INVALID_OPERATION";
+ case NOTIFICATION_ERROR_FROM_DB:
+ return ": ERROR_FROM_DB";
+ case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
+ return ": ALREADY_EXIST_ID";
+ case NOTIFICATION_ERROR_FROM_DBUS:
+ return ": ERROR_FROM_DBUS";
+ case NOTIFICATION_ERROR_NOT_EXIST_ID:
+ return ": NOT_EXIST_ID";
+ case NOTIFICATION_ERROR_SERVICE_NOT_READY:
+ return ": SERVICE_NOT_READY";
+ case NOTIFICATION_ERROR_MAX_EXCEEDED:
+ return ": MAX_EXCEEDED";
+ default:
+ return "";
+ }
+ }
+}; // class Exception
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_EXCEPTION_H_
--- /dev/null
+/*
+ * 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.
+ */
+#include <dlog.h>
+#include <glib.h>
+#include <unistd.h>
+#include <stdexcept>
+
+#include "notification-ex/item.h"
+#include "notification-ex/bundle.h"
+#include "notification-ex/exception.h"
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#define LOG_TAG "NOTIFICATION_EX"
+
+namespace notification {
+namespace item {
+
+GroupItem::GroupItem() {
+}
+
+GroupItem:: ~GroupItem() {
+}
+
+TextItem::TextItem(std::string text) {
+}
+
+TextItem::~TextItem() {
+}
+
+IconItem::IconItem(std::string iconpath) {
+}
+
+IconItem::~IconItem() {
+}
+
+IconTextItem::IconTextItem(std::string iconpath, std::string text) {
+}
+
+IconTextItem::~IconTextItem() {
+}
+
+ImageItem::ImageItem(std::string imagePath) {
+}
+
+ImageItem::~ImageItem() {
+}
+
+ButtonItem::ButtonItem(std::string title) {
+}
+
+ButtonItem::~ButtonItem() {
+}
+
+ProgressItem::ProgressItem(float min, float max, float current) {
+}
+
+ProgressItem::~ProgressItem() {
+}
+
+CheckBoxItem::CheckBoxItem(bool checked) {
+}
+
+CheckBoxItem::~CheckBoxItem() {
+}
+
+ChatMessageItem::ChatMessageItem() {
+}
+
+ChatMessageItem::~ChatMessageItem() {
+}
+
+InputSelectorItem::InputSelectorItem() {
+}
+
+InputSelectorItem::~InputSelectorItem() {
+}
+
+EntryItem::EntryItem() {
+}
+
+EntryItem::~EntryItem() {
+}
+
+EffectItem::EffectItem() {
+}
+
+EffectItem::~EffectItem() {
+}
+
+CustomItem::CustomItem() {
+}
+
+CustomItem::~CustomItem() {
+}
+
+} //namespace item
+} //namespace notification_ex
--- /dev/null
+/*
+ * 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_ITEM_H_
+#define NOTIFICATION_EX_ITEM_H_
+
+#include <time.h>
+
+#include <memory>
+#include <string>
+#include <list>
+
+#include "notification-ex/abstract_item.h"
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+namespace item {
+
+class EXPORT_API GroupItem : public AbstractItem {
+ public:
+ GroupItem();
+ virtual ~GroupItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ void AddChild(std::shared_ptr<AbstractItem> child);
+ void Remove(std::string itemId);
+ std::list<std::shared_ptr<AbstractItem>> GetChildren() const;
+ int GetChannel() const;
+ void SetChannel(int channel);
+ void SetDirection(bool vertical);
+ bool IsVertical() const;
+ std::string GetAppLabel() const;
+
+
+ private:
+ bool Vertical_ = true;
+ std::string channel_ = nullptr;
+ std::string id_ = nullptr;
+ LEDInfo led_;
+ std::string itemId_ = nullptr;
+}; // class GroupItem
+
+class EXPORT_API TextItem : public AbstractItem {
+ public:
+ TextItem(std::string text);
+ virtual ~TextItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ void SetContents(std::string contents);
+ std::string GetContents() const;
+ std::string GetHyperLink() const;
+
+ private:
+ std::string text_ = nullptr;
+}; // class TextItem
+
+class EXPORT_API IconItem : public AbstractItem {
+ public:
+ IconItem(std::string iconpath);
+ virtual ~IconItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+
+ private:
+ std::string iconPath_ = nullptr;
+}; // class IconItem
+
+class EXPORT_API IconTextItem : public AbstractItem {
+ public:
+ IconTextItem(std::string iconpath, std::string text);
+ virtual ~IconTextItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ IconItem GetIconItem() const;
+ IconItem GetTextItem() const;
+
+ private:
+ std::string iconPath_ = nullptr;
+ std::string text_ = nullptr;
+}; // class IconTextItem
+
+class EXPORT_API ImageItem : public AbstractItem {
+ public:
+ ImageItem(std::string imagePath);
+ virtual ~ImageItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ std::string GetImagePath() const;
+
+ private:
+ std::string imagePath_ = nullptr;
+}; // class ImageItem
+
+class EXPORT_API ButtonItem : public AbstractItem {
+ public:
+ ButtonItem(std::string title);
+ virtual ~ButtonItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ std::string GetTitle() const;
+
+ private:
+ std::string title_ = nullptr;
+}; // class ButtonItem
+
+class EXPORT_API ProgressItem : public AbstractItem {
+ public:
+ ProgressItem(float min, float max, float current);
+ virtual ~ProgressItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ float GetCurrent() const;
+ void SetCurrent(float current);
+ float GetMin() const;
+ float GetMax() const;
+
+ private:
+ float min_ = 0.0;
+ float max_ = 0.0;
+ float current_ = 0.0;
+}; // class ProgressItem
+
+class EXPORT_API CheckBoxItem : public AbstractItem {
+ public:
+ CheckBoxItem(bool checked);
+ virtual ~CheckBoxItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ bool IsChecked() const;
+
+private:
+ bool checked_ = false;
+}; // class CheckBoxItem
+
+class EXPORT_API ChatMessageItem : public AbstractItem {
+ public:
+ enum Type {
+ user,
+ sender,
+ };
+
+ public:
+ ChatMessageItem();
+ virtual ~ChatMessageItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ TextItem GetTextItem() const;
+ TextItem GetDataItem() const;
+ time_t GetTimeItem() const;
+ Type GetType() const;
+}; // class ChatMessageItem
+
+class EXPORT_API InputSelectorItem : public AbstractItem {
+ public:
+ InputSelectorItem();
+ virtual ~InputSelectorItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ std::list<std::string> GetContents() const;
+ void SetContents(std::list<std::string> contents);
+
+ private:
+ std::list<std::string> contents_;
+}; // class InputSelectorItem
+
+class EXPORT_API EntryItem : public AbstractItem {
+ public:
+ EntryItem();
+ virtual ~EntryItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ std::string GetText() const;
+ void SetText(std::string text);
+ void SetTextLimit(int size);
+ int GetTextLimit() const;
+
+ private:
+ std::string text_ = nullptr;
+ int limit_ = 160;
+}; // class EntryItem
+
+class EXPORT_API EffectItem : public AbstractItem {
+ public:
+ EffectItem();
+ virtual ~EffectItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+ std::string GetSoundPath() const;
+ std::string GetVibrationPath() const;
+
+ private:
+ std::string soundPath_ = nullptr;
+ std::string vibrationPath_ = nullptr;
+}; // class EffectItem
+
+class EXPORT_API CustomItem : public AbstractItem {
+ public:
+ CustomItem();
+ virtual ~CustomItem();
+
+ Bundle Serialize() override;
+ void Deserialize(Bundle b) override;
+ std::shared_ptr<AbstractItem> FindByID(std::string id) override;
+}; // class CustomItem
+
+} // namespace item
+} // nampace notification
+#endif // NOTIFICATION_EX_ITEM_H_
--- /dev/null
+/*
+ * 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 <string>
+#include <list>
+
+#include "notification-ex/abstract_item.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API Manager : public IEventObserver {
+ public:
+ Manager(IEventsSender* sender, IEventsListener* listener);
+ virtual ~Manager();
+
+ void Update(std::shared_ptr<item::AbstractItem> noti);
+ void Remove(std::shared_ptr<item::AbstractItem> noti);
+ void Hide(std::shared_ptr<item::AbstractItem> noti);
+ std::shared_ptr<item::AbstractItem> FindByRootID(std::string id);
+ void SendEvent(EventInfo info, std::shared_ptr<item::AbstractItem> noti);
+ void OnEvent(EventInfo info, std::shared_ptr<AbstractItem> notiList) override;
+
+ protected:
+ virtual void OnAdd(std::list<std::shared_ptr<item::AbstractItem>> addedItem);
+ virtual void OnUpdate(shared_ptr<item::AbstractItem> updatedItem);
+ virtual void OnDelete(shared_ptr<item::AbstractItem> deletedItem);
+
+ private:
+ IEventsSender* sender_;
+ IEventsListener* receiver_;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_MANAGER_H_
--- /dev/null
+/*
+ * 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_MOCK_LISTENER_H_
+#define NOTIFICATION_EX_MOCK_LISTENER_H_
+
+#include "notification-ex/observer_interface.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API MockEventsListener : public IEventListener {
+ public:
+ MockEventsListener();
+ virtual ~MockEventsListener();
+
+ void RegisterObserver(IEventObserver observer) override;
+ void UnRegisterObserver(IEventObserver observer) override;
+ void NotifyAll() override;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_MOCK_LISTENER_H_
--- /dev/null
+/*
+ * 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_MOCK_SENDER_H_
+#define NOTIFICATION_EX_MOCK_SENDER_H_
+
+#include "notification-ex/bundle.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API MockSender : public IEventsSender {
+ public:
+ MockSender();
+ virtual ~MockSender();
+
+ void Notify(Bundle serialized) override;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_MOCK_SENDER_H_
--- /dev/null
+prefix=@PREFIX@
+exec_prefix=@EXEC_PREFIX@
+libdir=@LIBDIR@
+includedir=@INCLUDEDIR@
+
+Name: notification-ex
+Description: Support development of the notification
+Version: @VERSION@
+Libs: -L${libdir}
+Cflags: -I${includedir}
+cppflags: -I${includedir}
\ No newline at end of file
--- /dev/null
+/*
+ * 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_OBSERVER_INTERFACE_H_
+#define NOTIFICATION_EX_OBSERVER_INTERFACE_H_
+
+#include "notification-ex/bundle.h"
+#include "notification-ex/event_info.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API IEventObserver {
+ public:
+ virtual ~IEventObserver() = 0;
+
+ virtual void OnEvent(EventInfo info, std::shared_ptr<AbstractItem> noti) = 0;
+};
+
+} // namespace notification
+
+#endif
\ No newline at end of file
--- /dev/null
+/*
+ * 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_REPOTER_H_
+#define NOTIFICATION_EX_REPOTER_H_
+
+#include <string>
+#include <list>
+
+#include "notification-ex/abstract_item.h"
+#include "notification-ex/event_info.h"
+
+#ifndef EXPORT_API
+#define EXPORT_API __attribute__((visibility("default")))
+#endif
+
+namespace notification {
+
+class EXPORT_API Repoter : public IEventObserver {
+ public:
+ Repoter(IEventsSender* sender, IEventsListener* listener);
+ virtual ~Repoter();
+
+ void Post(std::shared_ptr<item::AbstractItem> noti);
+ void Post(std::list<std::shared_ptr<AbstractItem>> notiList);
+ void Update(std::shared_ptr<AbstractItem> noti);
+ void Remove(std::shared_ptr<AbstractItem> noti);
+ std::shared_ptr<AbstractItem> FindByRootID(std::string id);
+ void OnEvent(EventInfo info, std::shared_ptr<AbstractItem> notiList) override;
+
+ private:
+ IEventsSender* sender_;
+ IEventsListener* receiver_;
+};
+
+} // namespace notification
+
+#endif // NOTIFICATION_EX_REPOTER_H_
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(notification C)
+
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+SET(EXEC_PREFIX "\${prefix}")
+SET(LIBDIR ${LIB_INSTALL_DIR})
+SET(INCLUDEDIR "\${prefix}/include/${PROJECT_NAME}")
+
+#ADD_SUBDIRECTORY(test-app)
+
+SET(INIT-SRCS
+ ./src/notification_init.c
+)
+INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
+
+AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR}/src SRCS)
+LIST(REMOVE_ITEM SRCS ${INIT-SRCS})
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(pkgs REQUIRED
+ sqlite3
+ vconf
+ bundle
+ dlog
+ aul
+ dbus-1
+ capi-appfw-app-control
+ capi-appfw-package-manager
+ pkgmgr-info
+ libtzplatform-config
+ glib-2.0
+ gio-2.0
+ gio-unix-2.0
+ iniparser
+ security-manager
+ libsmack
+)
+
+FOREACH(flag ${pkgs_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -g -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIE")
+
+SET(CMAKE_SKIP_BUILD_RPATH TRUE)
+
+ADD_LIBRARY(${PROJECT_NAME} SHARED ${SRCS})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES SOVERSION ${MAJORVER})
+SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES VERSION ${FULLVER})
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
+
+ADD_EXECUTABLE(notification_init ${INIT-SRCS})
+TARGET_LINK_LIBRARIES(notification_init ${pkgs_LDFLAGS} notification "-pie")
+
+CONFIGURE_FILE(${PROJECT_NAME}.pc.in ${PROJECT_NAME}.pc @ONLY)
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries)
+INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
+INSTALL(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
+ DESTINATION include/notification
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "*_group.h" EXCLUDE
+ PATTERN "*_debug.h" EXCLUDE
+ PATTERN "*.h")
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/11_notification-add.post DESTINATION ${SYSCONF_INSTALL_DIR}/gumd/useradd.d/)
+INSTALL(TARGETS notification_init DESTINATION bin)
{
int noti_err = NOTIFICATION_ERROR_NONE;
- noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ //noti_err = notification_delete_all(NOTIFICATION_TYPE_NOTI);
+ noti_err = notification_delete_by_display_applist(NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY);
testapp_print("notification_delete_all returns[%d]", noti_err);
BuildRequires: pkgconfig(capi-appfw-package-manager)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(libtzplatform-config)
-BuildRequires: pkgconfig(gio-2.0)
-BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: pkgconfig(iniparser)
BuildRequires: pkgconfig(security-manager)
BuildRequires: pkgconfig(libsmack)
+BuildRequires: pkgconfig(gmock)
BuildRequires: cmake
Requires(post): /sbin/ldconfig
%{_includedir}/notification/notification_type_internal.h
%{_libdir}/pkgconfig/notification.pc
%{_libdir}/libnotification.so
+
+
+
+#################################################
+# notification-ex
+#################################################
+%package -n %{name}-ex
+Summary: Library for developing the notification
+Group: Applications/Application Utility
+License: Apache-2.0
+
+%description -n %{name}-ex
+Provide APIs to develop the notification.
+
+%package -n %{name}-ex-devel
+Summary: Notification development library (dev)
+Group: Development/Libraries
+Requires: %{name}-ex
+
+%description -n %{name}-ex-devel
+Header & package configuration files to support development of the notification.
+
+%post -n %{name}-ex
+/sbin/ldconfig
+
+%postun -n %{name}-ex -p /sbin/ldconfig
+
+%files -n %{name}-ex
+%manifest %{name}-ex.manifest
+%attr(0644,root,root) %{_libdir}/libnotification-ex.so.*
+%license LICENSE
+
+%files -n %{name}-ex-devel
+%{_includedir}/notification-ex/*.h
+%{_libdir}/pkgconfig/notification-ex.pc
+%attr(0644,root,root) %{_libdir}/libnotification-ex.so
+
+
+#################################################
+# notification_ex_unittests
+#################################################
+%package -n notification_ex_unittests
+Summary: GTest for notification_ex
+Group: Development/Libraries
+
+%description -n notification_ex_unittests
+GTest for notification_ex
+
+%files -n notification_ex_unittests
+%{_bindir}/notification_ex_unittests
--- /dev/null
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT(notification_ex_unittests CXX)
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(notification_ex_unittests REQUIRED
+ dlog
+ gmock
+)
+
+FOREACH(flag ${notification_ex_unittests_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden -Wall -Werror -Winline")
+
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g")
+SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
+
+AUX_SOURCE_DIRECTORY(src SOURCES)
+ADD_EXECUTABLE(${PROJECT_NAME}
+ ${SOURCES}
+)
+
+TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${watchface-complication_unittests_LDFLAGS}
+ ${pkgs_LDFLAGS}
+ ${pkgs_LIBRARIES}
+ gmock
+)
+
+INSTALL(TARGETS ${PROJECT_NAME} DESTINATION /usr/bin/)
--- /dev/null
+/*
+ * 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.
+ */
+
+#include <gtest/gtest.h>
+#include <gmock/gmock.h>
+
+int main(int argc, char** argv){
+ int ret = -1;
+ setenv("GCOV_PREFIX", "/tmp/", 1);
+ try {
+ testing::InitGoogleTest(&argc, argv);
+ } catch(...) {
+ std::cout << "Exception occurred" << std::endl;
+ }
+
+ try {
+ ret = RUN_ALL_TESTS();
+ } catch (const ::testing::internal::GoogleTestFailureException& e) {
+ ret = -1;
+ std::cout << "GoogleTestFailureException was thrown:" << e.what() << std::endl;
+ }
+
+ return ret;
+}