From 1c761ae5e63b1429db169fd0bfec600a7e430b1d Mon Sep 17 00:00:00 2001 From: Young Ik Cho Date: Tue, 4 Dec 2012 17:31:34 +0900 Subject: [PATCH] apply notification migration Change-Id: Ie0d3440551c1242a74fb6dcdab1c613772be04d6 --- inc/FShell.h | 4 +- inc/FShlNotificationManager.h | 479 ++++++++++++++++ inc/FShlNotificationRequest.h | 340 +++++++++++ packaging/osp-shell.spec | 8 +- src/CMakeLists.txt | 203 +++---- src/FShlNotificationManager.cpp | 25 +- src/FShlNotificationRequest.cpp | 230 ++++++++ src/FShl_NotificationManagerEventParamTraits.h | 119 ++++ src/FShl_NotificationManagerImpl.cpp | 745 +++++++++++++++++++++++++ src/FShl_NotificationManagerIpcMessages.cpp | 46 ++ src/FShl_NotificationManagerIpcMessages.h | 34 ++ src/FShl_NotificationManagerProxy.cpp | 92 +++ src/FShl_NotificationManagerProxy.h | 67 +++ src/FShl_NotificationRequestImpl.cpp | 367 ++++++++++++ src/FShl_NotificationRequestImpl.h | 333 +++++++++++ src/inc/FShl_NotificationManagerImpl.h | 71 ++- 16 files changed, 3013 insertions(+), 150 deletions(-) create mode 100644 inc/FShlNotificationManager.h create mode 100644 inc/FShlNotificationRequest.h create mode 100644 src/FShlNotificationRequest.cpp create mode 100644 src/FShl_NotificationManagerEventParamTraits.h create mode 100644 src/FShl_NotificationManagerImpl.cpp create mode 100644 src/FShl_NotificationManagerIpcMessages.cpp create mode 100644 src/FShl_NotificationManagerIpcMessages.h create mode 100644 src/FShl_NotificationManagerProxy.cpp create mode 100644 src/FShl_NotificationManagerProxy.h create mode 100644 src/FShl_NotificationRequestImpl.cpp create mode 100644 src/FShl_NotificationRequestImpl.h diff --git a/inc/FShell.h b/inc/FShell.h index a7ccc3a..6ea1aed 100644 --- a/inc/FShell.h +++ b/inc/FShell.h @@ -25,8 +25,8 @@ #ifndef _FSHELL_H_ #define _FSHELL_H_ -//#include -//#include +#include +#include #include /** diff --git a/inc/FShlNotificationManager.h b/inc/FShlNotificationManager.h new file mode 100644 index 0000000..9f6a8bd --- /dev/null +++ b/inc/FShlNotificationManager.h @@ -0,0 +1,479 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShlNotificationManager.h + * @brief This is the header file for the %NotificationManager class. + * + * This header file contains the declarations of the %NotificationManager class. + */ + +#ifndef _FSHL_NOTIFICATION_MANAGER_H_ +#define _FSHL_NOTIFICATION_MANAGER_H_ + +#include + +namespace Osp { namespace Shell +{ + +class NotificationRequest; + +/** + * The maximum length of the notification message. + * + * @since 3.0 + */ +static const int MAX_NOTIFICATION_MESSAGE_LENGTH = 1024; + +/** + * The maximum length of the launch arguments for the notification in bytes. + * + * @since 3.0 + */ +static const int MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH = 1024; + +/** + * The maximum length of the notification badge number. + * + * @since 3.0 + */ +static const int MAX_NOTIFICATION_BADGE_NUMBER = 999; + +/** + * The maximum length of the title text. + * + * @since 3.0 + */ +static const int MAX_NOTIFICATION_TITLE_LENGTH = 1024; + +/** + * @enum OngoingActivityType + * + * Defines the ongoing activity notification type. + * + * @since 3.0 + */ +enum OngoingActivityType +{ + ONGOING_ACTIVITY_TYPE_TEXT = 1, /**< The text type */ + ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE, /**< The progress type in byte */ + ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE /**< The progress type in percentage */ +}; + + +/** + * @class NotificationManager + * @brief This class provides methods to alert the user about a notification. + * + * @since 3.0 + * + * @final This class is not intended for extension. + * + * The %NotificationManager class provides methods to alert the user about a notification. + * @n + * For more information about the class features, see Notifications. + * + * The following example demonstrates how to use the %NotificationManager class. + * + * @code + * + * result + * MyClass::NotificationSample(void) + * { + * int badgeNumber; + * NotificationManager notiMgr; + * notiMgr.Construct(); + * badgeNumber = notiMgr.GetBadgeNumber(); + * badgeNumber++; + * notiMgr.Notify(L"A new message has arrived.", badgeNumber); + * } + * + * @endcode + * + */ +class _OSP_EXPORT_ NotificationManager + : public Osp::Base::Object +{ + +public: + /** + * This is the default constructor for this class. + * + * @since 3.0 + */ + NotificationManager(void); + + /** + * This destructor overrides Osp::Base::Object::~Object(). + * + * @since 3.0 + */ + virtual ~NotificationManager(void); + + /** + * Initializes this instance of %NotificationManager + * + * @since 3.0 + * + * @return An error code + * @exception E_SUCCESS The method is successful. + */ + result Construct(void); + + /** + * Gets the current badge number of the application icon. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return The current badge number + * @exception E_SUCCESS The method is successful. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. @n + * In case of failure, this method returns @c -1. + */ + int GetBadgeNumber(void); + + /** + * Notifies the user using a badge number. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] badgeNumber The badge number + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified input parameter is invalid, or + * the specified @c badgeNumber is less than @c 0. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + result Notify(int badgeNumber); + + /** + * Notifies the user using a message. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] messageText The notification message + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified input parameter is invalid, or + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + result Notify(const Osp::Base::String& messageText); + + /** + * Notifies the user using a message and badge number. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] messageText The notification message + * @param[in] badgeNumber The badge number + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + result Notify(const Osp::Base::String& messageText, int badgeNumber); + + /** + * Notifies the user using a message and badge number. @n + * If the user selects the message, @c launchArguments is delivered to the application. @n + * @c launchArguments is specified as input parameter for Osp::App::App::OnUserEventReceivedN() or can be obtained by + * invoking Osp::App::App::GetAppArgumentListN(), especially within Osp::App::App::OnAppInitializing(). + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] messageText The notification message + * @param[in] badgeNumber The badge number + * @param[in] launchArguments The message for application + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - A specified input parameter is invalid. @n + * - The specified @c badgeNumber is less than @c 0. @n + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see Osp::App::App::OnUserEventReceivedN(), Osp::App::App::GetAppArgumentListN() + */ + result Notify(const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments); + + /** + * Notifies the user using a request message. @n + * The request may have various information like alert text, title text, launch arguments, and so on. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] request The notification request + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - The specified @c request does not have valid badge number value. @n + * - The specified @c request does not have alert text. @n + * - The specified @c request has invalid icon file path. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see NotificationRequest + */ + result Notify(const NotificationRequest& request); + + /** + * @if VISPARTNER + * Notifies the user using a request message. @n + * The request may have various information like alert text, title text, launch arguments, and so on. + * + * @since 3.0 + * + * @visibility partner + * @privlevel user + * @privilege http://tizen.org/privilege/notificationmanager + * + * @return An error code + * @param[in] appId The application ID + * @param[in] request The notification request + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - The specified @c request does not have valid badge number value. @n + * - The specified @c request does not have alert text. @n + * - The specified @c request has invalid icon file path. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see NotificationRequest + * @endif + */ + result NotifyByAppId(const Osp::App::AppId& appId, const NotificationRequest& request); + + /** + * Removes the notification message. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @exception E_SUCCESS The method is successful. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The method returns E_SUCCESS when there is no outstanding notification. + */ + result RemoveNotification(void); + + /** + * @if VISPARTNER + * Removes the notification message on behalf of the specified application. + * + * @since 3.0 + * + * @visibility partner + * @privlevel user + * @privilege http://tizen.org/privilege/notificationmanager + * + * @return An error code + * @param[in] appId The application ID + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application did not have the privilege to call this method. + * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS. + * @endif + */ + result RemoveNotificationByAppId(const Osp::App::AppId& appId); + + /** + * Notifies the user about the ongoing activity using a message. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] messageText The notification message + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified input parameter is invalid, or + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + */ + result NotifyOngoingActivity(const Osp::Base::String& messageText); + + /** + * Notifies the user about the ongoing activity using a message. @n + * If the user selects the message, @c launchArguments is delivered to the application. @n + * @c launchArguments is specified as input parameter for Osp::App::App::OnUserEventReceivedN() or can be obtained by + * invoking Osp::App::App::GetAppArgumentListN(), especially within Osp::App::App::OnAppInitializing(). @n + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] messageText The notification message + * @param[in] launchArguments The launch arguments for the application + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - A specified input parameter is invalid. @n + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see Osp::App::App::OnUserEventReceivedN(), Osp::App::App::GetAppArgumentListN() + */ + result NotifyOngoingActivity(const Osp::Base::String& messageText, const Osp::Base::String& launchArguments); + + /** + * Notifies the user about the ongoing activity using a request messsage. @n + * The request may have various information like alert text, title text, launch arguments, and so on. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @param[in] request The notification request + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - The specified @c request does not have either alert text or progress value. @n + * - The specified @c request has invalid icon file path. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see NotificationRequest + */ + result NotifyOngoingActivity(const NotificationRequest& request); + + /** + * @if VISPARTNER + * Notifies the user about the ongoing activity using a request message. @n + * The request may have various information like alert text, title text, launch arguments, and so on. + * + * @since 3.0 + * + * @visibility partner + * @privlevel user + * @privilege http://tizen.org/privilege/notificationmanager + * + * @return An error code + * @param[in] appId The application ID + * @param[in] request The notification request + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - The specified @c request does not have either alert text or progress value. @n + * - The specified @c request has invalid icon file path. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @see NotificationRequest + * @endif + */ + result NotifyOngoingActivityByAppId(const Osp::App::AppId& appId, const NotificationRequest& request); + + /** + * Removes the notification message for the ongoing activity. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return An error code + * @exception E_SUCCESS The method is successful. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The method returns E_SUCCESS when there is no outstanding notification. + */ + result RemoveOngoingActivityNotification(void); + + /** + * @if VISPARTNER + * Removes the notification message for ongoing activity on behalf of the specified application. + * + * @since 3.0 + * + * @visibility partner + * @privlevel user + * @privilege http://tizen.org/privilege/notificationmanager + * + * @return An error code + * @param[in] appId The application ID + * @exception E_SUCCESS The method is successful. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_PRIVILEGE_DENIED The application did not have the privilege to call this method. + * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS. + * @endif + */ + result RemoveOngoingActivityNotificationByAppId(const Osp::App::AppId& appId); + + /** + * Gets the badge number of the application icon. + * + * @since 3.0 + * @privlevel user + * @privilege http://tizen.org/privilege/notification + * + * @return The current badge number + * @param[in] appId The application ID + * @exception E_SUCCESS The method is successful. + * @exception E_OPERATION_FAILED The operation has failed. + * @exception E_APP_NOT_INSTALLED The application is not installed. + * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method. + * @remarks The specific error code can be accessed using the GetLastResult() method. @n + * In case of failure, this method returns @c -1. + */ + int GetBadgeNumberByAppId(const Osp::App::AppId& appId); + +private: + /** + * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects. + * + * @since 3.0 + */ + NotificationManager(const NotificationManager& rhs); + + /** + * The implementation of this copy assignment operator is intentionally blank and delcared as private to prohibit copying of objects. + * + * @since 3.0 + */ + NotificationManager& operator =(const NotificationManager& rhs); + +private: + class _NotificationManagerImpl * __pNotificationManagerImpl; + + friend class _NotificationManagerImpl; +}; // NotificationManager + +} } // Osp::App + +#endif // _FSHL_NOTIFICATION_MANAGER_H_ diff --git a/inc/FShlNotificationRequest.h b/inc/FShlNotificationRequest.h new file mode 100644 index 0000000..07d0cf0 --- /dev/null +++ b/inc/FShlNotificationRequest.h @@ -0,0 +1,340 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShlNotificationRequest.h + * @brief This is the header file for the %NotificationRequest class. + * + * This header file contains the declarations of the %NotificationRequest class. + */ + +#ifndef _FSHL_NOTIFICATION_REQUEST_H_ +#define _FSHL_NOTIFICATION_REQUEST_H_ + +#include +#include + +namespace Osp { namespace Shell +{ + +/** + * @class NotificationRequest + * @brief This class provides methods for handling a notification request + * + * @since 3.0 + * + * @final This class is not intended for extension. + * + * The %NotificationRequest class provides methods for handling the notification request. The request can contain following + * items: + * -# Constructing element of the notification area like notification title or alert text + * -# Information of the indicator area like alert text + * -# The path of the sound file to be played when user selects the notification message of the notification area + * -# The badge number or badge offset for notification area or main menu + * + * %NotificationRequest is either bound to the application or not. If %NotificationRequest is bound to the application, then + * the associated application is launched by selecting the item in the notification area. Nothing happens otherwise. + * + * For more information about the class features, see Notifications. + * + * @see Osp::Shell::NotificationManager + */ +class _OSP_EXPORT_ NotificationRequest + : public Osp::Base::Object +{ + +public: + /** + * Initializes this instance of %NotificationRequest with the specified appBinding. + * + * @since 3.0 + * + * @param[in] appBinding Set to @c true to bind %NotificationRequest to the destination application, @n + * else @c false + * @remarks Selecting the posted notification in the notification area leads to launch of the associated application + * if %NotificationRequest is bound to the destination application. + */ + explicit NotificationRequest(bool appBinding = true); + + /** + * Copying of objects using this copy constructor is allowed. + * + * @since 3.0 + * + * @param[in] rhs An instance of %NotificationRequest + */ + NotificationRequest(const NotificationRequest& rhs); + + /** + * Copying of objects using this copy assignment operator is allowed. + * + * @since 3.0 + * + * @param[in] rhs An instance of %NotificationRequest + */ + NotificationRequest& operator =(const NotificationRequest& rhs); + + /** + * This destructor overrides Osp::Base::Object::~Object(). + * + * @since 3.0 + */ + virtual ~NotificationRequest(void); + + /** + * Checks whether the specified instance of %NotificationRequest equals the current instance. + * + * @since 3.0 + * + * @return @c true if the specified instance equals the current instance, @n + * else @c false + * @param[in] rhs An instance of %NotificationRequest + * @remarks The method returns @c false if the specified object is not %NotificationRequest. + */ + virtual bool Equals(const Object& rhs) const; + + /** + * Gets the hash value of the current instance. + * + * @since 3.0 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Gets the badge number of the notification message. + * + * @since 3.0 + * + * @return The badge number value + * @remarks If the badge number is not set, then this method returns @c -1. + */ + int GetBadgeNumber(void) const; + + /** + * Sets the badge number of the notification message. @n + * %NotificationRequest has either badge number or badge number offset. + * If the badge number is set using %SetBadgeNumber(), then previous badge offset value is set to @c 0. + * + * @since 3.0 + * + * @return An error code + * @param[in] value The badge number value + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c value is less than @c 0 or greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER. + */ + result SetBadgeNumber(int value); + + /** + * Gets the badge number offset of the notification message. + * + * @since 3.0 + * + * @return The badge offset value + */ + int GetBadgeOffset(void) const; + + /** + * Sets the badge number offset of the notification message. @n + * %NotificationRequest has either badge number or badge number offset. + * If the badge number offset is set using %SetBadgeOffset(), then previous badge number value is set to @c -1 and ignored. @n + * + * When posting the notification message, badge offset value is added to the current badge number, + * which can be acquired by NotificationManager::GetBadgeNumber(). Setting badge offset to @c 0 + * means explicitly specifying not to change the current badge value with the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] value The badge number value + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The absolute value of the specified @c value is greater than Shell::MAX_NOTIFICATION_BADGE_NUMBER. + * @remarks Even though this method does not return E_INVALID_ARG, it does not guarantee the success of NotificationManager::Notify(). + * @see SetBadgeNumber(), NotificationManager::GetBadgeNumber(), NotificationManager::Notify() + */ + result SetBadgeOffset(int value); + + /** + * Gets the alert text of the notification message. + * + * @since 3.0 + * + * @return The alert text + */ + Osp::Base::String GetAlertText(void) const; + + /** + * Sets an alert text of the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] text The alert text + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c text is empty or the length of @c text is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. + */ + result SetAlertText(const Osp::Base::String& text); + + /** + * Gets the application message of the notification message. @n + * This message is delivered to the application as launch arguments. + * + * @since 3.0 + * + * @return The message for application + */ + Osp::Base::String GetAppMessage(void) const; + + /** + * Sets the application message of the notification message. @n + * This message is delivered to the application as launch arguments. + * + * @since 3.0 + * + * @return An error code + * @param[in] appMessage The message for the application + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The length of @c appMessage is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * @exception E_INVALID_OPERATION This instance is not bound to the application. + * @remarks This method returns E_INVALID_OPERATION if %NotificationRequest instance is not bound to the application. + */ + result SetAppMessage(const Osp::Base::String& appMessage); + + /** + * Gets the title text of the notification message. + * + * @since 3.0 + * + * @return The title text + */ + Osp::Base::String GetTitleText(void) const; + + /** + * Sets the title text of the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] title The title text + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The length of @c title is greater than Shell::MAX_NOTIFICATION_TITLE_LENGTH. + */ + result SetTitleText(const Osp::Base::String& title); + + /** + * Gets the file path of the icon image for the notification message. + * + * @since 3.0 + * + * @return The file path of the icon image + */ + Osp::Base::String GetIconFilePath(void) const; + + /** + * Sets the file path of the icon image for the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] iconPath The file path of the icon image + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified path is invalid. + */ + result SetIconFilePath(const Osp::Base::String& iconPath); + + /** + * Gets the file path of the sound file to be played for the notification message. + * + * @since 3.0 + * + * @return The file path of the sound file + */ + Osp::Base::String GetSoundFilePath(void) const; + + /** + * Sets the file path of the sound file to be played for the notification message. @n + * The sound file should be wave file format. + * + * @since 3.0 + * + * @return An error code + * @param[in] soundPath The file path of the sound file + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified path is invalid. + * @remarks If the format of the sound file is not valid, then the sound file is not played properly when the notification message is shown. + */ + result SetSoundFilePath(const Osp::Base::String& soundPath); + + /** + * Gets the notification type for the ongoing activity notification. + * + * @since 3.0 + * + * @return The ongoing activity notification type + * @remarks This information is only meaningful when the %NotificationRequest instance is delivered to the NotificationManager::NotifyOngoingActivity() method. + * @see NotificationManager::NotifyOngoingActivity(), SetOngoingActivityType() + */ + OngoingActivityType GetOngoingActivityType(void) const; + + /** + * Sets the notification type for the ongoing activity notification. + * + * @since 3.0 + * + * @return An error code + * @param[in] type The ongoing activity notification type + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_OPERATION The current progress value is not compatible to the specified @c type. + * @remarks This information is only meaningful when the %NotificationRequest instance is delivered to the NotificationManager::NotifyOngoingActivity() method. + * @see NotificationManager::NotifyOngoingActivity(), SetOngoingActivityProgressValue() + */ + result SetOngoingActivityType(OngoingActivityType type = ONGOING_ACTIVITY_TYPE_TEXT); + + /** + * Gets the progress value for the ongoing activity notification. + * + * @since 3.0 + * + * @return The progress value + */ + int GetOngoingActivityProgress(void) const; + + /** + * Sets the progress value with the specified value. + * + * @since 3.0 + * + * @return An error code + * @param[in] value The progress value + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c value is less than @c 0, or + * the specified @c value does not lie between @c 0 and @c 100 for Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE. + * @exception E_INVALID_OPERATION This instance is in an invalid state. @n + * OngoingActivityType must be either Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE or Shell::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE. + */ + result SetOngoingActivityProgress(int value); + +private: + class _NotificationRequestImpl * __pNotificationRequestImpl; + + friend class _NotificationRequestImpl; +}; // NotificationRequest + +} } // Osp::App + +#endif // _FSHL_NOTIFICATION_REQUEST_H_ diff --git a/packaging/osp-shell.spec b/packaging/osp-shell.spec index 7ccecd6..e99ea6a 100644 --- a/packaging/osp-shell.spec +++ b/packaging/osp-shell.spec @@ -9,14 +9,16 @@ Group: TO_BE/FILLED_IN License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz BuildRequires: cmake +BuildRequires: pkgconfig(capi-appfw-application) +BuildRequires: pkgconfig(capi-appfw-app-manager) BuildRequires: pkgconfig(chromium) BuildRequires: pkgconfig(osp-appfw) BuildRequires: pkgconfig(osp-uifw) -BuildRequires: pkgconfig(capi-system-info) -BuildRequires: pkgconfig(capi-system-device) -BuildRequires: pkgconfig(capi-system-runtime-info) BuildRequires: pkgconfig(evas) BuildRequires: pkgconfig(ecore) +BuildRequires: pkgconfig(notification) +BuildRequires: pkgconfig(appsvc) +BuildRequires: pkgconfig(pkgmgr) BuildRequires: pkgconfig(minicontrol-provider) BuildRequires: osp-appfw-internal-devel BuildRequires: osp-uifw-internal-devel diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3460c57..4f52be2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,97 +1,106 @@ -SET (this_target osp-shell) - -INCLUDE_DIRECTORIES( - ${CMAKE_SOURCE_DIR}/inc - ${CMAKE_SOURCE_DIR}/src - ${CMAKE_SOURCE_DIR}/src/inc - /usr/include/chromium - /usr/include/osp - /usr/include/osp/app - /usr/include/osp/base - /usr/include/osp/io - /usr/include/osp/graphics - /usr/include/osp/ui - /usr/include/osp/security - - /usr/include - /usr/include/appfw - /usr/include/uifw - /usr/include/glib-2.0 - /usr/lib/glib-2.0/include - /usr/include/cairo - /usr/include/chromium - /usr/include/dlog - /usr/include/dbus-1.0 - /usr/include/dri2 - /usr/include/libdrm - /usr/lib/dbus-1.0/include - /usr/include/e_dbus-1 - /usr/include/elementary-1 - /usr/include/efreet-1 - /usr/include/ecore-1 - /usr/include/edje-1 - /usr/include/evas-1 - /usr/include/eet-1 - /usr/include/eina-1 - /usr/include/eina-1/eina - /usr/include/ethumb-1 - /usr/include/freetype2 - /usr/include/fribidi - /usr/include/harfbuzz - /usr/include/libxml2 - /usr/include/minizip - /usr/include/minicontrol - /usr/include/pango-1.0 - /usr/include/pixman-1 - /usr/include/system - /usr/include/vconf -) - -SET (${this_target}_SOURCE_FILES - FShlNotificationManager.cpp - FShlQuickPanelFrame.cpp - FShl_QuickPanelFrame.cpp - FShl_QuickPanelFrameImpl.cpp - FShl_QuickPanelFramePresenter.cpp -) - -## Definitions -SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" ) - -## SET C COMPILER FLAGS -SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}") - -## SET CPP COMPILER FLAGS -SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") -SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}") - -## Create Library -ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES}) - -## SET LINKER FLAGS -SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed") - -TARGET_LINK_LIBRARIES(${this_target} "-lchromium" ) -TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" ) -TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-uifw" ) -TARGET_LINK_LIBRARIES(${this_target} "-lecore" ) -TARGET_LINK_LIBRARIES(${this_target} "-levas" ) -TARGET_LINK_LIBRARIES(${this_target} "-leina" ) -TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" ) -TARGET_LINK_LIBRARIES(${this_target} "-lminicontrol-provider" ) -TARGET_LINK_LIBRARIES(${this_target} "-lcapi-system-runtime-info") - -SET_TARGET_PROPERTIES(${this_target} - PROPERTIES - VERSION ${FULLVER} - SOVERSION ${MAJORVER} - CLEAN_DIRECT_OUTPUT 1 -) - -ADD_CUSTOM_COMMAND(TARGET ${this_target} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} - COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER} - COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} - COMMENT "strip ${this_target}" -) +SET (this_target osp-shell) + +INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR}/inc + ${CMAKE_SOURCE_DIR}/src + ${CMAKE_SOURCE_DIR}/src/inc + /usr/include/chromium + /usr/include/osp + /usr/include/osp/app + /usr/include/osp/base + /usr/include/osp/io + /usr/include/osp/graphics + /usr/include/osp/ui + /usr/include/osp/security + + /usr/include + /usr/include/appfw + /usr/include/uifw + /usr/include/glib-2.0 + /usr/lib/glib-2.0/include + /usr/include/cairo + /usr/include/chromium + /usr/include/dlog + /usr/include/dbus-1.0 + /usr/include/dri2 + #/usr/include/libdrm + /usr/include/notification + /usr/lib/dbus-1.0/include + /usr/include/e_dbus-1 + /usr/include/elementary-1 + /usr/include/efreet-1 + /usr/include/ecore-1 + /usr/include/edje-1 + /usr/include/evas-1 + /usr/include/eet-1 + /usr/include/eina-1 + /usr/include/eina-1/eina + /usr/include/ethumb-1 + /usr/include/freetype2 + /usr/include/fribidi + /usr/include/harfbuzz + /usr/include/libxml2 + /usr/include/minizip + /usr/include/minicontrol + /usr/include/pango-1.0 + /usr/include/pixman-1 + /usr/include/system + /usr/include/vconf +) + +SET (${this_target}_SOURCE_FILES + FShlNotificationManager.cpp + FShl_NotificationManagerImpl.cpp + FShlNotificationRequest.cpp + FShl_NotificationRequestImpl.cpp + FShl_NotificationManagerProxy.cpp + FShl_NotificationManagerIpcMessages.cpp + FShlQuickPanelFrame.cpp + FShl_QuickPanelFrame.cpp + FShl_QuickPanelFrameImpl.cpp + FShl_QuickPanelFramePresenter.cpp +) + +## Definitions +SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wall" ) + +## SET C COMPILER FLAGS +SET(CMAKE_C_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}") + +## SET CPP COMPILER FLAGS +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden") +SET(CMAKE_CXX_FLAGS "${OSP_DEBUG_FLAGS} ${OSP_OPT_FLAGS} ${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} ${OSP_COMPILER_FLAGS}") + +## Create Library +ADD_LIBRARY (${this_target} SHARED ${${this_target}_SOURCE_FILES}) + +## SET LINKER FLAGS +SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined -Wl,--as-needed") + +TARGET_LINK_LIBRARIES(${this_target} "-lchromium" ) +TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-appfw" ) +TARGET_LINK_LIBRARIES(${this_target} "-L/usr/lib/osp -losp-uifw" ) +TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-application" ) +TARGET_LINK_LIBRARIES(${this_target} "-lcapi-appfw-app-manager" ) +TARGET_LINK_LIBRARIES(${this_target} "-lnotification" ) +TARGET_LINK_LIBRARIES(${this_target} "-lecore" ) +TARGET_LINK_LIBRARIES(${this_target} "-levas" ) +TARGET_LINK_LIBRARIES(${this_target} "-leina" ) +TARGET_LINK_LIBRARIES(${this_target} "-lecore_evas" ) +TARGET_LINK_LIBRARIES(${this_target} "-lminicontrol-provider" ) +#TARGET_LINK_LIBRARIES(${this_target} "-lcapi-system-runtime-info") + +SET_TARGET_PROPERTIES(${this_target} + PROPERTIES + VERSION ${FULLVER} + SOVERSION ${MAJORVER} + CLEAN_DIRECT_OUTPUT 1 +) + +ADD_CUSTOM_COMMAND(TARGET ${this_target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} + COMMAND ${CMAKE_COMMAND} -E create_symlink ${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${FULLVER} ${LIBRARY_OUTPUT_PATH}/debug/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX}.${MAJORVER} + COMMAND ${CMAKE_STRIP} --strip-unneeded ${LIBRARY_OUTPUT_PATH}/${CMAKE_SHARED_LIBRARY_PREFIX}${this_target}${CMAKE_SHARED_LIBRARY_SUFFIX} + COMMENT "strip ${this_target}" +) diff --git a/src/FShlNotificationManager.cpp b/src/FShlNotificationManager.cpp index 8fbd8da..03f5e1e 100644 --- a/src/FShlNotificationManager.cpp +++ b/src/FShlNotificationManager.cpp @@ -20,15 +20,17 @@ * @brief This is the placeholder for NotificationManager class. */ -#if 0 #include +#include #include -#include +#include #include +#include "FShl_NotificationManagerImpl.h" using namespace Osp::Base; +using namespace Osp::App; using namespace Osp::Security; namespace Osp { namespace Shell @@ -113,7 +115,7 @@ NotificationManager::Notify(const String& messageText, int badgeNumber, const St } result -NotificationManager::Notify(const NotificationMessage& notiMessage) +NotificationManager::Notify(const NotificationRequest& notiMessage) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -124,7 +126,7 @@ NotificationManager::Notify(const NotificationMessage& notiMessage) } result -NotificationManager::Notify(const AppId& appId,const NotificationMessage& notiMessage) +NotificationManager::NotifyByAppId(const AppId& appId,const NotificationRequest& notiMessage) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -135,7 +137,7 @@ NotificationManager::Notify(const AppId& appId,const NotificationMessage& notiMe } int -NotificationManager::GetBadgeNumber(const AppId& appId) +NotificationManager::GetBadgeNumberByAppId(const AppId& appId) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -169,7 +171,7 @@ NotificationManager::NotifyOngoingActivity(const String& messageText, const Stri } result -NotificationManager::NotifyOngoingActivity(const NotificationMessage& notiMessage) +NotificationManager::NotifyOngoingActivity(const NotificationRequest& notiMessage) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -180,7 +182,7 @@ NotificationManager::NotifyOngoingActivity(const NotificationMessage& notiMessag } result -NotificationManager::NotifyOngoingActivity(const AppId& appId,const NotificationMessage& notiMessage) +NotificationManager::NotifyOngoingActivityByAppId(const AppId& appId,const NotificationRequest& notiMessage) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); @@ -202,14 +204,14 @@ NotificationManager::RemoveOngoingActivityNotification(void) } result -NotificationManager::RemoveOngoingActivityNotification(const AppId& appId) +NotificationManager::RemoveOngoingActivityNotificationByAppId(const AppId& appId) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER); SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pNotificationManagerImpl->RemoveOngoingActivityNotificationOnBehalf(appId); + return __pNotificationManagerImpl->RemoveOngoingActivityNotificationByAppId(appId); } result @@ -224,16 +226,15 @@ NotificationManager::RemoveNotification(void) } result -NotificationManager::RemoveNotification(const AppId& appId) +NotificationManager::RemoveNotificationByAppId(const AppId& appId) { SysAssertf(__pNotificationManagerImpl != null, "Not yet constructed. Construct() should be called before use."); result r = _AccessController::CheckUserPrivilege(_PRV_NOTIFICATIONMANAGER); SysTryReturnResult(NID_APP, !IsFailed(r), E_PRIVILEGE_DENIED, "The application does not have the privilege to call this method."); - return __pNotificationManagerImpl->RemoveNotificationOnBehalf(appId); + return __pNotificationManagerImpl->RemoveNotificationByAppId(appId); } }; }; // Osp::Shell -#endif diff --git a/src/FShlNotificationRequest.cpp b/src/FShlNotificationRequest.cpp new file mode 100644 index 0000000..84376da --- /dev/null +++ b/src/FShlNotificationRequest.cpp @@ -0,0 +1,230 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShlNotificationRequest.cpp + * @brief This is the placeholder for NotificationRequest class. + */ + +#include + +#include +#include + +#include +#include "FShl_NotificationRequestImpl.h" + +using namespace Osp::Base; +using namespace Osp::Security; + + +namespace Osp { namespace Shell +{ + +NotificationRequest::NotificationRequest(bool appBinding) + : __pNotificationRequestImpl(null) +{ + __pNotificationRequestImpl = new (std::nothrow) _NotificationRequestImpl(appBinding); + SysTryReturnVoidResult(NID_APP, __pNotificationRequestImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory"); +} + +NotificationRequest::~NotificationRequest() +{ + delete __pNotificationRequestImpl; +} + +NotificationRequest::NotificationRequest(const NotificationRequest& rhs) +{ + __pNotificationRequestImpl = new (std::nothrow) _NotificationRequestImpl(*rhs.__pNotificationRequestImpl); + SysTryReturnVoidResult(NID_APP, __pNotificationRequestImpl, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory"); +} + +NotificationRequest& +NotificationRequest::operator =(const NotificationRequest& rhs) +{ + if (&rhs != this) + { + delete __pNotificationRequestImpl; + + __pNotificationRequestImpl = new (std::nothrow) _NotificationRequestImpl(*rhs.__pNotificationRequestImpl); + SysTryReturn(NID_APP, __pNotificationRequestImpl, *this, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory"); + } + + return(*this); +} + +bool +NotificationRequest::Equals(const Object& rhs) const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + return __pNotificationRequestImpl->Equals(rhs); +} + +int +NotificationRequest::GetHashCode(void) const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + return __pNotificationRequestImpl->GetHashCode(); +} + +int +NotificationRequest::GetBadgeNumber(void) const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetBadgeNumber(); +} + +result +NotificationRequest::SetBadgeNumber(int badgeNumber) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetBadgeNumber(badgeNumber); +} + +int +NotificationRequest::GetBadgeOffset() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetBadgeOffset(); +} + +result +NotificationRequest::SetBadgeOffset(int badgeOffset) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetBadgeOffset(badgeOffset); +} + +String +NotificationRequest::GetAlertText() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetAlertText(); +} + +result +NotificationRequest::SetAlertText(const String& alertText) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetAlertText(alertText); +} + +String +NotificationRequest::GetAppMessage() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetAppMessage(); +} + + +result +NotificationRequest::SetAppMessage(const String& appMessage) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetAppMessage(appMessage); +} + +String +NotificationRequest::GetTitleText() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetTitleText(); +} + +result +NotificationRequest::SetTitleText(const String& titleText) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetTitleText(titleText); +} + +String +NotificationRequest::GetIconFilePath() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetIconFilePath(); +} + +result +NotificationRequest::SetIconFilePath(const String& iconFilePath) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetIconFilePath(iconFilePath); +} + +String +NotificationRequest::GetSoundFilePath() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetSoundFilePath(); +} + +result +NotificationRequest::SetSoundFilePath(const String& soundFilePath) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetSoundFilePath(soundFilePath); +} + +OngoingActivityType +NotificationRequest::GetOngoingActivityType() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetOngoingActivityType(); +} + +result +NotificationRequest::SetOngoingActivityType(OngoingActivityType activityType) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetOngoingActivityType(activityType); +} + +int +NotificationRequest::GetOngoingActivityProgress() const +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->GetOngoingActivityProgress(); +} + +result +NotificationRequest::SetOngoingActivityProgress(int progressValue) +{ + SysAssertf(__pNotificationRequestImpl != null, "Instance is not constructed properly."); + + return __pNotificationRequestImpl->SetOngoingActivityProgress(progressValue); +} + +}; +}; // Osp::Shell diff --git a/src/FShl_NotificationManagerEventParamTraits.h b/src/FShl_NotificationManagerEventParamTraits.h new file mode 100644 index 0000000..0d0eae5 --- /dev/null +++ b/src/FShl_NotificationManagerEventParamTraits.h @@ -0,0 +1,119 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationManagerEventParamTraits.h + * @brief This is the header file for NotificationManagerEvent param traits. + */ + +#ifndef _FSHL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_ +#define _FSHL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_ + +#include "FBaseString.h" +#include "FBaseColIList.h" +#include "FBaseColArrayList.h" +#include "FIo_IpcCommonDataTypes.h" + +#include "base/tuple.h" +#include "ipc/ipc_param_traits.h" + +#include "FShlNotificationRequest.h" + + +namespace IPC +{ +template <> +struct ParamTraits +{ + typedef Osp::Shell::NotificationRequest param_type; + + static void Write(Message* m, const param_type& p) + { + WriteParam(m, p.GetAlertText()); + WriteParam(m, p.GetAppMessage()); + WriteParam(m, p.GetTitleText()); + WriteParam(m, p.GetIconFilePath()); + WriteParam(m, p.GetSoundFilePath()); + + m->WriteInt(p.GetBadgeNumber()); + m->WriteInt(p.GetBadgeOffset()); + m->WriteInt((int)p.GetOngoingActivityType()); + m->WriteInt(p.GetOngoingActivityProgress()); + } + + static bool Read(const Message* m, void** iter, param_type* r) + { + Osp::Base::String alertText; + Osp::Base::String appMessage; + Osp::Base::String titleText; + Osp::Base::String iconFilePath; + Osp::Base::String soundFilePath; + + int badgeNo = -1; + int badgeOffset = 0; + int progressValue = -1; + int activityType = Osp::Shell::ONGOING_ACTIVITY_TYPE_TEXT; + + if (!ReadParam(m, iter, &alertText)) + { + return false; + } + if (!ReadParam(m, iter, &appMessage)) + { + return false; + } + if (!ReadParam(m, iter, &titleText)) + { + return false; + } + if (!ReadParam(m, iter, &iconFilePath)) + { + return false; + } + if (!ReadParam(m, iter, &soundFilePath)) + { + return false; + } + m->ReadInt(iter, &badgeNo); + m->ReadInt(iter, &badgeOffset); + m->ReadInt(iter, &progressValue); + m->ReadInt(iter, &activityType); + + Osp::Shell::NotificationRequest notimessage; + notimessage.SetAlertText(alertText); + notimessage.SetAppMessage(appMessage); + notimessage.SetTitleText(titleText); + notimessage.SetIconFilePath(iconFilePath); + notimessage.SetSoundFilePath(soundFilePath); + + notimessage.SetBadgeNumber(badgeNo); + notimessage.SetBadgeOffset(badgeOffset); + notimessage.SetOngoingActivityProgress(progressValue); + notimessage.SetOngoingActivityType((Osp::Shell::OngoingActivityType)activityType); + + *r = notimessage; + + return true; + } + static void Log(const param_type& p, std::string* l) + { + } + +}; +} + +#endif //_FSHL_INTERNAL_NOTIFICATION_MANAGER_EVENT_ARG_PARAM_TRAITS_H_ diff --git a/src/FShl_NotificationManagerImpl.cpp b/src/FShl_NotificationManagerImpl.cpp new file mode 100644 index 0000000..1dd0ff2 --- /dev/null +++ b/src/FShl_NotificationManagerImpl.cpp @@ -0,0 +1,745 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationManagerImpl.cpp + * @brief This is the placeholder for _NotificationManagerImpl class. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include "FApp_AppInfo.h" +#include "FApp_PackageManagerImpl.h" +#include "FApp_Aul.h" +#include "FApp_AppArg.h" +#include "FShl_NotificationManagerImpl.h" +#include "FShl_NotificationManagerProxy.h" + +using namespace Osp::Base; +using namespace Osp::App; +using namespace Osp::Shell; + +extern "C" int service_create_request(bundle *data, service_h *service); + +namespace +{ + +result +ConvertNotificationResult(int error) +{ + switch (error) + { + case UI_NOTIFICATION_ERROR_NONE: + return E_SUCCESS; + case UI_NOTIFICATION_ERROR_INVALID_PARAMETER: + return E_INVALID_ARG; + case UI_NOTIFICATION_ERROR_OUT_OF_MEMORY: + return E_OUT_OF_MEMORY; + case UI_NOTIFICATION_ERROR_DB_FAILED: + return E_DATABASE; + case UI_NOTIFICATION_ERROR_NO_SUCH_FILE: + return E_SYSTEM; + case UI_NOTIFICATION_ERROR_INVALID_STATE: + return E_SYSTEM; + default: + return E_SYSTEM; + } +} + +static int +GetMessageLength() +{ + static int length = (_AppInfo::GetApiVersion() < _API_VERSION_3_0) ? 127 : MAX_NOTIFICATION_MESSAGE_LENGTH; + + return length; +} + +ui_notification_progress_type_e +ConvertToNotificationProgressType(int progressType) +{ + switch (progressType) + { + case ONGOING_ACTIVITY_TYPE_TEXT: + return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE; + case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE: + return UI_NOTIFICATION_PROGRESS_TYPE_SIZE; + case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE: + return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE; + default: + return UI_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE; + } +} + +bool +IsPosted(ui_notification_h handle) +{ + struct ui_notification_s + { + void* raw_handle; + bool ongoing; + bool posted; + bool removed; + char *icon; + struct tm *time; + char *title; + char *content; + service_h service; + char *sound; + bool vibration; + }; + + if (handle == NULL) + { + return false; + } + + ui_notification_s* pStruct = reinterpret_cast(handle); + + return pStruct->posted; +} + +} + +namespace Osp { namespace Shell +{ + +_NotificationManagerImpl::_NotificationManagerImpl(void) +: __pNotificationManager(null) +{ +} + +_NotificationManagerImpl::~_NotificationManagerImpl(void) +{ +} + +result +_NotificationManagerImpl::Construct(void) +{ + result r = E_SUCCESS; + + __pNotificationManager = new (std::nothrow) _NotificationManagerProxy; + SysTryReturnResult(NID_APP, __pNotificationManager != null, E_OUT_OF_MEMORY, "__pNotificationManagerProxy creation failed."); + + r = __pNotificationManager->Construct(); + SysTryCatch(NID_APP, !IsFailed(r), , r, "__pNotificationManager->Construct() failed [%s].", GetErrorMessage(r)); + + return E_SUCCESS; + +CATCH: + delete __pNotificationManager; + __pNotificationManager = null; + + return r; +} + +const _NotificationManagerImpl* +_NotificationManagerImpl::GetInstance(const NotificationManager& notiMgr) +{ + return notiMgr.__pNotificationManagerImpl; +} + +_NotificationManagerImpl* +_NotificationManagerImpl::GetInstance(NotificationManager& notiMgr) +{ + return notiMgr.__pNotificationManagerImpl; +} + +int +_NotificationManagerImpl::GetBadgeNumber(void) const +{ + int count = -1; + notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count); + return count; +} + +result +_NotificationManagerImpl::OngoingImpl(const String& messageText, const String& launchArguments) const +{ + return NotifyImpl(messageText, -1, launchArguments, true); +} + +result +_NotificationManagerImpl::OngoingImpl(const AppId& appId, const String& messageText, const String& launchArguments) const +{ + + return NotifyImpl(appId, messageText, -1, launchArguments, true); +} + +result +_NotificationManagerImpl::NotifyImpl(const String& messageText, int badgeNumber, + const String& launchArguments, + bool isOngoing) const +{ + result r = E_SUCCESS; + int retcode = 0; + char* pMsg = null; + ui_notification_h core = NULL; + char* pkgname = NULL; + + if (!messageText.IsEmpty()) + { + SysTryReturnResult(NID_APP, + messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG, + "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + + retcode = ui_notification_create(isOngoing, &core); + SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_SYSTEM, "Notification creation error : 0x%x.", retcode); + + pMsg = _StringConverter::CopyToCharArrayN(messageText); + + int ret = ui_notification_set_content(core, pMsg); + SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret); + + bundle* pKb = NULL; + service_h svc = NULL; + _AppArg arg; + + app_get_package(&pkgname); + SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application."); + + r = arg.Construct(launchArguments); + SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r)); + + pKb = arg.GetBundle(); + service_create_request(pKb, &svc); + service_set_package(svc, pkgname); + ui_notification_set_service(core, svc); + + SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname); + + r = ConvertNotificationResult(ui_notification_post(core)); + + SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r)); + } + + if (badgeNumber >= 0) + { + notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber); + SysLog(NID_APP, "Badge number is set to %d.", badgeNumber); + } + +CATCH: + delete[] pMsg; + if (pkgname) + { + free(pkgname); + } + + if (core) + { + ui_notification_destroy(core); + } + + return r; +} + +result +_NotificationManagerImpl::NotifyImpl(const AppId& appId, const String& messageText, int badgeNumber, + const String& launchArguments, + bool isOngoing) const +{ + result r = E_SUCCESS; + int retcode = 0; + char* pMsg = null; + char* pIcon = NULL; + char* pName = NULL; + ui_notification_h core = NULL; + char buffer[256]; + + memset(buffer, 0, 256); + + bool b = _Aul::IsInstalled(appId); + + SysTryReturnResult(NID_APP, b == true, E_APP_NOT_INSTALLED, "The application %ls is not installed", appId.GetPointer()); + + if (!isOngoing || !messageText.IsEmpty()) + { + SysTryReturnResult(NID_APP, + messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG, + "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + + retcode = ui_notification_create(isOngoing, &core); + SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_SYSTEM, "Notification creation error : 0x%x.", retcode); + + pMsg = _StringConverter::CopyToCharArrayN(messageText); + + int ret = ui_notification_set_content(core, pMsg); + SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret); + + bundle* pKb = NULL; + service_h svc = NULL; + _AppArg arg; + + snprintf(buffer, 256, "%ls", appId.GetPointer()); + + app_manager_get_app_icon_path(buffer, &pIcon); + ui_notification_set_icon(core, pIcon); + + app_manager_get_app_name(buffer, &pName); + ui_notification_set_title(core, pName); + + r = arg.Construct(launchArguments); + SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r)); + + pKb = arg.GetBundle(); + service_create_request(pKb, &svc); + service_set_app_id(svc, buffer); + ui_notification_set_service(core, svc); + + SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), buffer); + + r = ConvertNotificationResult(ui_notification_post(core)); + + SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r)); + } + + if (badgeNumber >= 0) + { + notification_set_badge(buffer, NOTIFICATION_GROUP_ID_NONE, badgeNumber); + SysLog(NID_APP, "Badge number is set to %d.", badgeNumber); + } + +CATCH: + delete[] pMsg; + + if (core) + { + ui_notification_destroy(core); + } + + if (pIcon) + { + free(pIcon); + } + + if (pName) + { + free(pName); + } + + return r; +} + + +result +_NotificationManagerImpl::NotifyMessageImpl(const NotificationRequest& notiMessage, bool isOngoing) +{ + result r = E_SUCCESS; + int retcode = 0; + int progress = -1; + ui_notification_h core = NULL; + char* pkgname = NULL; + char* pTitleText = NULL; + char* pIconPath = NULL; + char* pSoundPath = NULL; + + const String& messageText = notiMessage.GetAlertText(); + const String& launchArguments = notiMessage.GetAppMessage(); + const String& titleText = notiMessage.GetTitleText(); + const String& iconPath = notiMessage.GetIconFilePath(); + const String& soundPath = notiMessage.GetSoundFilePath(); + const int badgeNumber = notiMessage.GetBadgeNumber(); + const int badgeOffset = notiMessage.GetBadgeOffset(); + + if (isOngoing || !messageText.IsEmpty()) + { + SysTryReturnResult(NID_APP, + messageText.GetLength() <= GetMessageLength(), E_INVALID_ARG, + "MessageText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + + retcode = ui_notification_create(isOngoing, &core); + SysTryReturnResult(NID_APP, retcode == UI_NOTIFICATION_ERROR_NONE, E_SYSTEM, "Notification creation error : 0x%x.", retcode); + + std::unique_ptr pMsg(_StringConverter::CopyToCharArrayN(messageText)); + + if (pMsg) + { + int ret = ui_notification_set_content(core, pMsg.get()); + SysTryLog(NID_APP, ret == UI_NOTIFICATION_ERROR_NONE, "Setting notification content failure : %d.", ret); + } + + if (!titleText.IsEmpty()) + { + pTitleText = _StringConverter::CopyToCharArrayN(titleText); + ui_notification_set_title(core, pTitleText); + } + + if (!iconPath.IsEmpty()) + { + pIconPath = _StringConverter::CopyToCharArrayN(iconPath); + ui_notification_set_icon(core, pIconPath); + } + + if (!soundPath.IsEmpty()) + { + pSoundPath = _StringConverter::CopyToCharArrayN(soundPath); + ui_notification_set_sound(core, pSoundPath); + } + + bundle* pKb = NULL; + service_h svc = NULL; + _AppArg arg; + + app_get_id(&pkgname); + SysTryCatch(NID_APP, pkgname != NULL, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Cannot acquire package name for current application."); + + r = arg.Construct(launchArguments); + SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Propagating.", GetErrorMessage(r)); + + pKb = arg.GetBundle(); + service_create_request(pKb, &svc); + service_set_app_id(svc, pkgname); + + ui_notification_set_service(core, svc); + SysLog(NID_APP, "Sending notification[%ls] for package %s.", messageText.GetPointer(), pkgname); + + if (isOngoing) + { + OngoingActivityType activityType = notiMessage.GetOngoingActivityType(); + progress = notiMessage.GetOngoingActivityProgress(); + switch (activityType) + { + case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE: + if (!IsPosted(core)) + { + ui_notification_post(core); + } + r = ConvertNotificationResult(ui_notification_update_progress(core, ConvertToNotificationProgressType(activityType), progress/100.)); + break; + case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE: + if (!IsPosted(core)) + { + ui_notification_post(core); + } + r = ConvertNotificationResult(ui_notification_update_progress(core, ConvertToNotificationProgressType(activityType), progress)); + break; + case ONGOING_ACTIVITY_TYPE_TEXT: + r = ConvertNotificationResult(ui_notification_post(core)); + break; + default: + r = E_SYSTEM; + // ui_notification_set_content() is done already + break; + } + } + + SysTryLog(NID_APP, !IsFailed(r), "[%s] Notification post failure.", GetErrorMessage(r)); + } + else + { + SysTryReturnResult(NID_APP, 0, E_INVALID_ARG, "MessageText is Empty"); + } + + if (badgeNumber >= 0) + { + notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, badgeNumber); + SysLog(NID_APP, "Badge number is set to %d.", badgeNumber); + } + + if (badgeOffset != 0) + { + // badge offset is exclusive to badge number + + int count = 0; + notification_error_e noti_err = notification_get_badge(NULL, NOTIFICATION_GROUP_ID_NONE, &count); + if (noti_err == NOTIFICATION_ERROR_NONE) + { + count += badgeOffset; + if (count > 0) + { + notification_set_badge(NULL, NOTIFICATION_GROUP_ID_NONE, count); + SysLog(NID_APP, "Badge number is set to %d.", count); + } + } + } + +CATCH: + delete[] pIconPath; + delete[] pTitleText; + delete[] pSoundPath; + if (pkgname) + { + free(pkgname); + } + if (core) + { + ui_notification_destroy(core); + } + + return r; +} + +result +_NotificationManagerImpl::NotifyMessageImpl(const AppId& appId, const NotificationRequest& notiMessage, bool isOngoing) +{ + return __pNotificationManager->NotifyMessage(appId, notiMessage, isOngoing); +} + + +result +_NotificationManagerImpl::Notify(int badgeNumber) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + + if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER) + { + badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER; + } + + String messageText = String(L""); + String appMessage = String(L""); + + return NotifyImpl(messageText, badgeNumber, appMessage, false); +} + +result +_NotificationManagerImpl::Notify(const String& messageText) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + String appMessage = String(L""); + + return NotifyImpl(messageText, -1, appMessage, false); +} + +result +_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER) + { + badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER; + } + + String appMessage = String(L""); + + return NotifyImpl(messageText, badgeNumber, appMessage, false); +} + +result +_NotificationManagerImpl::Notify(const String& messageText, int badgeNumber, const String& launchArguments) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + SysTryReturnResult(NID_APP, + launchArguments != null && launchArguments.GetLength() > 0, E_INVALID_ARG, + "launchArguments is less than 0."); + + SysTryReturnResult(NID_APP, + launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG, + "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH."); + + if (badgeNumber > MAX_NOTIFICATION_BADGE_NUMBER) + { + badgeNumber = MAX_NOTIFICATION_BADGE_NUMBER; + } + + return NotifyImpl(messageText, badgeNumber, launchArguments, false); +} + +int +_NotificationManagerImpl::GetBadgeNumber(const AppId& appId) const +{ + bool b = _Aul::IsInstalled(appId); + + SysTryReturn(NID_APP, b == true, -1, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The application %ls is not installed", + appId.GetPointer()); + + char buffer[256]; + int count = -1; + + memset(buffer, 0, 256); + + snprintf(buffer, 256, "%ls", appId.GetPointer()); + + notification_get_badge(buffer, NOTIFICATION_GROUP_ID_NONE, &count); + + return count; +} + + +result +_NotificationManagerImpl::NotifyByAppId(const AppId& appId, int badgeNumber) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + + String messageText = String(L""); + String appMessage = String(L""); + return NotifyImpl(appId, messageText, badgeNumber, appMessage); +} + +result +_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + return NotifyImpl(appId, messageText, -1, String(L"")); +} + +result +_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + return NotifyImpl(appId, messageText, badgeNumber, String(L"")); +} + +result +_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, const String& launchArguments) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0."); + SysTryReturnResult(NID_APP, + launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG, + "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH."); + + return NotifyImpl(appId, messageText, -1, launchArguments); +} + +result +_NotificationManagerImpl::NotifyByAppId(const AppId& appId, const String& messageText, int badgeNumber, + const String& launchArguments) const +{ + SysTryReturnResult(NID_APP, badgeNumber >= 0, E_INVALID_ARG, "BadgeNumber is less than 0."); + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0."); + SysTryReturnResult(NID_APP, + launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG, + "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH."); + + return NotifyImpl(appId, messageText, badgeNumber, launchArguments); +} + +result +_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + return OngoingImpl(messageText, String(L"")); +} + +result +_NotificationManagerImpl::NotifyOngoingActivity(const String& messageText, const String& launchArguments) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0."); + SysTryReturnResult(NID_APP, + launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG, + "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH."); + + return OngoingImpl(messageText, launchArguments); +} + +result +_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + + return OngoingImpl(appId, messageText, String(L"")); +} + +result +_NotificationManagerImpl::NotifyOngoingActivityByAppId(const AppId& appId, const String& messageText, + const String& launchArguments) const +{ + SysTryReturnResult(NID_APP, messageText.GetLength() > 0, E_INVALID_ARG, "MessageText is less than 0."); + SysTryReturnResult(NID_APP, launchArguments.GetLength() > 0, E_INVALID_ARG, "launchArguments is less than 0."); + SysTryReturnResult(NID_APP, + launchArguments.GetLength() <= MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH, E_INVALID_ARG, + "launchArguments is greater than MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH."); + + return OngoingImpl(appId, messageText, launchArguments); +} + +result +_NotificationManagerImpl::RemoveOngoingActivityNotification(void) +{ + result r = E_SUCCESS; + + notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_ONGOING); + switch (err) + { + case NOTIFICATION_ERROR_NONE: + r = E_SUCCESS; + break; + + case NOTIFICATION_ERROR_INVALID_DATA: + r = E_INVALID_ARG; + break; + + default: + r = E_SYSTEM; + break; + } + + return r; +} + +result +_NotificationManagerImpl::RemoveOngoingActivityNotificationByAppId(const AppId& appId) +{ + return __pNotificationManager->RemoveNotification(appId, true); +} + +result +_NotificationManagerImpl::RemoveNotification(void) +{ + result r = E_SUCCESS; + + notification_error_e err = notification_delete_all_by_type(NULL, NOTIFICATION_TYPE_NOTI); + switch (err) + { + case NOTIFICATION_ERROR_NONE: + r = E_SUCCESS; + break; + + case NOTIFICATION_ERROR_INVALID_DATA: + r = E_INVALID_ARG; + break; + + default: + r = E_SYSTEM; + break; + } + + return r; +} + +result +_NotificationManagerImpl::RemoveNotificationByAppId(const AppId& appId) +{ + return __pNotificationManager->RemoveNotification(appId,false); +} + +}; +}; // Osp::Shell diff --git a/src/FShl_NotificationManagerIpcMessages.cpp b/src/FShl_NotificationManagerIpcMessages.cpp new file mode 100644 index 0000000..6434cd3 --- /dev/null +++ b/src/FShl_NotificationManagerIpcMessages.cpp @@ -0,0 +1,46 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FApp_NotificationManagerIpcMessages.cpp + * @brief This file contains IPC message class generated by macros. + */ + +#define IPC_MESSAGE_IMPL +#include "FShl_NotificationManagerIpcMessages.h" + +// Generate constructors. +#include "ipc/struct_constructor_macros.h" +#include "FShl_NotificationManagerIpcMessages.h" +// Generate destructors. + +#include "ipc/struct_destructor_macros.h" +#include "FShl_NotificationManagerIpcMessages.h" + +// Generate param traits write methods. +#include "ipc/param_traits_write_macros.h" +namespace IPC +{ +#include "FShl_NotificationManagerIpcMessages.h" +} // namespace IPC + +// Generate param traits read methods. +#include "ipc/param_traits_read_macros.h" +namespace IPC +{ +#include "FShl_NotificationManagerIpcMessages.h" +} // namespace IPC diff --git a/src/FShl_NotificationManagerIpcMessages.h b/src/FShl_NotificationManagerIpcMessages.h new file mode 100644 index 0000000..f6afcc0 --- /dev/null +++ b/src/FShl_NotificationManagerIpcMessages.h @@ -0,0 +1,34 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationManagerIpcMessages.h + * @brief This is the header file for the NotificationManager Ipc message types. + */ + +#include +#include + +#include "ipc/ipc_message_macros.h" +#include "FIo_IpcCommonParamTraits.h" +#include "FShl_NotificationManagerEventParamTraits.h" + +#define IPC_MESSAGE_START NotificationManagerServiceStart + +IPC_SYNC_MESSAGE_CONTROL3_1(NotificationManager_NotifyMessage, Osp::App::AppId, Osp::Shell::NotificationRequest, bool, result) +IPC_SYNC_MESSAGE_CONTROL2_1(NotificationManager_RemoveNotification, Osp::App::AppId, bool, result) + diff --git a/src/FShl_NotificationManagerProxy.cpp b/src/FShl_NotificationManagerProxy.cpp new file mode 100644 index 0000000..c962097 --- /dev/null +++ b/src/FShl_NotificationManagerProxy.cpp @@ -0,0 +1,92 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationManagerProxy.cpp + * @brief This is the implementation for the _NotificationManagerProxy.cpp class. + */ + +#include +#include + +#include +#include +#include +#include + +#include + +#include "FShl_NotificationManagerIpcMessages.h" +#include "FShl_NotificationManagerEventParamTraits.h" +#include "FShl_NotificationManagerProxy.h" + +using namespace Osp::Base; +using namespace Osp::App; + +namespace Osp { namespace Shell +{ + +_NotificationManagerProxy::_NotificationManagerProxy(void) + : __pIpcClient(null) +{ +} + +_NotificationManagerProxy::~_NotificationManagerProxy(void) +{ +} + +result +_NotificationManagerProxy::Construct() +{ + __pIpcClient = new (std::nothrow) Osp::Io::_IpcClient(); + SysTryReturnResult(NID_APP, __pIpcClient != null, E_OUT_OF_MEMORY, "_IpcClient creation failed."); + + result r = __pIpcClient->Construct("osp.app.ipcserver.notificationmanager"); + SysTryReturn(NID_APP, !IsFailed(r), r, r, "_IpcClient constructing failed [%s].", GetErrorMessage(r)); + + return E_SUCCESS; +} + +result +_NotificationManagerProxy::NotifyMessage(const AppId& appId, const NotificationRequest& notiMessage, bool Ongoing) +{ + SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null."); + + result response = E_SUCCESS; + std::auto_ptr pMsg (new (std::nothrow) NotificationManager_NotifyMessage(appId, notiMessage, Ongoing, &response)); + result r = __pIpcClient->SendRequest(*pMsg.get()); + + SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return response; +} + +result +_NotificationManagerProxy::RemoveNotification(const AppId& appId, bool Ongoing) +{ + SysTryReturnResult(NID_APP, __pIpcClient != null, E_INVALID_STATE, "__pIpcClient instance must not be null."); + + result response = E_SUCCESS; + std::auto_ptr pMsg (new (std::nothrow) NotificationManager_RemoveNotification(appId, Ongoing, &response)); + result r = __pIpcClient->SendRequest(*pMsg.get()); + + SysTryReturn(NID_APP, !IsFailed(r), r, r, "__pIpcClient->SendRequest is failed. (%s)", GetErrorMessage(r)); + + return response; +} + +} } // Osp::Shell diff --git a/src/FShl_NotificationManagerProxy.h b/src/FShl_NotificationManagerProxy.h new file mode 100644 index 0000000..6ed790b --- /dev/null +++ b/src/FShl_NotificationManagerProxy.h @@ -0,0 +1,67 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationManagerProxy.h + * @brief This is the header file of the _NotificationManagerProxy class. + */ + +#ifndef _FSHL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_ +#define _FSHL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_ + +#include +#include +#include + +namespace Osp { namespace Io { class _IpcClient; } } + +namespace Osp { namespace Shell +{ + +class NotificationRequest; + +/** + * @class _NotificationManagerProxy + * @brief + * @since 3.0 + */ +class _NotificationManagerProxy + : public Osp::Base::Object +{ +public: + _NotificationManagerProxy(void); + virtual ~_NotificationManagerProxy(void); + + result Construct(void); + + result NotifyMessage(const Osp::App::AppId& appId, const NotificationRequest& message, bool Ongoing); + result RemoveNotification(const Osp::App::AppId& appId, bool Ongoing); + + +private: + _NotificationManagerProxy(const _NotificationManagerProxy& rhs); + + _NotificationManagerProxy& operator =(const _NotificationManagerProxy& rhs); + +private: + Osp::Io::_IpcClient* __pIpcClient; + +}; // _NotificationManagerProxy + +} } // Osp::Shell + +#endif // _FSHL_INTERNAL_NOTIFICATION_MANAGER_PROXY_H_ diff --git a/src/FShl_NotificationRequestImpl.cpp b/src/FShl_NotificationRequestImpl.cpp new file mode 100644 index 0000000..e6370f5 --- /dev/null +++ b/src/FShl_NotificationRequestImpl.cpp @@ -0,0 +1,367 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationRequestImpl.cpp + * @brief This is the placeholder for _NotificationRequestImpl class. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include "FShl_NotificationRequestImpl.h" + + +using namespace Osp::Base; +using namespace Osp::Io; + +namespace Osp { namespace Shell +{ + +_NotificationRequestImpl::_NotificationRequestImpl(bool appBinding) + : __appBinding(true) + , __badgeNumber(-1) + , __badgeOffset(0) + , __progressValue(-1) + , __activityType(ONGOING_ACTIVITY_TYPE_TEXT) +{ +} + +_NotificationRequestImpl::_NotificationRequestImpl(const _NotificationRequestImpl& notificationMessage) + : __appBinding(notificationMessage.__appBinding) + , __badgeNumber(notificationMessage.__badgeNumber) + , __badgeOffset(notificationMessage.__badgeOffset) + , __progressValue(notificationMessage.__progressValue) + , __activityType(notificationMessage.__activityType) + , __alertText(notificationMessage.__alertText) + , __appMessage(notificationMessage.__appMessage) + , __titleText(notificationMessage.__titleText) + , __iconFilePath(notificationMessage.__iconFilePath) + , __soundFilePath(notificationMessage.__soundFilePath) +{ +} + +_NotificationRequestImpl::~_NotificationRequestImpl() +{ +} + +_NotificationRequestImpl& +_NotificationRequestImpl::operator =(const _NotificationRequestImpl& notificationMessage) +{ + if (this != ¬ificationMessage) + { + __appBinding = notificationMessage.__appBinding; + __badgeNumber = notificationMessage.__badgeNumber; + __badgeOffset = notificationMessage.__badgeOffset; + __progressValue = notificationMessage.__progressValue; + __activityType = notificationMessage.__activityType; + __alertText = notificationMessage.__alertText; + __appMessage = notificationMessage.__appMessage; + __titleText = notificationMessage.__titleText; + __iconFilePath = notificationMessage.__iconFilePath; + __soundFilePath = notificationMessage.__soundFilePath; + } + return *this; +} + +bool +_NotificationRequestImpl::Equals(const Object& rhs) const +{ + const NotificationRequest* pMsg = dynamic_cast(&rhs); + if (pMsg == null) + { + return false; + } + + const _NotificationRequestImpl* pMsgImpl = pMsg->__pNotificationRequestImpl; + if (pMsgImpl == this) + { + return true; + } + + if (__appBinding != pMsgImpl->__appBinding) + { + return false; + } + + if (__badgeNumber != pMsgImpl->__badgeNumber) + { + return false; + } + + if (__badgeOffset != pMsgImpl->__badgeOffset) + { + return false; + } + + if (__progressValue != pMsgImpl->__progressValue) + { + return false; + } + + if (__activityType != pMsgImpl->__activityType) + { + return false; + } + + if (GetHashCode() != pMsgImpl->GetHashCode()) + { + return false; + } + + if (__alertText != pMsgImpl->__alertText) + { + return false; + } + + if (__appMessage != pMsgImpl->__appMessage) + { + return false; + } + + if (__titleText != pMsgImpl->__titleText) + { + return false; + } + + if (__iconFilePath != pMsgImpl->__iconFilePath) + { + return false; + } + + if (__soundFilePath != __soundFilePath) + { + return false; + } + + return true; +} + +int +_NotificationRequestImpl::GetHashCode(void) const +{ + return Boolean(__appBinding).GetHashCode() + ^ Integer(__badgeNumber).GetHashCode() + ^ Integer(__badgeOffset).GetHashCode() + ^ Integer(__progressValue).GetHashCode() + ^ Integer(__activityType).GetHashCode() + ^ __alertText.GetHashCode() + ^ __appMessage.GetHashCode() + ^ __titleText.GetHashCode() + ^ __iconFilePath.GetHashCode() + ^ __soundFilePath.GetHashCode(); +} + +int +_NotificationRequestImpl::GetBadgeNumber(void) const +{ + return __badgeNumber; +} + +result +_NotificationRequestImpl::SetBadgeNumber(int badgeNumber) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, badgeNumber >= 0 && badgeNumber <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG, + "BadgeNumber is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER."); + + __badgeOffset = 0; + __badgeNumber = badgeNumber; + return r; +} + +int +_NotificationRequestImpl::GetBadgeOffset() const +{ + return __badgeOffset; +} + +result +_NotificationRequestImpl::SetBadgeOffset(int badgeOffset) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, badgeOffset >= 0 && badgeOffset <= MAX_NOTIFICATION_BADGE_NUMBER, E_INVALID_ARG, + "BadgeOffset is less than 0 or greater than MAX_NOTIFICATION_BADGE_NUMBER."); + + __badgeNumber = -1; + __badgeOffset = badgeOffset; + return r; +} + +String +_NotificationRequestImpl::GetAlertText() const +{ + return __alertText; +} + +result +_NotificationRequestImpl::SetAlertText(const String& alertText) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, alertText.GetLength() > 0 && alertText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG, + "AlertText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + + __alertText = alertText; + return r; +} + +String +_NotificationRequestImpl::GetAppMessage() const +{ + return __appMessage; +} + + +result +_NotificationRequestImpl::SetAppMessage(const String& appMessage) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, appMessage.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG, + "AppMessage is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + SysTryReturnResult(NID_APP, __appBinding, E_INVALID_OPERATION, + "The Notification instance is not bound to Application"); + + __appMessage = appMessage; + return r; +} + +String +_NotificationRequestImpl::GetTitleText() const +{ + return __titleText; +} + +result +_NotificationRequestImpl::SetTitleText(const String& titleText) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, titleText.GetLength() <= MAX_NOTIFICATION_MESSAGE_LENGTH, E_INVALID_ARG, + "TitleText is greater than MAX_NOTIFICATION_MESSAGE_LENGTH."); + __titleText = titleText; + return r; +} + +String +_NotificationRequestImpl::GetIconFilePath() const +{ + return __iconFilePath; +} + +result +_NotificationRequestImpl::SetIconFilePath(const String& iconFilePath) +{ + result r = E_SUCCESS; + bool isExist = false; + + isExist = File::IsFileExist(iconFilePath); + SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG,"The Specified File is Invalid"); + + __iconFilePath = iconFilePath; + return r; +} + +String +_NotificationRequestImpl::GetSoundFilePath() const +{ + return __soundFilePath; +} + +result +_NotificationRequestImpl::SetSoundFilePath(const String& soundFilePath) +{ + result r = E_SUCCESS; + bool isExist = false; + + isExist = File::IsFileExist(soundFilePath); + SysTryReturnResult(NID_APP, isExist, E_INVALID_ARG,"The Specified File is Invalid"); + + __soundFilePath = soundFilePath; + return r; +} + +OngoingActivityType +_NotificationRequestImpl::GetOngoingActivityType() const +{ + return __activityType; +} + +result +_NotificationRequestImpl::SetOngoingActivityType(OngoingActivityType activityType) +{ + result r = E_SUCCESS; + + // to prevent weired gcc optimization for enum type + int type = static_cast(activityType); + + switch (type) + { + case ONGOING_ACTIVITY_TYPE_TEXT: + break; + case ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE: + SysTryReturnResult(NID_APP, __progressValue == -1 || (__progressValue >= 0 && __progressValue <= 100), E_INVALID_STATE, "Incompatible progress value %d.", __progressValue); + break; + case ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE: + break; + default: + SetLastResult(E_INVALID_STATE); + SysLogException(NID_APP, E_INVALID_STATE, "Invalid activity type %d.", type); + return E_INVALID_STATE; + } + + __activityType = activityType; + return r; +} + +int +_NotificationRequestImpl::GetOngoingActivityProgress() const +{ + return __progressValue; +} + +result +_NotificationRequestImpl::SetOngoingActivityProgress(int progressValue) +{ + result r = E_SUCCESS; + SysTryReturnResult(NID_APP, progressValue >= 0, E_INVALID_ARG,"The progress value is less than 0"); + + // use int type instead of OngoingActivityType to evade weired gcc optimization + int activitytype = static_cast(GetOngoingActivityType()); + SysTryReturnResult(NID_APP, activitytype > ONGOING_ACTIVITY_TYPE_TEXT && activitytype <= ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE, + E_INVALID_STATE,"Invalid activity Type %d.", activitytype); + + if (activitytype == ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE) + { + SysTryReturnResult(NID_APP, progressValue <= 100, E_INVALID_ARG,"Invalid Progress value"); + } + __progressValue = progressValue; + return r; +} + +bool +_NotificationRequestImpl::IsAppBinding()const +{ + return __appBinding; +} + +}; +}; // Osp::Shell diff --git a/src/FShl_NotificationRequestImpl.h b/src/FShl_NotificationRequestImpl.h new file mode 100644 index 0000000..7f26fc4 --- /dev/null +++ b/src/FShl_NotificationRequestImpl.h @@ -0,0 +1,333 @@ +// +// Open Service Platform +// Copyright (c) 2012 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. +// + +/** + * @file FShl_NotificationRequestImpl.h + * @brief This is the header file for the %_NotificationRequestImpl class. + */ + +#ifndef _FSHL_INTERNAL_NOTIFICATION_REQUEST_IMPL_H_ +#define _FSHL_INTERNAL_NOTIFICATION_REQUEST_IMPL_H_ + +#include +#include +#include + +namespace Osp { namespace Shell +{ + +class NotificationRequest; + +class _NotificationRequestImpl + : public Osp::Base::Object +{ + +public: + /** + * This is the default constructor for this class. + * + * @since 3.0 + */ + _NotificationRequestImpl(bool appBinding); + + /** + * This is the destructor for this class. + * + * @since 3.0 + */ + virtual ~_NotificationRequestImpl(void); + + /** + * This is the copy constructor for this class. + * + * @since 3.0 + * + * @param[in] rhs An instance of NotificationRequest + */ + _NotificationRequestImpl(const _NotificationRequestImpl& notificationMessage); + + /** + * This is the assignment operator. + * + * @since 3.0 + * + * @param[in] rhs An instance of NotificationRequest + */ + _NotificationRequestImpl& operator =(const _NotificationRequestImpl& notificationMessage); + + /** + * Checks whether the specified instance of %NotificationRequest equals the current instance. + * + * @since 3.0 + * + * @return @c true if the specified instance equals the current instance, @n + * else @c false + * @param[in] rhs An instance of %NotificationRequest + * @remarks The method returns @c false if the specified object is not %NotificationRequest. + */ + virtual bool Equals(const Object& rhs) const; + + /** + * Gets the hash value of the current instance. + * + * @since 3.0 + * + * @return The hash value of the current instance + */ + virtual int GetHashCode(void) const; + + /** + * Gets the badge number of the application icon. + * + * @since 3.0 + * + * @return The current badge number + * @exception E_SUCCESS The method is successful. + * @exception E_SYSTEM A system error has occurred. + * @remarks The specific error code can be accessed using the GetLastResult() method. @n + * In case of failure, this method returns @c -1. + */ + int GetBadgeNumber(void) const; + + /** + * Gets the badge number of the application icon. + * + * @since 3.0 + * + * @return The current badge number + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified @c value is less than 0, or greater than App::MAX_NOTIFICATION_BADGE_NUMBER. + * @remarks The specific error code can be accessed using the GetLastResult() method. @n + * In case of failure, this method returns @c -1. + */ + result SetBadgeNumber(int badgeNo); +/** + * Gets the badge number offset of the notification message. + * + * @since 3.0 + * + * @return The badge offset value + */ + int GetBadgeOffset(void) const; + + /** + * Sets a badge number offset of the notification message. @n + * %NotificationRequest has either badge number or badge number offset. + * If the badge number offset is set using SetBadgeOffset(), then previous badge number value is cleared. + * + * @since 3.0 + * + * @return An error code + * @param[in] value The badge number value + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The absolute value of the specified @c value is greater than App::MAX_NOTIFICATION_BADGE_NUMBER. + * @see SetBadgeNumber() + */ + result SetBadgeOffset(int value); + + /** + * Gets the alert text of the notification message. + * + * @since 3.0 + * + * @return The alert text + */ + Osp::Base::String GetAlertText(void) const; + + /** + * Sets an alert text of the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] text The alert text + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The length of @c text is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + */ + result SetAlertText(const Osp::Base::String& text); + + /** + * Gets the application message of the notification message.@n + * This message is delivered to the application as the launch arguments. + * + * @since 3.0 + * + * @return The message for application + */ + Osp::Base::String GetAppMessage(void) const; + + /** + * Sets the application message of the notification message.@n + * This message is delivered to the application as the launch arguments. + * + * @since 3.0 + * + * @return An error code + * @param[in] appMessage The message for the application + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The length of @c appMessage is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * @exception E_INVALID_OPERATION This instance is not bound to application. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @remarks This method returns E_INVALID_OPERATION if %NotificationRequest instance is not bound to application. + */ + result SetAppMessage(const Osp::Base::String& appMessage); + + /** + * Gets the title text of the notification message. + * + * @since 3.0 + * + * @return The title text + */ + Osp::Base::String GetTitleText(void) const; + + /** + * Sets an alert text of the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] title The title text + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The length of @c title is greater than App::MAX_NOTIFICATION_TITLE_LENGTH. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + */ + result SetTitleText(const Osp::Base::String& title); + + /** + * Gets the file path of the icon image for the notification message. + * + * @since 3.0 + * + * @return The file path of the icon image + */ + Osp::Base::String GetIconFilePath(void) const; + + /** + * Sets a file path of the icon image for the notification message. + * + * @since 3.0 + * + * @return An error code + * @param[in] iconPath The file path of the icon image + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified path is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + */ + result SetIconFilePath(const Osp::Base::String& iconPath); + + /** + * Gets the file path of the sound file to be played for the notification message. + * + * @since 3.0 + * + * @return The file path of the sound file + */ + Osp::Base::String GetSoundFilePath(void) const; + + /** + * Sets a file path of the sound file to be played for the notification message. @n + * The sound file should be wave file format. + * + * @since 3.0 + * + * @return An error code + * @param[in] soundPath The file path of the sound file + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG The specified path is invalid. + * @exception E_OUT_OF_MEMORY The memory is insufficient. + * @remarks If the format of the sound file is not valid, then the sound file is not played properly when the notification message is shown. + */ + result SetSoundFilePath(const Osp::Base::String& soundPath); + + /** + * Gets the notification type for ongoing-activity notification. + * + * @since 3.0 + * + * @return ongoing-activity notification type + * @remarks This information is only meaningful when the NotificationRequest instance is delivered to NotificationManager::NotifyOngoingActivity() method. + * @see NotificationManager::NotifyOngoingActivity(), SetOngoingActivityType() + */ + OngoingActivityType GetOngoingActivityType(void) const; + + /** + * Sets the notification type for ongoing-activity notification. + * + * @since 3.0 + * + * @return An error code + * @param[in] type ongoing-activity notification type + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_STATE Current progress value is not compatible to the specified type + * @remarks This information is only meaningful when the NotificationRequest instance is delivered to NotificationManager::NotifyOngoingActivity() method. + * @see NotificationManager::NotifyOngoingActivity(), SetOngoingActivityProgress() + */ + result SetOngoingActivityType(OngoingActivityType type = ONGOING_ACTIVITY_TYPE_TEXT); + + /** + * Gets the progress value for the ongoing-activity notification. + * + * @since 3.0 + * + * @return The progress value + */ + int GetOngoingActivityProgress(void) const; + + /** + * Updates the progress value to the specified value. + * + * @since 3.0 + * + * @return An error code + * @param[in] value The value of the progress + * @exception E_SUCCESS The method is successful. + * @exception E_INVALID_ARG Either of the following conditions has occurred: @n + * - @c value is less than 0. + * - @c value does not lie between 0 and 100 for App::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE. + * @exception E_INVALID_STATE This instance is in an invalid state. @n + * OngoingActivityType should be either App::ONGOING_ACTIVITY_TYPE_PROGRESS_BYTE or App::ONGOING_ACTIVITY_TYPE_PROGRESS_PERCENTAGE. + */ + result SetOngoingActivityProgress(int value); + + /** + * Gets the appBinding value for the notification. + * + * @since 3.0 + * + * @return The appBinding value + */ + bool IsAppBinding() const; + +private: + bool __appBinding; + int __badgeNumber; + int __badgeOffset; + int __progressValue; + OngoingActivityType __activityType; + Osp::Base::String __alertText; + Osp::Base::String __appMessage; + Osp::Base::String __titleText; + Osp::Base::String __iconFilePath; + Osp::Base::String __soundFilePath; + +}; //_NotificationRequestImpl + +} } // Osp::Shell + +#endif // _FSHL_INTERNAL_NOTIFICATION_REQUEST_IMPL_H_ diff --git a/src/inc/FShl_NotificationManagerImpl.h b/src/inc/FShl_NotificationManagerImpl.h index bbe8982..bb2279f 100644 --- a/src/inc/FShl_NotificationManagerImpl.h +++ b/src/inc/FShl_NotificationManagerImpl.h @@ -20,11 +20,10 @@ * @brief This is the header file for the %_NotificationManagerImpl class. */ -#ifndef _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ -#define _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ +#ifndef _FSHL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ +#define _FSHL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ #include -#include #include namespace Osp { namespace Shell @@ -105,7 +104,7 @@ public: * @param[in] messageText The notification message * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG The specified input parameter is invalid, or - * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n @@ -123,7 +122,7 @@ public: * @param[in] badgeNumber The badge number * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG The specified @c badgeNumber is less than @c 0, or - * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n @@ -147,8 +146,8 @@ public: * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n * - The specified @c badgeNumber is less than @c 0. @n - * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n - * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n @@ -170,9 +169,9 @@ public: * @exception E_INVALID_ARG The specified input parameter is invalid, or * @c message does not have alert text * @exception E_SYSTEM A system error has occurred. - * @see App::NotificationMessage + * @see Shell::NotificationRequest */ - result NotifyMessageImpl(const NotificationMessage& message, bool isOngoing = false); + result NotifyMessageImpl(const NotificationRequest& message, bool isOngoing = false); /** @@ -188,9 +187,9 @@ public: * @exception E_INVALID_ARG The specified input parameter is invalid, or * @c message does not have alert text * @exception E_SYSTEM A system error has occurred. - * @see App::NotificationMessage + * @see Shell::NotificationRequest */ - result NotifyMessageImpl(const AppId& appId, const NotificationMessage& message, bool isOngoing = false); + result NotifyMessageImpl(const Osp::App::AppId& appId, const NotificationRequest& message, bool isOngoing = false); /** * Removes the notification message. @@ -215,7 +214,7 @@ public: * @param[in] messageText The notification message * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG The specified input parameter is invalid, or - * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n @@ -236,8 +235,8 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n - * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n - * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n @@ -275,7 +274,7 @@ public: * @remarks The specific error code can be accessed using the GetLastResult() method. @n * In case of failure, this method returns @c -1. */ - int GetBadgeNumber(const AppId& appId) const; + int GetBadgeNumber(const Osp::App::AppId& appId) const; /** * Notifies the user using a badge number on behalf of the specified application. @@ -294,7 +293,7 @@ public: * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOnBehalf(const AppId& appId, int badgeNumber) const; + result NotifyByAppId(const Osp::App::AppId& appId, int badgeNumber) const; /** * Notifies the user using a message on behalf of the specified application. @@ -306,14 +305,14 @@ public: * @param[in] messageText The notification message * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG A specified input parameter is invalid, or - * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOnBehalf(const AppId& appId, const Osp::Base::String& messageText) const; + result NotifyByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText) const; /** * Notifies the user using a message and badge number on behalf of the specified application. @@ -328,14 +327,14 @@ public: * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n * - The specified @c badgeNumber is less than @c 0. @n - * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * - The length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOnBehalf(const AppId& appId, const Osp::Base::String& messageText, int badgeNumber) const; + result NotifyByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText, int badgeNumber) const; /** * Notifies the user using a message and badge number on behalf of the specified application. @n @@ -350,15 +349,15 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n - * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n - * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOnBehalf(const AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; + result NotifyByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; /** * Notifies the user using a message and badge number on behalf of the specified application. @n @@ -375,15 +374,15 @@ public: * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n * - The specified @c badgeNumber is less than 0. @n - * - The length of the specified @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n - * - The length of the specified @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * - The length of the specified @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of the specified @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_INVALID_OPERATION The target application with the specified application ID is not permitted to receive any notification as per the Tizen platform policy. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOnBehalf(const AppId& appId, const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments) const; + result NotifyByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments) const; /** * Notifies the user about the ongoing activity using a message on behalf of the specified application. @@ -395,14 +394,14 @@ public: * @param[in] messageText The notification message * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG The specified input parameter is invalid, or - * the length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. + * the length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOngoingActivityOnBehalf(const AppId& appId, const Osp::Base::String& messageText) const; + result NotifyOngoingActivityByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText) const; /** * Notifies the user about the ongoing activity using a message on behalf of the specified application. @@ -416,15 +415,15 @@ public: * @exception E_SUCCESS The method is successful. * @exception E_INVALID_ARG Either of the following conditions has occurred: @n * - A specified input parameter is invalid. @n - * - The length of @c messageText is greater than App::MAX_NOTIFICATION_MESSAGE_LENGTH. @n - * - The length of @c launchArguments is greater than App::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. + * - The length of @c messageText is greater than Shell::MAX_NOTIFICATION_MESSAGE_LENGTH. @n + * - The length of @c launchArguments is greater than Shell::MAX_NOTIFICATION_LAUNCH_ARGUMENTS_LENGTH. * @exception E_APP_NOT_INSTALLED The application is not installed. * @exception E_SYSTEM A system error has occurred. * @exception E_INVALID_OPERATION The type of application calling this method is invalid as per the Tizen platform policy. * @exception E_INVALID_STATE This instance is in an invalid state. @n * The Construct() method is not called. */ - result NotifyOngoingActivityOnBehalf(const AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; + result NotifyOngoingActivityByAppId(const Osp::App::AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; /** * Removes the notification message for ongoing activity on behalf of the specified application. @@ -440,7 +439,7 @@ public: * The Construct() method is not called. * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS. */ - result RemoveOngoingActivityNotificationOnBehalf(const AppId& appId); + result RemoveOngoingActivityNotificationByAppId(const Osp::App::AppId& appId); /** * Removes the notification message on behalf of the specified application. @@ -456,7 +455,7 @@ public: * - The Construct() method is not called. @n * @remarks Although there is no outstanding notification for the calling application, this method returns E_SUCCESS. */ - result RemoveNotificationOnBehalf(const AppId& appId); + result RemoveNotificationByAppId(const Osp::App::AppId& appId); static const _NotificationManagerImpl* GetInstance(const NotificationManager& notiMgr); @@ -465,11 +464,11 @@ public: private: result NotifyImpl(const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments, bool isOngoing = false) const; - result NotifyImpl(const AppId& appId, const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments, bool isOngoing = false) const; + result NotifyImpl(const Osp::App::AppId& appId, const Osp::Base::String& messageText, int badgeNumber, const Osp::Base::String& launchArguments, bool isOngoing = false) const; inline result OngoingImpl(const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; - inline result OngoingImpl(const AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; + inline result OngoingImpl(const Osp::App::AppId& appId, const Osp::Base::String& messageText, const Osp::Base::String& launchArguments) const; _NotificationManagerImpl(const _NotificationManagerImpl& rhs); @@ -481,4 +480,4 @@ private: } } // Osp::Shell -#endif // _FSHELL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ +#endif // _FSHL_INTERNAL_NOTIFICATION_MANAGER_IMPL_H_ -- 2.7.4