lib \
src \
tool \
- tests
+ tests \
+ tool/notification
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.68])
-AC_INIT([org.tizen.ico.homescreen], [0.9.13], [])
+AC_INIT([org.tizen.ico.homescreen], [0.9.14], [])
AM_INIT_AUTOMAKE([1.11 foreign no-dist-gzip dist-xz])
AC_CONFIG_SRCDIR([configure.ac])
AC_CONFIG_HEADERS([config.h])
src/statusbar/Makefile
src/onscreen/Makefile
tool/Makefile
+ tool/notification/Makefile
tests/Makefile
- tests/statusbar/Makefile
tests/system-controller/Makefile
tests/system-controller/apps-framework/Makefile])
AC_PROG_RANLIB([ranlib])
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.homescreen" version="0.9.13" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.homescreen" version="0.9.14" install-location="internal-only">
<label>HomeScreen</label>
<description>IVI HomeScreen Application</description>
<ui-application appid="org.tizen.ico.homescreen" exec="/usr/apps/org.tizen.ico.homescreen/bin/HomeScreen" nodisplay="true" multiple="false" type="capp" taskmanage="true">
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.onscreen" version="0.9.13" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.onscreen" version="0.9.14" install-location="internal-only">
<label>OnScreen</label>
<description>IVI OnScreen Application</description>
<ui-application appid="org.tizen.ico.onscreen" exec="/usr/apps/org.tizen.ico.onscreen/bin/OnScreen" nodisplay="true" multiple="false" type="capp" taskmanage="true">
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.statusbar" version="0.9.13" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.statusbar" version="0.9.14" install-location="internal-only">
<label>StatusBar</label>
<description>IVI StatusBar Application</description>
<ui-application appid="org.tizen.ico.statusbar" exec="/usr/apps/org.tizen.ico.statusbar/bin/StatusBar" nodisplay="true" multiple="false" type="capp" taskmanage="true">
<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.system-controller" version="0.9.13" install-location="internal-only">
+<manifest xmlns="http://tizen.org/ns/packages" package="org.tizen.ico.system-controller" version="0.9.14" install-location="internal-only">
<label>system-controller</label>
<author email="" href=""> </author>
<description>ico system-controller</description>
//--------------------------------------------------------------------------
/**
- * @brief default constructor
- */
-//--------------------------------------------------------------------------
-CicoNotification::CicoNotification()
- : m_notification(NULL),
- m_type(NOTIFICATION_TYPE_NONE)
-{
-}
-
-//--------------------------------------------------------------------------
-/**
* @brief constructor
*
- * @return notification handle
+ * @param [in] type type of notification
*/
//--------------------------------------------------------------------------
-CicoNotification::CicoNotification(notification_h noti)
- : m_notification(noti),
- m_type(NOTIFICATION_TYPE_NONE)
+CicoNotification::CicoNotification(notification_type_e type)
+ : m_notification(NULL),
+ m_type(type),
+ m_privId(NOTIFICATION_PRIV_ID_NONE),
+ m_groupId(NOTIFICATION_GROUP_ID_NONE)
{
- notification_type_e type;
- notification_get_type(m_notification, &type);
-}
-
-//--------------------------------------------------------------------------
-/**
- * @brief destructor
- */
-//--------------------------------------------------------------------------
-CicoNotification::~CicoNotification()
-{
-#if 0
+ // create notfication handler
+ m_notification = notification_create(type);
if (NULL != m_notification) {
- notification_free(m_notification);
+ // initialize group id and private id variables
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_get_id(m_notification, &m_groupId, &m_privId);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_get_id() failed(%d).", err);
+ m_privId = NOTIFICATION_PRIV_ID_NONE;
+ m_groupId = NOTIFICATION_GROUP_ID_NONE;
+ }
+ }
+ else {
+ ICO_ERR("notification_create() failed.");
m_notification = NULL;
+ m_type = NOTIFICATION_TYPE_NONE;
}
-#endif
}
//--------------------------------------------------------------------------
/**
- * @brief initialize notification
+ * @brief constructor
*
- * @return type of notification
+ * @param [in] noti notification handle
*/
//--------------------------------------------------------------------------
-bool
-CicoNotification::Initialize(notification_type_e type)
+CicoNotification::CicoNotification(notification_h noti)
+ : m_notification(NULL),
+ m_type(NOTIFICATION_TYPE_NONE),
+ m_privId(NOTIFICATION_PRIV_ID_NONE),
+ m_groupId(NOTIFICATION_GROUP_ID_NONE)
{
- if (NULL != m_notification) {
- return true;
- }
-
- m_notification = notification_create(type);
- if (NULL == m_notification) {
- ICO_ERR("notification_create() failed.");
- return false;
- }
+ // clone notfication handler
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_clone(noti, &m_notification);
+ if (NOTIFICATION_ERROR_NONE == err) {
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
- m_type = type;
- return true;
-}
+ // initialize type variable
+ err = notification_get_type(m_notification, &m_type);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_get_id() failed(%d).", err);
+ m_type = NOTIFICATION_TYPE_NONE;
+ }
-//--------------------------------------------------------------------------
-/**
- * @brief terminate notification
- */
-//--------------------------------------------------------------------------
-bool
-CicoNotification::Terminate(void)
-{
-/*
- if (NULL != m_notification) {
- notification_error_e err;
- err = notification_free(m_notification);
+ // initialize group id and private id variables
+ err = notification_get_id(m_notification, &m_groupId, &m_privId);
if (NOTIFICATION_ERROR_NONE != err) {
- ICO_ERR("notification_free() failed.");
- return false;
+ ICO_ERR("notification_get_id() failed(%d).", err);
+ m_privId = NOTIFICATION_PRIV_ID_NONE;
+ m_groupId = NOTIFICATION_GROUP_ID_NONE;
}
+ }
+ else {
+ ICO_ERR("notification_clone() failed(%d).", err);
m_notification = NULL;
}
-*/
- return true;
}
//--------------------------------------------------------------------------
/**
- * @brief unpack notification stracture
- *
- * @return notification handle
+ * @brief destructor
*/
//--------------------------------------------------------------------------
-notification_h
-CicoNotification::Unpack(void) const
+CicoNotification::~CicoNotification()
{
- return m_notification;
+ if (NULL != m_notification) {
+ notification_free(m_notification);
+ m_notification = NULL;
+ }
}
//--------------------------------------------------------------------------
/**
- * @brief clone notification stracture
+ * @brief get notification handle
*
* @return notification handle
*/
//--------------------------------------------------------------------------
notification_h
-CicoNotification::Clone(void)
+CicoNotification::GetNotiHandle(void) const
{
- notification_h ret_noti;
- notification_error_e err = NOTIFICATION_ERROR_NONE;
- err = notification_clone(m_notification, &ret_noti);
- if (NOTIFICATION_ERROR_NONE != err) {
- ICO_ERR("notification_clone() failed(%d).", err);
- return NULL;
- }
- return ret_noti;
+ return m_notification;
}
//--------------------------------------------------------------------------
//--------------------------------------------------------------------------
/**
+ * @brief get private id
+ *
+ * @return notification private id
+ * @retval true success
+ * @retval false notification handle is null or
+ * notification_set_pkgname() failed
+ */
+//--------------------------------------------------------------------------
+int
+CicoNotification::GetPrivId(void)
+{
+ return m_privId;
+}
+
+//--------------------------------------------------------------------------
+/**
* @brief set package name
*
* @param [in] pkgname package name
/**
* @brief get package name of notification
*
- * @return name package
+ * @return package name
*/
//--------------------------------------------------------------------------
const char *
return iconpath;
}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief set execute option
+ *
+ * @param [in] type notification execute type
+ * @param [in] text basic text for button
+ * @param [in] key value for localizaed text
+ * @param [in] service_handle appsvc bundle data
+ *
+ * @return result
+ * @retval true success
+ * @retval false notification handle is null or
+ * notification_set_execute_option() failed
+ */
+//--------------------------------------------------------------------------
+bool
+CicoNotification::SetExecuteOption(notification_execute_type_e type,
+ const char *text,
+ const char *key,
+ bundle *service_handle)
+{
+ if (NULL == m_notification) {
+ ICO_ERR("notification handle is null");
+ return false;
+ }
+
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_set_execute_option(m_notification, type,
+ text, key, service_handle);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_get_execute_option() failed(%d).", err);
+ return false;
+ }
+
+ return true;
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get execute option
+ *
+ * @param [in] type notification execute type
+ * @param [out] text text for button
+ * @param [out] service_handle appsvc bundle data
+ *
+ * @return result
+ * @retval true success
+ * @retval false notification handle is null or
+ * notification_get_execute_option() failed
+ */
+//--------------------------------------------------------------------------
+bool
+CicoNotification::GetExecuteOption(notification_execute_type_e type,
+ const char **text,
+ bundle **service_handle)
+{
+ if (NULL == m_notification) {
+ ICO_ERR("notification handle is null");
+ return false;
+ }
+
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_get_execute_option(m_notification, type,
+ text, service_handle);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_get_execute_option() failed(%d).", err);
+ return false;
+ }
+
+ return true;
+}
// vim:set expandtab ts=4 sw=4:
//--------------------------------------------------------------------------
class CicoNotification {
public:
- // default constructor
- CicoNotification();
+ // constructor
+ CicoNotification(notification_type_e type);
// constructor
CicoNotification(notification_h noti);
// destructor
~CicoNotification();
- bool Initialize(notification_type_e type);
- bool Terminate();
- notification_h Unpack(void) const;
- notification_h Clone(void);
+ // get notfication handle
+ notification_h GetNotiHandle(void) const;
+
+ // is empty
bool Empty(void) const;
+
+ // get notification type
notification_type_e GetType(void) const;
+
+ // get private id
+ int GetPrivId(void);
+
+ // set caller package name
bool SetPkgname(const char *pkgname);
+
+ // get caller package name
const char *GetPkgname(void);
+
+ // set title
bool SetTitle(const char *title);
+
+ // get title
const char *GetTitle(void);
+
+ // set content
bool SetContent(const char *content);
+
+ // get content
const char *GetContent(void);
+
+ // set icon path
bool SetIconPath(const char *path);
+
+ // get icon path
const char *GetIconPath(void);
+ // set execute option
+ bool SetExecuteOption(notification_execute_type_e type,
+ const char *text,
+ const char *key,
+ bundle *service_handle);
+
+ // get execute option
+ bool GetExecuteOption(notification_execute_type_e type,
+ const char **text,
+ bundle **service_handle);
+
protected:
+ // default constructor
+ CicoNotification();
+
// assignment operator
CicoNotification& operator=(const CicoNotification & object);
CicoNotification(const CicoNotification & object);
private:
+ /// notification handle
notification_h m_notification;
+
+ /// notification type
notification_type_e m_type;
+
+ /// notification private id
+ int m_privId;
+
+ /// notification group id
+ int m_groupId;
};
#endif // __CICO_NOTIFICATION_H__
// vim:set expandtab ts=4 sw=4:
}
int retid = 0;
- notification_error_e err = notification_insert(noti.Unpack(), &retid);
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_insert(noti.GetNotiHandle(), &retid);
if (NOTIFICATION_ERROR_NONE != err) {
ICO_ERR("notification_insert() failed(%d).", err);
return false;
return false;
}
- notification_error_e err = notification_update(noti.Unpack());
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_update(noti.GetNotiHandle());
if (NOTIFICATION_ERROR_NONE != err) {
ICO_ERR("notification_update() failed(%d).", err);
return false;
}
notification_error_e err = notification_delete_by_priv_id(pkgname,
- noti.GetType(),
+ noti.GetType(),
m_privateid);
if (NOTIFICATION_ERROR_NONE != err) {
ICO_ERR("notification_delete_by_priv_id() failed(%d).", err);
public:
// set callback fucntion
virtual bool SetCallback(void (*detailed_changed_cb)
- (void *data,
- notification_type_e type,
- notification_op *op_list,
+ (void *data,
+ notification_type_e type,
+ notification_op *op_list,
int num_op),
void *user_data) = 0;
// unset callback fucntion
virtual bool UnsetCallback(void (*detailed_changed_cb)
- (void *data,
- notification_type_e type,
- notification_op *op_list,
+ (void *data,
+ notification_type_e type,
+ notification_op *op_list,
int num_op)) = 0;
};
#endif // __CICO_NOTIFICATION_INTERFACE_H__
--- /dev/null
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0. The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ * @file CicoNotificationList.cpp
+ *
+ * @brief This file is implemetation of CicoNotificationList class
+ */
+//==========================================================================
+
+#include <ico_log.h>
+
+#include "CicoNotificationList.h"
+
+//--------------------------------------------------------------------------
+/**
+ * @brief constructor
+ *
+ * @param [in] type notification type
+ * NOTIFICATION_TYPE_NONE is both notification type and ongoing type.
+ * NOTIFICATION_TYPE_NOTI is notification type only.
+ * NOTIFICATION_TYPE_ONGOING is ongoing type only.
+ * @param [in] count count returned notification data number
+ * If count is -1, all of notification list is returned.(default)
+ */
+//--------------------------------------------------------------------------
+CicoNotificationList::CicoNotificationList(notification_type_e type, int count)
+ : m_notiList(NULL), m_size(0)
+{
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+
+ err = notification_get_list(type, count, &m_notiList);
+ if (NOTIFICATION_ERROR_NONE == err) {
+ if (NULL != m_notiList) {
+ notification_list_h getlist = NULL;
+ getlist = notification_list_get_head(m_notiList);
+ do {
+ getlist = notification_list_get_next(m_notiList);
+ m_size++;
+ } while (getlist != NULL);
+ }
+ else {
+ m_notiList = NULL;
+ m_size = 0;
+ }
+ }
+ else {
+ ICO_ERR("notification_get_list() failed(%d).", err);
+ m_notiList = NULL;
+ }
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief destructor
+ */
+//--------------------------------------------------------------------------
+CicoNotificationList::~CicoNotificationList()
+{
+ if (m_notiList != NULL) {
+ notification_error_e err = notification_free_list(m_notiList);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_free_list() failed.");
+ }
+ m_notiList = NULL;
+ m_size = 0;
+ }
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get notification data number
+ */
+//--------------------------------------------------------------------------
+int
+CicoNotificationList::size(void)
+{
+ return m_size;
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get head notification handle and
+ * reset cuurent index to head notification list
+ *
+ * @return notification handle
+ */
+//--------------------------------------------------------------------------
+notification_h
+CicoNotificationList::head(void)
+{
+ m_current = notification_list_get_head(m_notiList);
+ if (NULL == m_current) {
+ return NULL;
+ }
+ return notification_list_get_data(m_current);
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get tail notification handle and
+ * reset cuurent index to tail notification list
+ *
+ * @return notification handle
+ */
+//--------------------------------------------------------------------------
+notification_h
+CicoNotificationList::tail(void)
+{
+ m_current = notification_list_get_tail(m_notiList);
+ if (NULL == m_current) {
+ return NULL;
+ }
+ return notification_list_get_data(m_current);
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get next notification handle
+ *
+ * @return notification handle
+ */
+//--------------------------------------------------------------------------
+notification_h
+CicoNotificationList::next(void)
+{
+ m_current = notification_list_get_next(m_notiList);
+ if (NULL == m_current) {
+ return NULL;
+ }
+ return notification_list_get_data(m_current);
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief get prev notification handle
+ *
+ * @return notification handle
+ */
+//--------------------------------------------------------------------------
+notification_h
+CicoNotificationList::prev(void)
+{
+ m_current = notification_list_get_prev(m_notiList);
+ if (NULL == m_current) {
+ return NULL;
+ }
+ return notification_list_get_data(m_current);
+}
+// vim:set expandtab ts=4 sw=4:
--- /dev/null
+/*
+ * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0. The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+//==========================================================================
+/**
+ * @file CicoNotificationList.h
+ *
+ * @brief This file is definition of CicoNotificationList class
+ */
+//==========================================================================
+#ifndef __CICO_NOTIFICATION_LIST_H__
+#define __CICO_NOTIFICATION_LIST_H__
+
+#include <notification.h>
+
+//--------------------------------------------------------------------------
+/**
+ * @class CicoNotificationList
+ *
+ * @brief This class provide the functions of operate notification list
+ */
+//--------------------------------------------------------------------------
+class CicoNotificationList {
+public:
+ // constructor
+ CicoNotificationList(notification_type_e type, int count = -1);
+
+ // destructor
+ ~CicoNotificationList();
+
+ // get notification data number
+ int size(void);
+
+ // get head notification handle and
+ // reset cuurent index to head notification list
+ notification_h head(void);
+
+ // get tail notification handle and
+ // reset cuurent index to tail notification list
+ notification_h tail(void);
+
+ // get prev notification handle
+ notification_h next(void);
+
+ // get next notification handle
+ notification_h prev(void);
+
+protected:
+ // default constructor
+ CicoNotificationList();
+
+ // assignment operator
+ CicoNotificationList& operator=(const CicoNotificationList & object);
+
+ // copy constructor
+ CicoNotificationList(const CicoNotificationList & object);
+
+private:
+ /// the notification list handle
+ notification_list_h m_notiList;
+
+ /// current position of notification list pointer
+ notification_list_h m_current;
+
+ /// the number of notification data
+ int m_size;
+
+ /// this flag is type of list sort(lastest or oldest)
+ bool m_oldest;
+};
+#endif // __CICO_NOTIFICATION_LIST_H__
+// vim:set expandtab ts=4 sw=4:
*/
//--------------------------------------------------------------------------
CicoNotificationService::CicoNotificationService()
- : m_privateid(0),
+ : m_privateid(0),
m_user_data(NULL)
{
}
}
int retid = 0;
- notification_error_e err = notification_insert(noti.Unpack(), &retid);
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_insert(noti.GetNotiHandle(), &retid);
if (NOTIFICATION_ERROR_NONE != err) {
ICO_ERR("notification_insert() failed(%d).", err);
return false;
return false;
}
- notification_error_e err = notification_update(noti.Unpack());
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_update(noti.GetNotiHandle());
if (NOTIFICATION_ERROR_NONE != err) {
ICO_ERR("notification_update() failed(%d).", err);
return false;
//--------------------------------------------------------------------------
/**
- * @brief set callback function of notification
+ * @brief set callback function of notification
*
* @param [in] detailed_changed_cb callback function
* @param [in] user_data user data
//--------------------------------------------------------------------------
/**
- * @brief unset callback function of notification
+ * @brief unset callback function of notification
*
* @param [in] detailed_changed_cb callback function
* @param [in] user_data user data
// set callback function
bool SetCallback(void (*detailed_changed_cb)
- (void *data,
- notification_type_e type,
- notification_op *op_list,
- int num_op),
+ (void *data,
+ notification_type_e type,
+ notification_op *op_list,
+ int num_op),
void *user_data);
// unset callback function
bool UnsetCallback(void (*detailed_changed_cb)
- (void *data,
- notification_type_e type,
- notification_op *op_list,
+ (void *data,
+ notification_type_e type,
+ notification_op *op_list,
int num_op));
private:
libico_notification_la_LDFLAGS = -version-info 0:9:0
libico_notification_la_SOURCES = \
CicoNotification.cpp \
+ CicoNotificationList.cpp \
CicoNotificationApp.cpp \
CicoNotificationService.cpp
+* Fri Feb 14 2014 Shibata Makoto <shibata@mac.tec.toyota.co.jp> submit/tizen/20140214.023123@397e77f
+- 0.9.14 release
+-- add: TIVI-1751 Home Screen needs to use system notifications framework
+
* Fri Feb 07 2014 Shibata Makoto <shibata@mac.tec.toyota.co.jp> accepted/tizen/ivi/20140129.180846@4c051ac
- 0.9.13 release
-- bugfix: TIVI-2637 Sometimes app list doesn't disappear after launching app
Name: ico-uxf-homescreen
Summary: Sample homescreen and system controller
-Version: 0.9.13
+Version: 0.9.14
Release: 1.1
Group: Graphics & UI Framework/Automotive UI
License: Apache-2.0
-## onscreen private configration
-[onscreen]
-wsport=10001
-#orientaion(1:VERTICAL, 2:HORIZONTAL)
-#orientaion=2
+#===========================================================================
+#
+# OnScreen application configuration file
+#
+#===========================================================================
+#---------------------------------------------------------------------------
+# onscreen private configration
+#---------------------------------------------------------------------------
+[onscreen]
-[sound]
-#configuration for sounds
-sound_default=/usr/share/sounds/mm-camcorder/af_succeed.wav
+#---------------------------------------------------------------------------
+# Notification setting
+#
+# -- type
+# notification type
+# all : both notification and ongoing
+# notifiaction : notification only
+# ongoing : ongoing only
+# -- timemout
+# notification popup display time[sec]
+#---------------------------------------------------------------------------
+[notification]
+type=notification
+timeout=5
+#---------------------------------------------------------------------------
+# OnScreen application log setting
+#
+# -- filename
+# log file name
+# -- loglevel
+# none : all level log print off
+# all : all level log print on
+# performance : perfromance log print on
+# trace : trace log print on
+# debug : debug log print on
+# info : info log print on
+# warning : warning log print on
+# critical : critical print on
+# error : error print on
+# -- logflush
+# on : log output with log flush
+# off : log output without log flush
+# -- ecorelog
+# on : ecore log print enabled
+# off : ecore log print disabled
+#---------------------------------------------------------------------------
+[log]
+filename=OnScreen
+loglevel=all
+logflush=on
+ecorelog=on
+# vim:set expandtab ts=4 sw=4:
else if (strncmp(win_info->appid,
hs_instance->GetOsPackageName(),
ICO_HS_MAX_PROCESS_NAME) == 0) {
- /*On Screen*/
+
+ // On Screen
hs_instance->os_app_info->AddWindowInfo(win_info);
+
+ // show onscreen window
+ ico_syc_show(win_info->appid, win_info->surface, NULL);
+
+ // change the layer of onscreen window
+ ico_syc_change_layer(win_info->appid, win_info->surface,
+ HS_LAYER_ONSCREEN);
+
+ // hide onscreen layer
+ ico_syc_hide_layer(HS_LAYER_ONSCREEN);
+
}
else {
/*Application*/
ICO_TRA("CicoOSEFLApp::onCreate Enter");
try {
-#if 0
- // load system config
- CicoSystemConfig::getInstance()->load(
- ICO_OS_LIFECYCLE_CONTROLLER_SETTING_PATH);
-#endif
// start onscreen
m_onscreen = new CicoOnScreen();
- bool ret = m_onscreen->StartOnScreen(ICO_ORIENTATION_VERTICAL);
+ bool ret = m_onscreen->StartOnScreen();
if(ret != true){
ICO_TRA("CicoOSEFLApp::onCreate Leave(false)");
return false;
public:
// default constructor
CicoOSEFLApp();
-
+
// destructor
virtual ~CicoOSEFLApp();
* @date Jan-07-2014
*/
#include "CicoOnScreen.h"
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
using namespace std;
-/*============================================================================*/
-/* static members */
-/*============================================================================*/
+//==========================================================================
+// static members
+//==========================================================================
CicoOnScreen * CicoOnScreen::os_instance=NULL;
struct popup_data CicoOnScreen::ico_appdata;
-struct lemolo_noti_data CicoOnScreen::ico_notidata;
-/*============================================================================*/
-/* functions */
-/*============================================================================*/
+//==========================================================================
+// functions
+//==========================================================================
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::CicoOnScreen
* Constractor
*
* @param[in] none
* @return none
-
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
CicoOnScreen::CicoOnScreen(void)
{
ICO_TRA("CicoOnScreen::CicoOnScreen Enter");
InitializePopupData();
- InitializeNotificationData();
ICO_TRA("CicoOnScreen::CicoOnScreen Leave");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::~CicoOnScreen
* Destractor
* @param[in] none
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
CicoOnScreen::~CicoOnScreen(void)
{
// ICO_TRA("CicoOnScreen::~CicoOnScreen Enter");
// ICO_TRA("CicoOnScreen::~CicoOnScreen Leave");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::InitializePopupData
* Initialize popup struct data
* @param[in] none
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
CicoOnScreen::InitializePopupData(void)
{
ICO_TRA("CicoOnScreen::InitializePopupData Enter");
ico_appdata.window = NULL;
- ico_appdata.evas = NULL;
- ico_appdata.background = NULL;
ico_appdata.icon = NULL;
- ico_appdata.title = NULL;
- ico_appdata.content = NULL;
- ico_appdata.icon_bg = NULL;
- ico_appdata.title_bg = NULL;
- ico_appdata.content_bg = NULL;
+ ico_appdata.noti = NULL;
ico_appdata.show_flag = FALSE;
+ ico_appdata.noti = NULL;
ICO_TRA("CicoOnScreen::InitializePopupData Leave");
}
-/*--------------------------------------------------------------------------*/
-/**
- * @brief CicoOnScreen::InitializePopupData
- * Initialize notification struct data
- *
- * @param[in] none
- * @return none
- */
-/*--------------------------------------------------------------------------*/
-void
-CicoOnScreen::InitializeNotificationData(void)
-{
- ICO_TRA("CicoOnScreen::InitializeNotificationData Enter");
-
- ico_notidata.title = NULL;
- ico_notidata.content = NULL;
- ico_notidata.icon = NULL;
- ico_notidata.text = NULL;
- ico_notidata.service_handle = NULL;
-
- ICO_TRA("CicoOnScreen::InitializeNotificationData Leave");
-}
-
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::StartOnScreen
* Start on screen
* @return none
* @return true on success, false on error
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
bool
-CicoOnScreen::StartOnScreen(int orientation)
+CicoOnScreen::StartOnScreen(void)
{
ICO_TRA("CicoOnScreen::StartOnScreen Enter");
- /* save instance pointer */
- os_instance = this;
-
-#if 0
- /* config copy*/
- this->config = new CicoGKeyFileConfig();
- this->config->Initialize(ICO_ONSCREEN_CONFIG_FILE);
-
- /* Get screen size */
- CicoOSWindowController::GetFullScreenSize(orientation,
- &full_width,&full_height);
+ ico_syc_connect(EventCallBack, NULL);
- ICO_DBG("full screen size x=%d y=%d",full_width,full_height);
-#endif
+ // save instance pointer
+ os_instance = this;
- /* Initialize */
+ // Initialize
ecore_evas_init();
InitializePopup();
- /* set notification callback function */
+ // set notification callback function
notiservice_.SetCallback(NotificationCallback, this);
ICO_TRA("CicoOnScreen::StartOnScreen Leave(true)");
return true;
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::Finalize
* Finalize
* @param[in] none
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
CicoOnScreen::Finalize(void)
{
ICO_TRA("CicoOnScreen::Finalize Enter");
- /* Free window handle */
+ // Free window handle
if (ico_appdata.window != NULL) {
ecore_evas_free(ico_appdata.window);
}
ICO_TRA("CicoOnScreen::Finalize Leave");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::ShowPopup
* Show popup window
* @param[in] none
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
-CicoOnScreen::ShowPopup(void)
+CicoOnScreen::ShowPopup(CicoNotification ¬i)
{
ICO_TRA("CicoOnScreen::ShowPopup Enter");
- evas_object_show(ico_appdata.background);
+ ico_appdata.noti = new CicoNotification(noti.GetNotiHandle());
+
+ // get caller pachage name
+ const char *pkgname = noti.GetPkgname();
+
+ // get priv_id
+ int priv_id = noti.GetPrivId();
+
+ // Get title
+ const char *title = noti.GetTitle();
+
+ // Get content
+ const char *content = noti.GetContent();
+
+ // Get execute option
+ const char *text = NULL;
+ bundle *service_handle = NULL;
+ (void)noti.GetExecuteOption(NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
+ &text, &service_handle);
- /* Icon show */
- evas_object_show(ico_appdata.icon_bg);
- if (ico_notidata.icon != NULL) {
- evas_object_image_file_set(ico_appdata.icon, ico_notidata.icon, NULL);
- evas_object_image_fill_set(ico_appdata.icon, 0, 0, 50, 50);
- evas_object_show(ico_appdata.icon);
+ // Get icon path
+ const char *icon = noti.GetIconPath();
+ ICO_DBG("Received: %s : %i : %s : %s : %s : %x",
+ pkgname, priv_id, title, content,
+ text, (int)service_handle);
+
+ if (icon) {
+ if (NULL != ico_appdata.icon) {
+ evas_object_image_file_set(ico_appdata.icon, icon, NULL);
+ evas_object_show(ico_appdata.icon);
+ }
+ }
+
+ if (title) {
+ if (!edje_object_part_text_set(ico_appdata.theme, "title_text", title)) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ }
+
+ if (content) {
+ if (strlen(content) <= 25) {
+ ICO_DBG("content text center");
+ if (!edje_object_part_text_set(ico_appdata.theme, "content_text_center", content)) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ if (!edje_object_part_text_set(ico_appdata.theme, "content_text_left", "")) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ }
+ else {
+ ICO_DBG("content text left");
+ if (!edje_object_part_text_set(ico_appdata.theme, "content_text_left", content)) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ if (!edje_object_part_text_set(ico_appdata.theme, "content_text_center", "")) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ }
}
- /* Title show */
- evas_object_show(ico_appdata.title_bg);
- evas_object_textblock_text_markup_set(ico_appdata.title, ico_notidata.title);
- evas_object_show(ico_appdata.title);
+ if (text) {
+ if (!edje_object_part_text_set(ico_appdata.theme, "button_text", text)) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ }
+ else {
+ if (!edje_object_part_text_set(ico_appdata.theme, "button_text", "OK")) {
+ ICO_WRN("could not set the text. Maybe part 'text' does not exist?");
+ }
+ }
- /* Content show */
- evas_object_show(ico_appdata.content_bg);
- evas_object_textblock_text_markup_set(ico_appdata.content, ico_notidata.content);
- evas_object_show(ico_appdata.content);
+ evas_object_show(ico_appdata.theme);
+
+ // TODO show onscreen layer
+ ico_syc_show_layer(6);
+
+ ecore_evas_show(ico_appdata.window);
ICO_TRA("CicoOnScreen::ShowPopup Leave");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::HidePopup
* Hide popup window
* @param[in] event_info Event information
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
-CicoOnScreen::HidePopup(void *data, Evas *e, Evas_Object *obj, void *event_info)
+CicoOnScreen::HidePopup(void)
{
ICO_TRA("CicoOnScreen::HidePopup Enter");
- /* Background(popup frame) hide */
- evas_object_hide(ico_appdata.background);
+ // TODO hide onscreen layer
+ ico_syc_hide_layer(6);
- /* Icon hide */
- evas_object_hide(ico_appdata.icon_bg);
- evas_object_hide(ico_appdata.icon);
+ // Background(popup frame) hide
+ evas_object_hide(ico_appdata.theme);
- /* Title hide */
- evas_object_hide(ico_appdata.title_bg);
- evas_object_hide(ico_appdata.title);
-
- /* Content hide */
- evas_object_hide(ico_appdata.content_bg);
- evas_object_hide(ico_appdata.content);
+ if (NULL != ico_appdata.noti) {
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ err = notification_delete(ico_appdata.noti->GetNotiHandle());
+ if (NOTIFICATION_ERROR_NONE != err) {
+ ICO_ERR("notification_delete faile(%d).");
+ }
+ delete ico_appdata.noti;
+ ico_appdata.noti = NULL;
+ }
ico_appdata.show_flag = FALSE;
ICO_TRA("CicoOnScreen::HidePopup Leave");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::InitializePopup
* Initialize popup window
* @param[in] none
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
CicoOnScreen::InitializePopup(void)
{
- Evas_Textblock_Style* ts;
- static const char *style_buf =
- "DEFAULT='font=Sans font_size=30 color=#000 align=center text_class=entry'"
- "newline='br'"
- "b='+ font=Sans:style=bold'";
-
ICO_TRA("CicoOnScreen::InitializePopup Enter");
- /* Window setup */
+ // Window setup
ico_appdata.window = ecore_evas_new(NULL, 0, 0, WIDTH, HEIGHT, "frame=0");
if (ico_appdata.window == NULL) {
ICO_ERR("ecore_evas_new() error");
}
ecore_evas_show(ico_appdata.window);
- /* Background setup */
- ico_appdata.evas = ecore_evas_get(ico_appdata.window);
- ico_appdata.background = evas_object_rectangle_add(ico_appdata.evas);
- evas_object_color_set(ico_appdata.background, 255, 255, 255, 255);
- evas_object_move(ico_appdata.background, POPUP_FRAME_ST_X, POPUP_FRAME_ST_Y);
- evas_object_resize(ico_appdata.background, POPUP_FRAME_WIDTH, POPUP_FRAME_HEIGHT);
-
- /* Icon Background setup */
- ico_appdata.icon_bg = evas_object_rectangle_add(ico_appdata.evas);
- evas_object_color_set(ico_appdata.icon_bg, 192, 192, 192, 255);
- evas_object_move(ico_appdata.icon_bg, POPUP_ICON_ST_X, POPUP_ICON_ST_Y);
- evas_object_resize(ico_appdata.icon_bg, POPUP_ICON_WIDTH, POPUP_ICON_HEIGHT);
-
- /* Icon setup */
- ico_appdata.icon = evas_object_image_add(ico_appdata.evas);
- evas_object_move(ico_appdata.icon, POPUP_ICON_ST_X, POPUP_ICON_ST_Y);
- evas_object_resize(ico_appdata.icon, POPUP_ICON_WIDTH, POPUP_ICON_HEIGHT);
-
- /* Title Background setup */
- ico_appdata.title_bg = evas_object_rectangle_add(ico_appdata.evas);
- evas_object_color_set(ico_appdata.title_bg, 192, 192, 192, 255);
- evas_object_move(ico_appdata.title_bg, POPUP_TITLE_ST_X, POPUP_TITLE_ST_Y);
- evas_object_resize(ico_appdata.title_bg, POPUP_TITLE_WIDTH, POPUP_TITLE_HEIGHT);
-
- /* text style set */
- ts = evas_textblock_style_new();
- evas_textblock_style_set(ts, style_buf);
-
- /* Title setup */
- ico_appdata.title = evas_object_textblock_add(ico_appdata.evas);
- evas_object_textblock_style_set(ico_appdata.title, ts);
- evas_object_textblock_valign_set(ico_appdata.title, 0.5);
- evas_object_textblock_text_markup_set(ico_appdata.title, "default");
- evas_object_move(ico_appdata.title, POPUP_TITLE_ST_X, POPUP_TITLE_ST_Y);
- evas_object_resize(ico_appdata.title, POPUP_TITLE_WIDTH, POPUP_TITLE_HEIGHT);
-
- /* Content Background setup */
- ico_appdata.content_bg = evas_object_rectangle_add(ico_appdata.evas);
- evas_object_color_set(ico_appdata.content_bg, 224, 224, 224, 255);
- evas_object_move(ico_appdata.content_bg, POPUP_CONTENT_BG_ST_X, POPUP_CONTENT_BG_ST_Y);
- evas_object_resize(ico_appdata.content_bg, POPUP_CONTENT_BG_WIDTH, POPUP_CONTENT_BG_HEIGHT);
-
- /* Content setup */
- ico_appdata.content = evas_object_textblock_add(ico_appdata.evas);
- evas_object_textblock_style_set(ico_appdata.content, ts);
- evas_object_textblock_valign_set(ico_appdata.content, 0.5);
- evas_object_textblock_text_markup_set(ico_appdata.content, "default");
- evas_object_move(ico_appdata.content, POPUP_CONTENT_BG_ST_X, POPUP_CONTENT_BG_ST_Y);
- evas_object_resize(ico_appdata.content, POPUP_CONTENT_BG_WIDTH, POPUP_CONTENT_BG_HEIGHT);
-
- /* set callback event */
- evas_object_event_callback_add(ico_appdata.icon_bg, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
- evas_object_event_callback_add(ico_appdata.icon, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
- evas_object_event_callback_add(ico_appdata.title_bg, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
- evas_object_event_callback_add(ico_appdata.title, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
- evas_object_event_callback_add(ico_appdata.content_bg, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
- evas_object_event_callback_add(ico_appdata.content, EVAS_CALLBACK_MOUSE_UP,
- HidePopup, NULL);
+ ico_appdata.theme = edje_object_add(ecore_evas_get(ico_appdata.window));
+ if (NULL == ico_appdata.theme) {
+ ICO_ERR("could not create edje object!");
+ return;
+ }
+
+ if (!edje_object_file_set(ico_appdata.theme, "/usr/apps/org.tizen.ico.onscreen/res/themes/onscreen.edj", "main")) {
+ Edje_Load_Error err = edje_object_load_error_get(ico_appdata.theme);
+ const char *errmsg = edje_load_error_str(err);
+ ICO_ERR("could not load 'main' from onscreen.edj: %s",
+ errmsg);
+ evas_object_del(ico_appdata.theme);
+ ico_appdata.theme = NULL;
+ return;
+ }
+
+ // icon setup
+ ico_appdata.icon = evas_object_image_filled_add(ecore_evas_get(ico_appdata.window));
+ edje_object_part_swallow(ico_appdata.theme, "icon", ico_appdata.icon);
+
+ /* getting size of screen */
+ /* home screen size is full of display*/
+ int display_width = 0;
+ int display_height = 0;
+ ecore_wl_screen_size_get(&display_width, &display_height);
+
+ ICO_DBG("display size w/h=%d/%d", display_width, display_height);
+ int popup_x = (display_width / 2) - (POPUP_FRAME_WIDTH / 2);
+ int popup_y = (display_height / 2) - (POPUP_FRAME_HEIGHT/ 2);
+ ICO_DBG("popup postion x/y=%d/%d", popup_x, popup_y);
+ evas_object_move(ico_appdata.theme, popup_x, popup_y);
+ evas_object_resize(ico_appdata.theme, POPUP_FRAME_WIDTH, POPUP_FRAME_HEIGHT);
+
+ Evas_Object* obj = NULL;
+ obj = (Evas_Object*)edje_object_part_object_get(ico_appdata.theme,
+ "button_text");
+ if (NULL != obj) {
+ evas_object_event_callback_add(obj,
+ EVAS_CALLBACK_MOUSE_UP,
+ evasMouseUpCB,
+ this);
+ }
+
+ obj = (Evas_Object*)edje_object_part_object_get(ico_appdata.theme,
+ "button");
+ if (NULL != obj) {
+ evas_object_event_callback_add(obj,
+ EVAS_CALLBACK_MOUSE_UP,
+ evasMouseUpCB,
+ this);
+ }
+
+ evas_object_show(ico_appdata.theme);
ICO_TRA("CicoOnScreen::InitializePopup Leave(OK)");
}
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
/**
* @brief CicoOnScreen::NotificationCallback
* Notification callback function
* @param[in] type The type of notification
* @return none
*/
-/*--------------------------------------------------------------------------*/
+//--------------------------------------------------------------------------
void
CicoOnScreen::NotificationCallback(void *data, notification_type_e type,
- notification_op *op_list, int num_op)
+ notification_op *op_list, int num_op)
{
- notification_h noti_h = NULL;
- notification_list_h notification_list = NULL;
- notification_list_h get_list = NULL;
-// notification_op_type_e op_type;
- int op_type;
- int group_id = 0;
- int length1 = 0;
- int length2 = 0;
- int ret_err = NOTIFICATION_ERROR_NONE;
- int priv_id = NOTIFICATION_PRIV_ID_NONE;
- char *pkgname = NULL;
-
ICO_TRA("CicoOnScreen::NotificationCallback Enter");
- os_instance->InitializeNotificationData();
-
for (int i = 0; i < num_op; i++) {
- op_type = (int)op_list[i].type;
+ notification_op_type_e op_type = op_list[i].type;
+ int priv_id = op_list[i].priv_id;
+ notification_h noti_h = op_list[i].noti;
+ ICO_DBG("RECV notification op_type=%d priv_id=%d noti=0x%08x",
+ op_type, priv_id, noti_h);
switch (op_type) {
case NOTIFICATION_OP_INSERT :
+ {
+ ICO_DBG("NOTIFICATION_OP_INSERT(%d)", op_type);
+
+ CicoNotification noti(noti_h);
+ if (noti.Empty()) {
+ break;
+ }
+
+ // check notification type
+ // TODO config
+ notification_type_e type = noti.GetType();
+ if (NOTIFICATION_TYPE_NOTI != type) {
+ break;
+ }
+
+ // Show popup window
+ if (ico_appdata.show_flag == FALSE) {
+ ico_appdata.show_flag = TRUE;
+ os_instance->ShowPopup(noti);
+ }
+ break;
+ }
case NOTIFICATION_OP_UPDATE :
- notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬ification_list);
- if (notification_list) {
- get_list = notification_list_get_head(notification_list);
-
- while(get_list != NULL) {
- noti_h = notification_list_get_data(get_list);
- CicoNotification noti(noti_h);
- if (noti.Empty()) {
- break;
- }
-
- pkgname = (char *)noti.GetPkgname();
- if(pkgname == NULL){
- notification_get_application(noti_h, &pkgname);
- }
-
- length1 = strlen(pkgname);
- length2 = strlen(LEMOLO_PKGNAME);
- length1 = (length1<=length2) ? length1 : length2;
-
- if (pkgname != NULL &&
- strncmp(pkgname, LEMOLO_PKGNAME, length1) == 0) {
-
- /* Get priv_id */
- notification_get_id(noti_h, &group_id, &priv_id);
- /* Get title */
- ico_notidata.title = (char *)noti.GetTitle();
- /* Get content */
- ico_notidata.content = (char *)noti.GetContent();
- /* Get execute option */
- notification_get_execute_option(noti_h,
- NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
- (const char **)(&ico_notidata.text),
- &ico_notidata.service_handle);
- /* Get icon path */
- ico_notidata.icon = (char *)noti.GetIconPath();
-#if 0
- ico_notidata.icon = ICON_PATH; // test
-#endif
- ICO_DBG("Received: %s : %i : %s : %s : %s : %x",
- pkgname, priv_id, ico_notidata.title,
- ico_notidata.content,
- ico_notidata.text,
- (int)ico_notidata.service_handle);
-
- /* Show popup window */
- if (ico_appdata.show_flag == FALSE) {
- ico_appdata.show_flag = TRUE;
- os_instance->ShowPopup();
- }
-
- /* Delete received notification from DB */
- ret_err = notification_delete_by_priv_id(pkgname,
- NOTIFICATION_TYPE_NOTI, priv_id);
- if (ret_err != NOTIFICATION_ERROR_NONE) {
- ICO_ERR("notification_delete_by_priv_id:error(%d)", ret_err);
- break;
- }
- }
-
- get_list = notification_list_get_next(get_list);
- }
+ ICO_DBG("NOTIFICATION_OP_UPDATE(%d)", op_type);
+ break;
+ case NOTIFICATION_OP_DELETE:
+ {
+ ICO_DBG("NOTIFICATION_OP_DELETE(%d)", op_type);
+
+ if (NULL == ico_appdata.noti) {
+ break;
+ }
+
+ if (priv_id == ico_appdata.noti->GetPrivId()) {
+ delete ico_appdata.noti;
+ ico_appdata.noti = NULL;
+ os_instance->HidePopup();
}
+ break;
+ }
+ case NOTIFICATION_OP_DELETE_ALL:
+ ICO_DBG("NOTIFICATION_OP_DELETE_ALL(%d)", op_type);
+ break;
+ case NOTIFICATION_OP_REFRESH:
+ ICO_DBG("NOTIFICATION_OP_REFRESH(%d)", op_type);
+ break;
+ case NOTIFICATION_OP_SERVICE_READY:
+ ICO_DBG("NOTIFICATION_OP_SERVICE_READY(%d)", op_type);
+ break;
+ default :
+ break;
}
}
- if (notification_list != NULL) {
- notification_free_list(notification_list);
- notification_list = NULL;
+ ICO_TRA("CicoOnScreen::NotificationCallback Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief callback function of evas mouse up event
+ *
+ * @param [in] data The user data passed from the callback
+ * registration function
+ * @param [in] e The handle to the popup window
+ * @param [in] obj The handle to the Evas object
+ * @param [in] event_info Event information
+ *
+ */
+//--------------------------------------------------------------------------
+void
+CicoOnScreen::evasMouseUpCB(void *data, Evas *e,
+ Evas_Object *obj, void *event_info)
+{
+ ICO_TRA("CicoOnScreen::evasMouseUpCB Enter");
+ ICO_DBG("obj name=%s", evas_object_name_get(obj));
+
+ static_cast<CicoOnScreen*>(data)->HidePopup();
+
+ ICO_TRA("CicoOnScreen::evasMouseUpCB Leave");
+}
+
+//--------------------------------------------------------------------------
+/**
+ * @brief callback for system controller
+ *
+ * @param [in] event kind of event
+ * @param [in] detail detail
+ * @param [in] user_data user data
+ */
+//--------------------------------------------------------------------------
+void
+CicoOnScreen::EventCallBack(const ico_syc_ev_e event,
+ const void *detail, void *user_data)
+{
+ ICO_TRA("CicoOnScreen::EventCallBack Enter(event %d)", event);
+
+ switch (event) {
+ case ICO_SYC_EV_RES_ACQUIRE:
+ ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_ACQUIRE)");
+ break;
+ case ICO_SYC_EV_RES_DEPRIVE:
+ ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_DEPRIVE)");
+ break;
+ case ICO_SYC_EV_RES_WAITING:
+ ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_WAITING)");
+ break;
+ case ICO_SYC_EV_RES_REVERT:
+ ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_REVERT)");
+ break;
+ case ICO_SYC_EV_RES_RELEASE:
+ ICO_TRA("Received: ico syc event(ICO_SYC_EV_RES_RELEASE)");
+ break;
+ default:
+ break;
}
- ICO_TRA("CicoOnScreen::NotificationCallback Leave");
+ ICO_TRA("CicoOnScreen::EventCallBack Leave");
}
// vim: set expandtab ts=4 sw=4:
#include <aul.h>
#include <Ecore_Evas.h>
#include <Evas.h>
+#include <Edje.h>
#include <stdbool.h>
#include <CicoNotification.h>
#include <CicoNotificationService.h>
+#include "ico_syc_common.h"
+#include "ico_syc_privilege.h"
+
#include "ico_log.h"
/*============================================================================*/
/* Popup Size */
#define POPUP_WIDTH 640
#define POPUP_HEIGHT 300
+
+/* Popup Frame Size */
+#define POPUP_FRAME_THICK 10
+#define POPUP_FRAME_WIDTH (POPUP_WIDTH+POPUP_FRAME_THICK)
+#define POPUP_FRAME_HEIGHT (POPUP_HEIGHT+POPUP_FRAME_THICK)
+
+#if 0
#define POPUP_ST_X ((WIDTH-POPUP_WIDTH)/2)
#define POPUP_ST_Y ((HEIGHT-POPUP_HEIGHT)/2)
#define ICO_ORIENTATION_HORIZONTAL (2)
#define LEMOLO_PKGNAME "org.tizen.dialer"
+#endif
#define FALSE 0
#define TRUE 1
+#if 0
#define ICON_PATH (char *)"/usr/share/icons/default/small/org.tizen.dialer.png"
+#endif
/*============================================================================*/
/* Define data types */
struct popup_data
{
Ecore_Evas *window;
- Evas *evas;
- Evas_Object *background;
Evas_Object *icon;
- Evas_Object *title;
- Evas_Object *content;
- Evas_Object *icon_bg;
- Evas_Object *title_bg;
- Evas_Object *content_bg;
+ Evas_Object *theme;
int show_flag;
-};
-
-struct lemolo_noti_data
-{
- char *title; /* if exist then box-type else band-type */
- char *content; /* Mandatory */
- char *icon; /* Mandatory(box-type), Optional(band-type) */
- char *text;
- bundle *service_handle;
+ CicoNotification *noti;
};
/*============================================================================*/
/*============================================================================*/
class CicoOnScreen
{
- public:
+public:
CicoOnScreen(void);
~CicoOnScreen(void);
- bool StartOnScreen(int orientation);
+ bool StartOnScreen(void);
void Finalize(void);
- static void NotificationCallback(void *data, notification_type_e type,
- notification_op *op_list, int num_op);
- private:
- void ShowPopup(void);
- static void HidePopup(void *data, Evas *e, Evas_Object *obj, void *event_info);
+ void HidePopup(void);
+ static void NotificationCallback(void *data,
+ notification_type_e type,
+ notification_op *op_list,
+ int num_op);
+
+private:
+ void ShowPopup(CicoNotification ¬i);
void InitializePopup(void);
- void InitializeNotificationData(void);
void InitializePopupData(void);
+ static void evasMouseUpCB(void *data,
+ Evas *e,
+ Evas_Object *obj,
+ void *event_info);
+
+ static void EventCallBack(const ico_syc_ev_e event,
+ const void *detail,
+ void *user_data);
+
static CicoOnScreen *os_instance;
static struct popup_data ico_appdata;
- static struct lemolo_noti_data ico_notidata;
- protected:
+protected:
CicoNotificationService notiservice_;
};
#endif // __CICO_ON_SCREEN_H__
$(AUL_CFLAGS) \
$(UWS_CFLAGS) \
$(NOTIFICATION_CFLAGS) \
+ $(WESTONPLUGIN_CFLAGS) \
-I../../include \
-I../../lib/common \
-I../../lib/notification
$(AUL_CFLAGS) \
$(UWS_CFLAGS) \
$(NOTIFICATION_CFLAGS) \
+ $(WESTONPLUGIN_CFLAGS) \
-I../../include \
-I../../lib/common \
-I../../lib/notification
$(OPT_LIBS) \
$(AUL_LIBS) \
$(UWS_LIBS) \
- $(NOTIFICATION_LIBS)
+ $(NOTIFICATION_LIBS) \
+ ../../lib/apps-framework/.libs/libico-appfw.so
+
+SUFFIXES = .edc .edj
+
+BUILT_SOURCES = \
+ onscreen.edj
+
+.edc.edj:
+ edje_cc $< -id ../../res/org.tizen.ico.onscreen/res/images \
+ -fd ../../res/org.tizen.ico.onscreen/res/images \
+ -sd ../../res/org.tizen.ico.onscreen/res/sounds -o $@
CLEANFILES = $(BUILT_SOURCES)
install-exec-hook:
mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/bin
mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/res/config
+ mkdir -p $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/res/themes
mkdir -p $(INSTALL_ROOT)/usr/share/packages
install -m 0755 OnScreen $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/bin
install -m 0644 $(top_srcdir)/data/share/packages/org.tizen.ico.onscreen.xml $(INSTALL_ROOT)/usr/share/packages
install -m 0644 $(top_srcdir)/res/org.tizen.ico.onscreen/res/config/* $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/res/config
+ install -m 0644 *.edj $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen/res/themes
uninstall:
rm -rf $(INSTALL_ROOT)/usr/apps/org.tizen.ico.onscreen
#include <Eina.h>
#include "ico_log.h"
#include "CicoOSEFLApp.h"
-//#include "CicoHSCmdOpts.h"
-//#include "CicoGKeyFileConfig.h"
+#include "CicoGKeyFileConfig.h"
-#if 0
+#define ICO_CONFIG_FILE "onscreen.conf"
#define ICO_CONFIG_LOG "log"
#define ICO_CONFIG_LOG_NAME "filename"
#define ICO_CONFIG_LOG_LEVEL "loglevel"
setupLog(void)
{
/* init configuration */
- CicoGKeyFileConfig hsConfig;
- hsConfig.Initialize(ICO_HOMESCREEN_CONFIG_FILE);
+ CicoGKeyFileConfig osConfig;
+ osConfig.Initialize(ICO_CONFIG_FILE);
// ico log open
std::string name;
- name = hsConfig.ConfigGetString(ICO_CONFIG_LOG,
- ICO_CONFIG_LOG_NAME,
- "HomeScreen");
+ name = osConfig.ConfigGetString(ICO_CONFIG_LOG,
+ ICO_CONFIG_LOG_NAME,
+ "OnScreen");
ico_log_open(name.c_str());
-
// ico log level
int log_level = 0;
- std::string level = hsConfig.ConfigGetString(ICO_CONFIG_LOG,
- ICO_CONFIG_LOG_LEVEL,
- "all");
+ std::string level = osConfig.ConfigGetString(ICO_CONFIG_LOG,
+ ICO_CONFIG_LOG_LEVEL,
+ "all");
if (NULL != strstr(level.c_str(), "performance")) {
log_level |= ICO_LOG_LVL_PRF;
log_level |= ICO_LOG_LVL_ERR;
}
- std::string flush = hsConfig.ConfigGetString(ICO_CONFIG_LOG,
- ICO_CONFIG_LOG_FLUSH,
- "on");
+ std::string flush = osConfig.ConfigGetString(ICO_CONFIG_LOG,
+ ICO_CONFIG_LOG_FLUSH,
+ "on");
if (NULL != strstr(flush.c_str(), "on")) {
log_level |= ICO_LOG_FLUSH;
}
}
// eocre log print
- std::string ecore = hsConfig.ConfigGetString(ICO_CONFIG_LOG,
- ICO_CONFIG_LOG_ECORE,
- "on");
+ std::string ecore = osConfig.ConfigGetString(ICO_CONFIG_LOG,
+ ICO_CONFIG_LOG_ECORE,
+ "on");
if (NULL != strstr(ecore.c_str(), "on")) {
eina_init();
eina_log_level_set(EINA_LOG_LEVEL_DBG);
}
}
-#endif
//--------------------------------------------------------------------------
/**
- * @brief onscreen main
+ * @brief onscreen main
* homescreen main. initialize UXF, app manager, and ecore.
*
* @param [in] argc counts of argment
{
try {
printf("=== start OnScreen main entry\n");
-
+
// setupLog
-#if 0
setupLog();
-#else
- ico_log_open("org.tizen.ico.app-onscreen"); // temporary
-#endif
ICO_INF( "START_MODULE OnScreen" );
-#if 0
- // perse command options
- CicoHSCmdOpts::getInstance()->parse(argc, argv);
-#endif
// start onscreen
CicoOSEFLApp osEFLApp;
int ret = osEFLApp.start(argc, argv);
--- /dev/null
+/*
+ * Copyright (c) 2014, TOYOTA MOTOR CORPORATION.
+ *
+ * This program is licensed under the terms and conditions of the
+ * Apache License, version 2.0. The full text of the Apache License is at
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ */
+
+collections {
+ group {
+ name: "main";
+
+ styles {
+ style {
+ name: "content_style_left";
+ base: "font="Monospace" font_size=36 color=#000000FF shadow_color=#80808032 style=shadow wrap=mixed";
+ }
+ style {
+ name: "content_style_center";
+ base: "font="Monospace" font_size=36 color=#000000FF shadow_color=#80808032 align=center style=shadow wrap=mixed";
+ }
+ }
+
+ parts {
+ part {
+ name:"background";
+ type: RECT;
+ description {
+ min: 640 300;
+ max: 640 300;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 0 0;
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ color: 255 255 255 255;
+ }
+ }
+ part {
+ name:"icon_bg";
+ type: RECT;
+ description {
+ min: 50 50;
+ max: 50 50;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 5 5;
+ rel1.to: "background";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "background";
+ color: 192 192 192 255;
+ }
+ }
+ part {
+ name: "icon";
+ type: SWALLOW;
+ description {
+ min: 50 50;
+ max: 50 50;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 0 0;
+ rel1.to: "icon_bg";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "icon_bg";
+ }
+ }
+ part {
+ name:"title_bg";
+ type: RECT;
+ description {
+ min: 550 50;
+ max: 580 50;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 55 5;
+ rel1.to: "background";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: -5 0;
+ rel2.to: "background";
+ color: 192 192 192 255;
+ }
+ }
+ part {
+ name: "title_text";
+ type: TEXT;
+ scale: 1;
+ effect: FAR_SOFT_SHADOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 0 0;
+ rel1.to: "title_bg";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "title_bg";
+ color: 0 0 0 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ size: 30;
+ font: "Sans";
+ style: "bold";
+ text: "onscreen title";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ part {
+ name:"content_bg";
+ type: RECT;
+ description {
+ min: 630 140;
+ max: 630 140;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 5 55;
+ rel1.to: "background";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: -5 -5;
+ rel2.to: "background";
+ color: 224 224 224 255;
+ }
+ }
+ part {
+ name: "content_text_left";
+ type: TEXTBLOCK;
+ scale: 1;
+ effect: FAR_SOFT_SHADOW;
+ description {
+ min: 600 135;
+ max: 600 135;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 15 0;
+ rel1.to: "content_bg";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "content_bg";
+ color: 0 0 0 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ style: "content_style_left";
+ text: "Oh, wet Alex, a jar, a fag! Up, disk, curve by! Man Oz, Iraq, Arizona, my Bev? Ruck's id-pug, a far Ajax, elate? Who? The quick brown fox jumps over the lazy dog.";
+ align: 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name: "content_text_center";
+ type: TEXTBLOCK;
+ scale: 1;
+ effect: FAR_SOFT_SHADOW;
+ description {
+ min: 600 135;
+ max: 600 135;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 15 0;
+ rel1.to: "content_bg";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "content_bg";
+ color: 0 0 0 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ style: "content_style_center";
+ text: "01234567890";
+ align: 0.0 0.0;
+ }
+ }
+ }
+ part {
+ name:"button_bg";
+ type: RECT;
+ description {
+ min: 630 95;
+ max: 630 95;
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 5 200;
+ rel1.to: "background";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "background";
+ color: 224 224 224 255;
+ }
+ }
+ part {
+ name:"button_barder";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.2 0.0;
+ rel1.offset: 5 5;
+ rel1.to: "button_bg";
+ rel2.relative: 0.8 1.0;
+ rel2.offset: -5 -5;
+ rel2.to: "button_bg";
+ color: 0 0 0 255;
+ }
+ }
+ part {
+ name:"button";
+ type: RECT;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 5 5;
+ rel1.to: "button_barder";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: -5 -5;
+ rel2.to: "button_barder";
+ color: 224 224 224 255;
+ }
+ }
+ part {
+ name: "button_text";
+ type: TEXT;
+ scale: 1;
+ effect: FAR_SOFT_SHADOW;
+ description {
+ state: "default" 0.0;
+ align: 0.0 0.0;
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 0 0;
+ rel1.to: "button";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: 0 0;
+ rel2.to: "button";
+ color: 0 0 0 255;
+ color2: 128 128 128 50;
+ color3: 128 128 128 25;
+ text {
+ size: 40;
+ font: "Sans";
+ style: "bold";
+ text: "OK";
+ align: 0.5 0.5;
+ }
+ }
+ }
+ }
+ }
+}
sb->UpdateNotificationPanel(noti.GetTitle(),
noti.GetIconPath(),
NULL);
-#if 1
+#if 0
int grpid = 0;
int privid = 0;
notification_get_id(notification_list_get_data(getlist),
# homescreen
SUBDIRS=\
- system-controller \
- statusbar
+ system-controller
+++ /dev/null
-AM_CFLAGS = $(GCC_CFLAGS)
-AM_CPPFLAGS = $(GCC_CXXFLAGS)
-
-noinst_PROGRAMS = \
- ico_send_notification
-
-check_PROGRAMS = \
- ico_send_notification
-
-ico_send_notification_SOURCES = \
- send_notification.cpp
-
-ico_send_notification_CXXFLAGS = \
- $(NOTIFICATION_CFLAGS)
-
-ico_send_notification_LDADD = \
- $(NOTIFICATION_LIBS)
-
+++ /dev/null
-#include <iostream>
-#include "notification.h"
-using namespace std;
-
-int main(){
- cout << "Notification TestProgram Start=========" <<endl;
-
- // notification variable declaration
- notification_h noti = NULL;
- notification_type_e type_ = NOTIFICATION_TYPE_NONE;
- notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
-
- // Initialize
- notification_get_type(noti, &type_);
- noti = notification_new(NOTIFICATION_TYPE_NOTI,
- NOTIFICATION_GROUP_ID_NONE,
- NOTIFICATION_PRIV_ID_NONE);
- if (NULL == noti) {
- cout << "notification_new() failed" << endl;
- return -1;
- }
-
-#if 0
- notification_list_h noti_list = NULL;
- notification_get_list(NOTIFICATION_TYPE_NOTI, -1, ¬i_list);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout << "Failed to get notificationList <error code>:"<< noti_err<<endl;
- return -1;
- }
- if(!noti_list){
- cout <<"Nothing NotificationList" <<endl;
- return -1;
- }
-#endif
-
- //set Pkgname
- noti_err = notification_set_pkgname(noti,"org.tizen.dialer");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout << "Failed to set Pkgname <error code>:"<< noti_err<<endl;
- return -1;
- }
-
- //set Title
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE,
- "TESTaaaaaaaaaaaaaaa",
- NULL,
- NOTIFICATION_VARIABLE_TYPE_NONE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout << "Failed to set notification title <error code>:"<< noti_err<<endl;
- return -1;
- }
-
- //set Content
- noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_CONTENT,
- "ContentAAAAAAAAAAAAAAA",
- NULL,
- NOTIFICATION_VARIABLE_TYPE_NONE);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout << "Failed to set notification content <error code>:"<< noti_err<<endl;
- return -1;
- }
-
-
- //set Icon_path
- noti_err = notification_set_icon(noti, "/opt/usr/apps/lYjFlj49Q4/res/wgt/saythis.png");
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout <<"Failed to set icon_path <error code>:"<< noti_err <<endl;
- return -1;
- }
-
- //insert to DB and appear on the notification_area
- //noti_err = notification_update(noti);
- noti_err = notification_insert(noti,NULL);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- if(noti_err == NOTIFICATION_ERROR_INVALID_DATA){
- cout << "Invalid parameter"<<endl;
- }
-
- cout <<"Failed to insert notification <error code>:"<< noti_err <<endl;
- cout <<"please start notification.service" <<endl;
- return -1;
- }
-
- //free to notification
- noti_err = notification_free(noti);
- if (noti_err != NOTIFICATION_ERROR_NONE) {
- cout <<"Failed to free notification <error code>:"<< noti_err <<endl;
- return -1;
- }
-
- cout << "Notification_TestProgram End!=========" <<endl;
- return 0;
-
-}
-
--- /dev/null
+AM_CFLAGS = $(GCC_CFLAGS)
+AM_CPPFLAGS = $(GCC_CXXFLAGS)
+
+noinst_PROGRAMS = \
+ ico_send_notification \
+ ico_dump_notification \
+ ico_del_notification
+
+check_PROGRAMS = \
+ ico_send_notification \
+ ico_dump_notification \
+ ico_dump_notification
+
+#
+#
+#
+ico_send_notification_SOURCES = \
+ send_notification.cpp
+
+ico_send_notification_CXXFLAGS = \
+ $(NOTIFICATION_CFLAGS)
+
+ico_send_notification_LDADD = \
+ $(NOTIFICATION_LIBS)
+
+#
+#
+#
+ico_dump_notification_SOURCES = \
+ dump_notification.cpp
+
+ico_dump_notification_CXXFLAGS = \
+ $(NOTIFICATION_CFLAGS)
+
+ico_dump_notification_LDADD = \
+ $(NOTIFICATION_LIBS)
+
+#
+#
+#
+ico_del_notification_SOURCES = \
+ del_notification.cpp
+
+ico_del_notification_CXXFLAGS = \
+ $(NOTIFICATION_CFLAGS)
+
+ico_del_notification_LDADD = \
+ $(NOTIFICATION_LIBS)
--- /dev/null
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <iostream>
+#include "notification.h"
+using namespace std;
+
+int
+main(int argc, char **argv)
+{
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+
+ if (argc == 2) {
+ if (0 == strcmp("--all", argv[1])) {
+ printf("delete all notifications\n");
+ err = notification_delete_all_by_type("", NOTIFICATION_TYPE_NOTI);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_delete_group_by_priv_id failed(%d).\n", err);
+ return -1;
+ }
+ return 0;
+ }
+ }
+
+ if (argc < 3) {
+ printf("%s pkgname priv_id\n", argv[0]);
+ return -1;
+ }
+
+ char *pkgname = argv[1];
+ int priv_id = atoi(argv[2]);
+ err = notification_delete_by_priv_id(pkgname,
+ NOTIFICATION_TYPE_NONE,
+ priv_id);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ printf("notification_delete_by_priv_id failed(%d).\n", err);
+ return -1;
+ }
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <iostream>
+#include "notification.h"
+using namespace std;
+
+int
+main()
+{
+ cout << "Notification TestProgram Start=========" << endl;
+
+ //notification variable declaration
+ notification_error_e err = NOTIFICATION_ERROR_NONE;
+ notification_list_h noti_list = NULL;
+
+ err = notification_get_list(NOTIFICATION_TYPE_NONE, -1, ¬i_list);
+ if (err != NOTIFICATION_ERROR_NONE) {
+ cout << "Failed to get notificationList <error code>:"<< err << endl;
+ return -1;
+ }
+
+ if (NULL == noti_list){
+ cout <<"Nothing NotificationList" <<endl;
+ return -1;
+ }
+
+ printf("gid | typ | pid | %-30s | %-30s | content\n", "pkgname", "title");
+ printf("----+-----+-----+--------------------------------+--------------------------------+--------------------------------\n");
+ //notification_list_h getlist = notification_list_get_head(noti_list);
+ notification_list_h getlist = notification_list_get_tail(noti_list);
+ do {
+ notification_h noti = notification_list_get_data(getlist);
+
+
+ notification_type_e type = NOTIFICATION_TYPE_NONE;
+ err = notification_get_type(noti, &type);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_set_text() failed(%d).\n", err);
+ return -1;
+ }
+
+ int grpid = 0;
+ int privid = 0;
+ err = notification_get_id(noti, &grpid, &privid);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_set_text() failed(%d).\n", err);
+ return -1;
+ }
+
+ char *caller_pkgname = NULL;
+ err = notification_get_pkgname(noti, &caller_pkgname);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_get_pkgname() failed(%d).\n", err);
+ return -1;
+ }
+
+ char *title = NULL;
+ err = notification_get_text(noti,
+ NOTIFICATION_TEXT_TYPE_TITLE,
+ &title);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_set_text() failed(%d).\n", err);
+ return -1;
+ }
+
+ char *content = NULL;
+ err = notification_get_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ &content);
+ if (NOTIFICATION_ERROR_NONE != err) {
+ printf("notification_get_text() failed(%d).\n", err);
+ return -1;
+ }
+
+ printf("%3d | %3d | %3d | %-30s | %-30s | %-30s\n",
+ grpid, type, privid, caller_pkgname, title, content);
+
+ //getlist = notification_list_get_next(getlist);
+ getlist = notification_list_get_prev(getlist);
+ } while (getlist != NULL);
+
+
+ cout << "Notification_TestProgram End!=========" << endl;
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+#include <iostream>
+#include "notification.h"
+using namespace std;
+
+const char *
+errorToString(notification_error_e error)
+{
+ const char *strerr = NULL;
+
+ switch (error) {
+ case NOTIFICATION_ERROR_NONE:
+ strerr = "NOTIFICATION_ERROR_NONE";
+ break;
+ case NOTIFICATION_ERROR_INVALID_DATA:
+ strerr = "NOTIFICATION_ERROR_INVALID_DATA";
+ break;
+ case NOTIFICATION_ERROR_NO_MEMORY:
+ strerr = "NOTIFICATION_ERROR_NO_MEMORY";
+ break;
+ case NOTIFICATION_ERROR_FROM_DB:
+ strerr = "NOTIFICATION_ERROR_FROM_DB";
+ break;
+ case NOTIFICATION_ERROR_ALREADY_EXIST_ID:
+ strerr = "NOTIFICATION_ERROR_ALREADY_EXIST_ID";
+ break;
+ case NOTIFICATION_ERROR_FROM_DBUS:
+ strerr = "NOTIFICATION_ERROR_FROM_DBUS";
+ break;
+ case NOTIFICATION_ERROR_NOT_EXIST_ID:
+ strerr = "NOTIFICATION_ERROR_NOT_EXIST_ID";
+ break;
+ case NOTIFICATION_ERROR_IO:
+ strerr = "NOTIFICATION_ERROR_IO";
+ break;
+ case NOTIFICATION_ERROR_SERVICE_NOT_READY:
+ strerr = "NOTIFICATION_ERROR_SERVICE_NOT_READY";
+ break;
+ case NOTIFICATION_ERROR_PERMISSION_DENIED:
+ strerr = "NOTIFICATION_ERROR_PERMISSION_DENIED";
+ break;
+ default:
+ strerr = "UNKOWN";
+ break;
+ }
+
+ return strerr;
+}
+
+int
+insert_notification(notification_type_e type,
+ int group_id,
+ int priv_id,
+ const char *pkgname,
+ const char *title,
+ const char *content,
+ const char *icon)
+{
+ notification_h noti = notification_new(type,
+ group_id,
+ priv_id);
+ if (NULL == noti) {
+ cout << "notification_new() failed." << endl;
+ return -1;
+ }
+
+ //set Pkgname
+ if (NULL == pkgname) {
+ return -1;
+ }
+
+ notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
+
+ noti_err = notification_set_pkgname(noti, pkgname);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ printf("notification_set_pkgname failed(%s).\n",
+ errorToString(noti_err));
+ return -1;
+ }
+
+ //set Title
+ if (NULL == title) {
+ return -1;
+ }
+ noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_TITLE,
+ title,
+ NULL,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ cout << "Failed to set notification title <error code>:"<< noti_err<<endl;
+ return -1;
+ }
+
+ //set Content
+ if (NULL == content) {
+ return -1;
+ }
+ noti_err = notification_set_text(noti,
+ NOTIFICATION_TEXT_TYPE_CONTENT,
+ content,
+ NULL,
+ NOTIFICATION_VARIABLE_TYPE_NONE);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ cout << "Failed to set notification content <error code>:"<< noti_err<<endl;
+ return -1;
+ }
+
+ //set Icon_path
+ if (NULL == icon) {
+ return -1;
+ }
+ noti_err = notification_set_icon(noti, icon);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ cout <<"Failed to set icon_path <error code>:"<< noti_err <<endl;
+ return -1;
+ }
+
+ //insert to DB and appear on the notification_area
+ //noti_err = notification_update(noti);
+ int private_id = 0;
+ noti_err = notification_insert(noti, &private_id);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ printf("notification_insert failed(%s).\n",
+ errorToString(noti_err));
+ return -1;
+ }
+
+ //free to notification
+ noti_err = notification_free(noti);
+ if (noti_err != NOTIFICATION_ERROR_NONE) {
+ cout <<"Failed to free notification <error code>:"<< noti_err <<endl;
+ return -1;
+ }
+
+ return 0;
+}
+
+int
+main(int argc, char **argv)
+{
+ cout << "Notification TestProgram Start=========" <<endl;
+
+ insert_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_GROUP_ID_DEFAULT,
+ NOTIFICATION_PRIV_ID_NONE,
+ "org.tizen.dialer",
+ "test_title",
+ "0123456789012345678901234",
+ "/usr/share/icons/default/small/org.tizen.dialer.png");
+
+ insert_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ "GV3ySIINq7.GhostCluster",
+ "test_title",
+ "test_content",
+ "/opt/share/icons/default/small/GV3ySIINq7.GhostCluster.png");
+
+ insert_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ "ODBQpKvkS1.Settings",
+ "test_title",
+ "test_content",
+ "/opt/share/icons/default/small/ODBQpKvkS1.Settings.png");
+
+ insert_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ "lYjFlj49Q4.saythis",
+ "test_title",
+ "test_content",
+ "/opt/share/icons/default/small/lYjFlj49Q4.saythis.png");
+
+ insert_notification(NOTIFICATION_TYPE_NOTI,
+ NOTIFICATION_GROUP_ID_NONE,
+ NOTIFICATION_PRIV_ID_NONE,
+ "t8j6HTRpuz.MediaPlayer",
+ "test_title",
+ "test_content",
+ "/opt/share/icons/default/small/t8j6HTRpuz.MediaPlayer.png");
+
+
+ cout << "Notification_TestProgram End!=========" <<endl;
+ return 0;
+}
./tests/system-controller/test-dummy-hs/Makefile.in \
./tool/.deps \
./tool/Makefile \
-./tool/Makefile.in
+./tool/Makefile.in \
+./tool/notification/Makefile \
+./tool/notification/Makefile.in