Delete as named ico_send_inputevent tool (It is contained in weston-plugin). 56/17956/2
authorMasayuki Sasaki <masayuki.sasaki@mail.toyota-td.jp>
Thu, 13 Mar 2014 06:22:12 +0000 (15:22 +0900)
committerOssama Othman <ossama.othman@intel.com>
Tue, 25 Mar 2014 23:00:51 +0000 (16:00 -0700)
bug fix: Swipe operation cannot be performed.

Change-Id: Ia84efcf365795359ae7956c5f4727482f4becc9e
Signed-off-by: Masayuki Sasaki <masayuki.sasaki@mail.toyota-td.jp>
13 files changed:
lib/system-controller/CicoSCWindowController.cpp
lib/system-controller/CicoSCWlWinMgrIF.cpp
src/homescreen/CicoHSMenuTile.cpp
src/homescreen/CicoHSMenuTile.h
src/homescreen/CicoHSMenuWindow.cpp
src/homescreen/CicoHSSwipeInputWindow.cpp
src/homescreen/CicoHSSwipeTouch.cpp
src/homescreen/CicoHSWindow.h
src/homescreen/CicoHomeScreen.cpp
src/statusbar/CicoStatusBar.cpp
src/statusbar/CicoStatusBar.h
tests/homescreen/Makefile.am
tests/homescreen/ico_send_inputevent.c [deleted file]

index f8f370a..8e934dd 100644 (file)
@@ -57,7 +57,7 @@ CicoSCWindowController* CicoSCWindowController::ms_myInstance = NULL;
 /**
  *  @brief  get instance of CicoSCWindowController
  *
- *  @return instance of CicoSCWayland
+ *  @return instance of CicoSCWindowController
  */
 //--------------------------------------------------------------------------
 CicoSCWindowController*
index 6b86ff1..dda5c06 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "ico_syc_type.h"
 #include "CicoSCWlWinMgrIF.h"
+#include "CicoSCWayland.h"
 #include "CicoLog.h"
 #include "CicoSystemConfig.h"
 #include "CicoConf.h"
@@ -313,6 +314,8 @@ CicoSCWlWinMgrIF::setAnimation(uint32_t surfaceid, int32_t type,
             "(surfaceid=0x%08X type=%d anima=%s time=%d)",
             surfaceid, type, animation, time);
     ico_window_mgr_set_animation(m_winmgr, surfaceid, type, animation, time);
+    // need wayland flush for GENIVI layer management
+    CicoSCWayland::getInstance()->flushDisplay();
 }
 
 //--------------------------------------------------------------------------
index 792f905..ee6291c 100644 (file)
@@ -97,7 +97,8 @@ CicoHSMenuTile::~CicoHSMenuTile(void)
 void
 CicoHSMenuTile::CreateObject(Evas *evas)
 {
-    ICO_DBG("CicoHSMenuTile::CreateObject Enter(appid=%08x<%s>)", (int)this->appid, appid);
+    ICO_DBG("CicoHSMenuTile::CreateObject Enter(appid=<%s> x/y=%d/%d)",
+            appid, pos_x, pos_y);
 
     /*initial vaule*/
     menu_evas = evas;
@@ -182,7 +183,7 @@ CicoHSMenuTile::FreeObject(void)
     ICO_DBG("CicoHSMenuTile::FreeObject(appid=%08x<%s>)", (int)this->appid, appid);
 
     if (thumb.surface)  {
-        sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
+        sprintf(sWork, "%s/%08x.bpm", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
                 thumb.surface);
         (void) unlink(sWork);
         ico_syc_unmap_thumb(thumb.surface);
@@ -527,8 +528,8 @@ CicoHSMenuTile::ValidThumbnail(int surface)
 
     if ((! app_running) || (surface == 0))  {
         if (thumb.surface != 0) {
-            sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                    thumb.surface);
+            sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                    ICO_HS_THUMB_FILEEXT, thumb.surface);
             (void) unlink(sWork);
             ico_syc_unmap_thumb(thumb.surface);
             // delete image and texture
@@ -540,8 +541,8 @@ CicoHSMenuTile::ValidThumbnail(int surface)
         thumb.surface = surface;
         if (surface)    {
             app_running = true;
-            sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                    thumb.surface);
+            sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                    ICO_HS_THUMB_FILEEXT, thumb.surface);
             (void) unlink(sWork);
             ico_syc_map_thumb(thumb.surface,
                               menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
@@ -604,6 +605,28 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info)
     int                 unmap;
     int                 fd;
     char                sWork[80];
+#if     0           /* for BMP format   */
+#pragma pack(push, 1)
+        struct _bmphead {
+            short   magic;
+            uint32_t fullsize;
+            short   res1;
+            short   res2;
+            int     offset;
+            int     headsize;
+            int     width;
+            int     height;
+            short   planes;
+            short   bitperpixel;
+            int     compress;
+            int     datasize;
+            int     xp;
+            int     yp;
+            int     colors;
+            int     colors2;
+        }   bmphead;
+#pragma pack(pop)
+#endif
 
     ICO_DBG("CicoHSMenuTile::SetThumbnail(appid=%08x<%s>) info=%08x surf=%08x",
             (int)this->appid, appid, (int)info, info ? info->surface : 0);
@@ -618,21 +641,20 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info)
                 ICO_DBG("CicoHSMenuTile::SetThumbnail: surface change(%08x->%08x)",
                         thumb.surface, info->surface);
                 ico_syc_unmap_thumb(thumb.surface);
-                sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                        thumb.surface);
+                sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                        ICO_HS_THUMB_FILEEXT, thumb.surface);
                 (void) unlink(sWork);
             }
             thumb.surface = info->surface;
-            sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                    thumb.surface);
-            (void) unlink(sWork);
+            sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                    ICO_HS_THUMB_FILEEXT, thumb.surface);
             ico_syc_map_thumb(thumb.surface,
                               menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
                                           ICO_HS_MENUTILE_THUMBNAIL_FPS_HIDE, sWork);
         }
         else    {
-            sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                    thumb.surface);
+            sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                    ICO_HS_THUMB_FILEEXT, thumb.surface);
         }
         thumb.type = info->type;
         thumb.width = info->width;
@@ -704,35 +726,48 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info)
                 }
             }
             /* read surface image pixel         */
-            int bufsize = ((thumb.width * thumb.height * 4 + 4096 - 1) / 4096) * 4095;
+            int bufsize = ((thumb.width * thumb.height * 4 + 4095) / 4096) * 4096;
             if ((! thumb.pixel_data) || (bufsize > thumb.pixel_bufsize))    {
                 if (thumb.pixel_data)   free(thumb.pixel_data);
                 thumb.pixel_data = (char *)malloc(bufsize);
                 thumb.pixel_bufsize = bufsize;
+                if (thumb.pixel_data)   {
+                    memset(thumb.pixel_data, 0, bufsize);
+                }
             }
             if (thumb.pixel_data)   {
                 fd = open(sWork, O_RDONLY, 0644);
-                if ((fd < 0) ||
-                    (read(fd, thumb.pixel_data, bufsize) <= 0)) {
-                    ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)", sWork);
-                    unmap = 1;
+                if (fd >= 0)    {
+#if     0           /* for BMP format   */
+                    if (read(fd, &bmphead, sizeof(bmphead)) != sizeof(bmphead)) {
+                        ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)",
+                                sWork);
+                    }
+                    else
+#endif
+                    if (read(fd, thumb.pixel_data, bufsize) <= 0)   {
+                        ICO_ERR("CicoHSMenuTile::SetThumbnail: can not read pixel file(%s)",
+                                sWork);
+                    }
+                }
+                else    {
+                    ICO_ERR("CicoHSMenuTile::SetThumbnail: can not open pixel file(%s)",
+                            sWork);
                 }
                 if (fd >= 0)    {
                     close(fd);
                     (void) unlink(sWork);
                 }
-                if (unmap == 0) {
-                    evas_object_image_data_update_add(
+                evas_object_image_data_update_add(
                                     thumb_tile, 0, 0, thumb.width, thumb.height);
-                    icon = thumb_tile;
-                    evas_object_image_size_set(thumb_tile, thumb.width, thumb.height);
-                    evas_object_image_data_set(thumb_tile, thumb.pixel_data);
-                    evas_object_image_filled_set(thumb_tile, EINA_TRUE);
-                    evas_object_resize(thumb_tile, width - thumb_reduce_x * 2,
-                                       height - thumb_reduce_y * 2);
-                    evas_object_move(thumb_tile,
-                                     pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
-                }
+                icon = thumb_tile;
+                evas_object_image_size_set(thumb_tile, thumb.width, thumb.height);
+                evas_object_image_data_set(thumb_tile, thumb.pixel_data);
+                evas_object_image_filled_set(thumb_tile, EINA_TRUE);
+                evas_object_resize(thumb_tile, width - thumb_reduce_x * 2,
+                                   height - thumb_reduce_y * 2);
+                evas_object_move(thumb_tile,
+                                 pos_x + thumb_reduce_x, pos_y + thumb_reduce_y);
             }
             else    {
                 ICO_ERR("CicoHSMenuTile::SetThumbnail: can not malloc pixel buffer");
@@ -744,8 +779,8 @@ CicoHSMenuTile::SetThumbnail(ico_syc_thumb_info_t *info)
     if (unmap > 0)  {
         ICO_DBG("CicoHSMenuTile::SetThumbnail: unmap thumbnail %08x", thumb.surface);
         if (thumb.surface)  {
-            sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                    thumb.surface);
+            sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                    ICO_HS_THUMB_FILEEXT, thumb.surface);
             (void) unlink(sWork);
             ico_syc_unmap_thumb(thumb.surface);
             thumb.surface = 0;
@@ -790,8 +825,8 @@ CicoHSMenuTile::ShowMenu(bool show)
     char    sWork[80];
     menu_show = show;
     if ((thumb_tile) && (thumb.surface != 0)) {
-        sprintf(sWork, "%s/%08x.pixel", ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR,
-                thumb.surface);
+        sprintf(sWork, ICO_HS_THUMB_ICODIR ICO_HS_THUMB_FILEDIR "/%08x."
+                ICO_HS_THUMB_FILEEXT, thumb.surface);
         (void) unlink(sWork);
         ico_syc_map_thumb(thumb.surface,
                           menu_show ? ICO_HS_MENUTILE_THUMBNAIL_FPS_SHOW :
index a795534..17319d6 100644 (file)
@@ -85,6 +85,7 @@
 /*shared memory buffer*/
 #define ICO_HS_THUMB_ICODIR       "/tmp/ico"
 #define ICO_HS_THUMB_FILEDIR       "/thumbnail"
+#define ICO_HS_THUMB_FILEEXT       "pixel"
 
 struct _CicoHSMenuTile_thumb {
     int         surface;                // surface id
index 4839005..bd67e73 100644 (file)
@@ -1399,7 +1399,9 @@ CicoHSMenuWindow::Hide(ico_syc_animation_t *animation)
         ChangeNormalMode();
     }
     m_showState = false;
-    ico_syc_hide(appid,surface,animation);
+    if (surface)    {
+        ico_syc_hide(appid, surface, animation);
+    }
 
     // Hide menu tiles
     for (int ii = 0; ii < all_tile_num; ii++) {
@@ -1407,7 +1409,6 @@ CicoHSMenuWindow::Hide(ico_syc_animation_t *animation)
             menu_tile[ii]->ShowMenu(false);
         }
     }
-
     ICO_TRA("CicoHSMenuWindow::Hide Leave");
 }
 
index 2edcd1e..dbf6f8e 100644 (file)
@@ -98,9 +98,6 @@ CicoHSSwipeInputWindow::CreateSwipeInputWindow(int pos_x, int pos_y,
 
     /* background object(transparent)    */
     background = evas_object_image_filled_add(evas);
-#if 0       /* TEST TEST: no need?  */
-    evas_object_color_set(background, 0, 0, 0, 0);
-#endif
 
     /* set mouse/touch callback */
     evas_object_event_callback_add(background, EVAS_CALLBACK_MOUSE_DOWN,
index e904b3e..e705dd9 100644 (file)
@@ -182,7 +182,7 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e
     set_xy_pos = false;
     sub = touch_state_a_x - touch_state_b_x;
 
-    /* check slide left to right or right to left   */
+    /* check swipe left to right or right to left   */
     if (sub > ICO_HS_SWIPE_TOUCH_SWIPE_THREASHOLD_DISTANCE) {
         if (touch_state_b_x < ICO_HS_SWIPE_TOUCH_SWIPE_THREASHOLD_DISTANCE) {
             /* get current application  */
@@ -331,7 +331,7 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e
                                              ICO_SYC_WIN_SURF_NORESCTL;
                             appinfo = CicoHomeScreen::GetAppInfo(curapp.c_str());
                             if (appinfo)    {
-                            animation.name = (char *)"slide.toright";
+                                animation.name = (char *)"slide.toright";
                                 for (idx = 0; ; idx++)  {
                                     wininfo = appinfo->GetWindowInfo(idx);
                                     if (! wininfo)  break;
@@ -367,7 +367,7 @@ CicoHSSwipeTouch::TouchUpSwipe(void *data, Evas *evas, Evas_Object *obj, void *e
     }
 
 #if 0       /* currently not support    */
-    /* check slide buttom to top or top to buttom   */
+    /* check swipe buttom to top or top to buttom   */
     sub = touch_state_a_y - touch_state_b_y;
     if (sub > ICO_HS_SWIPE_TOUCH_SWIPE_THREASHOLD_DISTANCE) {
         if (touch_state_b_y < ICO_HS_SWIPE_TOUCH_SWIPE_THREASHOLD_DISTANCE) {
index 41c5693..028a030 100644 (file)
@@ -56,7 +56,6 @@ class CicoHSWindow
     int width; /*width*/
     int height; /*height*/
     Ecore_Evas *window; /* ecore-evas object */
-
 };
 #endif
 // vim:set expandtab ts=4 sw=4:
index e748321..62d2aff 100644 (file)
@@ -273,6 +273,7 @@ CicoHomeScreen::ChangeActive(const char * appid, int surface)
     if (0 != wininfo->visible) {
         hs_instance->SetActiveAppInfo(appid);
         hs_instance->setActiveApp(appid);
+        ICO_TRA("CicoHomeScreen::ChangeActive set show");
         ico_syc_show(appid, surface, NULL);
         ico_syc_change_active(appid, surface);
     }
@@ -1183,7 +1184,7 @@ CicoHomeScreen::StartRelations(void)
                                              ICO_HS_APPID_DEFAULT_ONS),
             ICO_HS_MAX_PROCESS_NAME);
 // TODO
-#if 1
+#if 1   /* ToDo     */
     /* start onscreen & statusbar apps */
     os_app_info = GetAppInfo(os_package_name);
     ret = os_app_info->Execute();
@@ -1734,10 +1735,8 @@ CicoHomeScreen::StartHomeScreen(int orientation)
     moveZoneAnimation.name = (char*)config->ConfigGetString("switchzone",
                                                             "animation",
                                                             ICO_HS_ANIMATION_FADE);
-
     moveZoneAnimation.time = config->ConfigGetInteger("switchzone",
                                                       "animatime", 400);
-
     // debug log
     ICO_DBG("moveZoneName=%s animation=%s time=%d",
             moveZoneName, moveZoneAnimation.name, moveZoneAnimation.time);
@@ -1756,20 +1755,20 @@ CicoHomeScreen::StartHomeScreen(int orientation)
     x->hs        = this;
     ecore_timer_add(0.01, launchApps, x);
 
-    /*Create window*/
-    CreateControlBarWindow();
-
-    /*Create window*/
+    /* Create BackGround window */
     CreateBackWindow();
 
-    /*Create window*/
-    CreateMenuWindow();
-
-    /*Create SwipeInput window*/
+    /* Create SwipeInput window */
     CicoHSSwipeTouch::Initialize(hs_instance->ctl_bar_window, hs_instance->m_appHis,
                                  full_width, full_height);
     CreateSwipeInputWindow();
 
+    /* Create ControlBar window */
+    CreateControlBarWindow();
+
+    /* Create Menu window       */
+    CreateMenuWindow();
+
     /*Show Home Screen*/
     ShowHomeScreenLayer();
 
index dbf2b33..fc3bd75 100644 (file)
@@ -15,6 +15,8 @@
 #include <ico_log.h>
 #include "CicoStatusBar.h"
 
+using namespace std;
+
 const int CicoStatusBar::STATUSBAR_POSX = 0; 
 const int CicoStatusBar::STATUSBAR_POSY = 0; 
 const int CicoStatusBar::STATUSBAR_HEIGHT = 64;
@@ -38,6 +40,20 @@ CicoStatusBar::CicoStatusBar()
 
 //--------------------------------------------------------------------------
 /**
+ *  @brief  default destructor
+ *  @param[in]  none
+ *  @return     none
+ */
+//--------------------------------------------------------------------------
+CicoStatusBar::~CicoStatusBar()
+{
+    while( !noti_list.empty() ) {
+        DeleteNotification( this );
+    }
+}
+
+//--------------------------------------------------------------------------
+/**
  *  @brief  initialize status bar
  *  @param[in]  void
  *  @return     true: success   false: failed
@@ -142,22 +158,40 @@ CicoStatusBar::UpdateTime()
  */
 /*--------------------------------------------------------------------------*/
 bool
-CicoStatusBar::UpdateNotificationPanel(const char *msg,
-                                       const char *iconpath,
-                                       const char *soundpath)
+CicoStatusBar::UpdateNotificationPanel( CicoStatusBar *sb )
 {
+
+    /*  if timer is active then wait timeout  */
+    if (notitimer_ != NULL) {
+        ICO_TRA("CicoStatusBar::UpdateNotificationPanel Timer not Terminate" );
+        return false;
+    }
+
+    /*  get Notification , if it is empty then return  */
+    CicoNotification* noti = sb->GetNotification(sb);
+    if ( noti == NULL ) {
+        ICO_TRA("CicoStatusBar::UpdateNotificationPanel empty" );
+        return false;
+    }
+    //const char *msg = noti->GetTitle();
+    const char *msg = noti->GetContent();
+    const char *iconpath = noti->GetIconPath();
+    const char *soundpath = NULL;
+
+    /*  show Notification */
     ICO_TRA("CicoStatusBar::UpdateNotificationPanel Enter"
             "(msg=%s icon=%s sound=%s)", msg, iconpath, soundpath);
     if (msg == NULL && iconpath == NULL && soundpath == NULL) {
         ICO_ERR("notification info is NULL.");
+        sb->DeleteNotification(sb);
         return false;
     }
     noticomp_->SetNotification(msg, iconpath, soundpath);
     noticomp_->Show();
-    if (notitimer_ != NULL) {
-        ecore_timer_del(notitimer_);
-        notitimer_ = NULL;
-    }
+
+    /* delete Notification and set disp timer */
+    sb->DeleteNotification(sb);
+
     notitimer_ = ecore_timer_add(3.0, HideNotification, this);
     ICO_TRA("CicoStatusBar::UpdateNotificationPanel Leave");
     return true;
@@ -184,66 +218,22 @@ CicoStatusBar::NotificationCallback(void *data,
             type, num_op);
     CicoStatusBar *sb = reinterpret_cast<CicoStatusBar*>(data);
     notification_op_type_e op_type;
-    notification_list_h notificationlist = NULL;
-    notification_list_h getlist = NULL;
+
     for (int i = 0; i < num_op; i++) {
         op_type = op_list[i].type;
         switch (op_type) {
         case NOTIFICATION_OP_INSERT :
         case NOTIFICATION_OP_UPDATE :
-        {
             ICO_DBG("NOTIFICATION_OP_INSERT/NOTIFICATION_OP_UPDATE");
-            notification_error_e err = NOTIFICATION_ERROR_NONE;
-            ICO_DBG("called: notification_get_list(NOTIFICATION_TYPE_NOTI)");
-            err = notification_get_list(NOTIFICATION_TYPE_NOTI,
-                                        -1, &notificationlist);
-            if (NOTIFICATION_ERROR_NONE != err) {
-                ICO_ERR("notification_get_list() failed(%d).", err);
-                break;
-            }
-
-            if (notificationlist) {
-                ICO_DBG("called: notification_list_get_head(0x%08x)",
-                        notificationlist);
-                getlist = notification_list_get_head(notificationlist);
-                do {
-                    CicoNotification noti(notification_list_get_data(getlist));
-                    if (noti.Empty()) {
-                        break;
-                    }
-                    sb->UpdateNotificationPanel(noti.GetTitle(),
-                                                noti.GetIconPath(), 
-                                                NULL);
-#if 0
-                    int grpid = 0;
-                    int privid = 0;
-                    notification_get_id(notification_list_get_data(getlist),
-                                        &grpid, &privid);
-                    notification_delete_group_by_priv_id(noti.GetPkgname(),
-                                                         noti.GetType(),
-                                                         privid);
-#endif
-
-                    ICO_DBG("called: notification_list_get_next(0x%08x)",
-                            getlist);
-                    getlist = notification_list_get_next(getlist);
-                } while (getlist != NULL);
-            }
-
-            if (notificationlist != NULL) {
-                ICO_DBG("called: notification_free_list(0x%08x)",
-                        notificationlist);
-                notification_error_e err = NOTIFICATION_ERROR_NONE;
-                err = notification_free_list(notificationlist);
-                if (NOTIFICATION_ERROR_NONE != err) {
-                    ICO_ERR("notification_free_list() failed.");
-                }
-                notificationlist = NULL;
-            }
+
+            /*  add notification and update SB  */
+            sb->AddNotification( sb, op_list[i].noti );
+            sb->UpdateNotificationPanel( sb );
+
             break;
-        }
         case NOTIFICATION_OP_DELETE:
             ICO_DBG("NOTIFICATION_OP_DELETE");
+            sb->DeleteNotification( sb, op_list[i].priv_id );
             break;
         case NOTIFICATION_OP_DELETE_ALL:
             ICO_DBG("NOTIFICATION_OP_DELETE_ALL");
@@ -277,10 +267,119 @@ CicoStatusBar::HideNotification(void *data)
     sb->noticomp_->Hide();
     ecore_timer_del(sb->notitimer_);
     sb->notitimer_ = NULL;
+
+    /*  update notification ,if Notification exist in the queue   */
+    sb->UpdateNotificationPanel( sb );
+
     ICO_TRA("CicoStatusBar::HideNotification Leave");
     return ECORE_CALLBACK_CANCEL;
 }
 
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief    add last notification
+ *
+ * @param[in]   sb    StatusBar object
+ * @param[in]   noti_h  notification handle
+ * @return      non
+ */
+/*--------------------------------------------------------------------------*/
+void 
+CicoStatusBar::AddNotification(CicoStatusBar* sb, notification_h noti_h)
+{
+    ICO_TRA("CicoStatusBar::AddNotification() Enter");
+
+    CicoNotification *noti = new CicoNotification( noti_h );
+    if (noti->GetType() != NOTIFICATION_TYPE_ONGOING ) {
+        delete noti;
+        return;
+    }
+    sb->noti_list.push_back(noti);
+
+    ICO_TRA("CicoStatusBar::AddNotification Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief    get first notification
+ *
+ * @param[in]   sb    StatusBar object
+ * @return      CicoNotification class pointer
+ */
+/*--------------------------------------------------------------------------*/
+CicoNotification* 
+CicoStatusBar::GetNotification(CicoStatusBar* sb)
+{
+    ICO_TRA("CicoStatusBar::GetNotification() Enter");
+
+    if ( ! sb->noti_list.empty() ) {
+        CicoNotification *noti = sb->noti_list.front();
+        if ( noti ) {
+            return noti;
+        }
+        else {
+            DeleteNotification(sb);
+        }
+    }
+    ICO_TRA("CicoStatusBar::GetNotification Leave");
+    return NULL;
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief    delete first notification
+ *
+ * @param[in]   sb    StatusBar object
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBar::DeleteNotification(CicoStatusBar *sb)
+{
+    ICO_TRA("CicoStatusBar::DeleteNotification() Enter");
+
+    if ( ! sb->noti_list.empty() ) {
+        CicoNotification *noti = sb->noti_list.front();
+        if ( noti ) {
+            delete noti;
+        }
+        sb->noti_list.pop_front();
+    }
+
+    ICO_TRA("CicoStatusBar::DeleteNotification Leave");
+}
+
+/*--------------------------------------------------------------------------*/
+/**
+ * @brief    delete  notification
+ *
+ * @param[in]   sb    StatusBar object
+ * @param[in]   noti_h  notification handle
+ * @return      none
+ */
+/*--------------------------------------------------------------------------*/
+void
+CicoStatusBar::DeleteNotification(CicoStatusBar *sb, int priv_id)
+{
+    ICO_TRA("CicoStatusBar::DeleteNotification() Enter");
+
+    List_CicoNoti_pt pt = noti_list.begin();
+    for (; pt != noti_list.end(); ++pt) {
+
+        CicoNotification *noti_src = *pt;
+        if ( priv_id == noti_src->GetPrivId() ) {
+
+            delete noti_src;
+            noti_list.erase(pt);
+            break;
+        }
+    }
+
+    ICO_TRA("CicoStatusBar::DeleteNotification Leave");
+}
+
+
+
 //==========================================================================
 //  public functions
 //==========================================================================
index fefa624..5ceeac6 100644 (file)
 #define __CICO_STATUSBAR_H__
 
 #include <memory>
+#include <list>
 #include "CicoComponentImplementation.h"
 #include "CicoCommonWindow.h"
 #include "CicoNotification.h"
 #include "CicoNotificationService.h"
 
+/* CicoNotification queue list */
+typedef  std::list<CicoNotification*> List_CicoNoti;
+typedef  std::list<CicoNotification*>::iterator List_CicoNoti_pt;
+
 //==========================================================================
 /**
  *  @brief  This class provide the status bar window
@@ -44,9 +49,22 @@ public:
     // update clock
     bool UpdateTime(void);
 
+    // add last Notification queue
+    void AddNotification(CicoStatusBar *sb, notification_h noti_h);
+
+    // get first Notification queue
+    CicoNotification* GetNotification(CicoStatusBar *sb);
+
+    // delete first Notification queue
+    void DeleteNotification(CicoStatusBar *sb);
+
+    // delete Notification queue
+    void DeleteNotification(CicoStatusBar *sb, int priv_id);
+
     // update notification panel
-    bool UpdateNotificationPanel(const char *msg, const char *icopath, 
-                                 const char *soundpath);
+    //bool UpdateNotificationPanel(const char *msg, const char *icopath, 
+    //                             const char *soundpath);
+    bool UpdateNotificationPanel(CicoStatusBar *sb);
 
     // notification callback
     static void NotificationCallback(void *data, notification_type_e type,
@@ -66,6 +84,8 @@ protected:
     static const int CLOCK_HEIGHT;      /// clock height
 
     Ecore_Timer *notitimer_;            /// notification timer
+    List_CicoNoti noti_list;            /// notification Queue
+
     std::shared_ptr<CicoStatusBarClockComponent> clockcomp_;    /// clock component
     std::shared_ptr<CicoNotificationPanelComponent> noticomp_;  /// notification component
     CicoNotificationService notiservice_;   /// notification service
index cc8ee7e..ffa4dd5 100644 (file)
@@ -3,20 +3,15 @@ AM_CPPFLAGS = $(GCC_CFLAGS)
 
 bin_PROGRAMS =         \
        ico_set_vehicleinfo     \
-       ico_send_inputevent \
        ico_send_hscommand
 
 check_PROGRAMS =       \
-       ico_set_vehicleinfo     \
-       ico_send_inputevent
+       ico_set_vehicleinfo
 
 ico_set_vehicleinfo_SOURCES = \
        ico_set_vehicleinfo.c
 ico_set_vehicleinfo_LDADD = -lwebsockets 
 
-ico_send_inputevent_SOURCE = \
-       ico_send_inputevent.c
-
 ico_send_hscommand_SOURCES = \
        ico_send_hscommand.c
 ico_send_hscommand_CFLAGS = -I../include $(UWS_CFLAGS)
diff --git a/tests/homescreen/ico_send_inputevent.c b/tests/homescreen/ico_send_inputevent.c
deleted file mode 100644 (file)
index 48085a8..0000000
+++ /dev/null
@@ -1,485 +0,0 @@
-/*
- * 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
- *
- */
-/**
- * @brief   System Test Tool for send device input event
- *
- * @date    Feb-20-2013
- */
-
-#include    <stdio.h>
-#include    <stdlib.h>
-#include    <unistd.h>
-#include    <string.h>
-#include    <errno.h>
-#include    <pthread.h>
-#include    <sys/ioctl.h>
-#include    <sys/ipc.h>
-#include    <sys/msg.h>
-#include    <sys/time.h>
-#include    <sys/types.h>
-#include    <sys/stat.h>
-#include    <signal.h>
-#include    <fcntl.h>
-#include    <linux/input.h>
-#include    <linux/uinput.h>
-#include    <linux/joystick.h>
-
-#define DEV_TOUCH   0
-#define DEV_JS      1
-#define SPECIALTYPE_XY  9991
-
-static const struct {
-    char    *prop;
-    short   devtype;
-    short   type;
-    short   code;
-    short   value;
-}               event_key[] = {
-    { "X", DEV_TOUCH, EV_ABS, ABS_X, -1 },
-    { "Y", DEV_TOUCH, EV_ABS, ABS_Y, -1 },
-    { "Down", DEV_TOUCH, EV_KEY, BTN_TOUCH, 1 },
-    { "Up", DEV_TOUCH, EV_KEY, BTN_TOUCH, 0 },
-    { "Touch", DEV_TOUCH, EV_KEY, BTN_TOUCH, -1 },
-    { "XY", DEV_TOUCH, SPECIALTYPE_XY, 0, -1 },
-    { "SYN", DEV_TOUCH, 0, 0, 0 },
-    { "Button", DEV_TOUCH, EV_KEY, BTN_LEFT, -1 },
-    { "ButtonOn", DEV_TOUCH, EV_KEY, BTN_LEFT, 1 },
-    { "ButtonOff", DEV_TOUCH, EV_KEY, BTN_LEFT, 0 },
-
-    { "UpDown", DEV_JS, 2, 3, 1 },
-    { "UD", DEV_JS, 2, 3, 1 },
-    { "LeftRight", DEV_JS, 2, 2, 2 },
-    { "LR", DEV_JS, 2, 2, 2 },
-    { "Cross", DEV_JS, 1, 0, 3 },
-    { "Squere", DEV_JS, 1, 1, 4 },
-    { "Circle", DEV_JS, 1, 2, 5 },
-    { "Triangle", DEV_JS, 1, 3, 6 },
-    { "\0", 0, 0, 0, 0 } };
-
-static int  uifd = -1;
-static int  mqid = -1;
-static int  mDebug = 0;
-static int  mRun = 1;
-static int  mTouch = 1;
-
-static void
-term_signal(const int signo)
-{
-    mRun = 0;
-}
-
-static void
-init_mq(const int mqkey)
-{
-    char    dummy[256];
-
-    if (mqkey == 0) {
-        mqid = -1;
-    }
-    else    {
-        mqid = msgget(mqkey, 0);
-        if (mqid < 0)   {
-            mqid = msgget(mqkey, IPC_CREAT);
-        }
-        if (mqid < 0)   {
-            fprintf(stderr, "Can not create message queue(%d(0x%x))[%d]\n",
-                    mqkey, mqkey, errno);
-            fflush(stderr);
-            return;
-        }
-        while (msgrcv(mqid, dummy, sizeof(dummy)-sizeof(long), 0, IPC_NOWAIT) > 0)  ;
-    }
-}
-
-static void
-init_device(const char *device)
-{
-    int     fd;
-    int     ii;
-    char    devFile[64];
-    char    devName[64];
-    struct uinput_user_dev  uinputDevice;
-    uifd = open("/dev/uinput", O_RDWR);
-
-    if (uifd < 0)   {
-        fprintf(stderr, "/dev/uinput open error[%d]\n", errno);
-        fflush(stderr);
-        exit(1);
-    }
-
-    memset(&uinputDevice, 0, sizeof(uinputDevice));
-    strcpy(uinputDevice.name, device);
-    uinputDevice.absmax[ABS_X] = 1920;
-    uinputDevice.absmax[ABS_Y] = 1080;
-
-    /* uinput device configuration  */
-    if (write(uifd, &uinputDevice, sizeof(uinputDevice)) < (int)sizeof(uinputDevice)) {
-        fprintf(stderr, "/dev/uinput regist error[%d]\n", errno);
-        fflush(stderr);
-        close(uifd);
-        exit(1);
-    }
-
-    /* uinput set event bits        */
-    ioctl(uifd, UI_SET_EVBIT, EV_SYN);
-
-    if ((mTouch != 0) && (mTouch != 3)) {
-        ioctl(uifd, UI_SET_EVBIT, EV_ABS);
-        ioctl(uifd, UI_SET_ABSBIT, ABS_X);
-        ioctl(uifd, UI_SET_ABSBIT, ABS_Y);
-        ioctl(uifd, UI_SET_EVBIT, EV_KEY);
-        if (mTouch == 1)    {
-            ioctl(uifd, UI_SET_KEYBIT, BTN_LEFT);
-        }
-        else    {
-            ioctl(uifd, UI_SET_KEYBIT, BTN_TOUCH);
-            ioctl(uifd, UI_SET_KEYBIT, BTN_TOOL_PEN);
-        }
-    }
-    else    {
-        ioctl(uifd, UI_SET_EVBIT, EV_REL);
-        ioctl(uifd, UI_SET_RELBIT, REL_X);
-        ioctl(uifd, UI_SET_RELBIT, REL_Y);
-        ioctl(uifd, UI_SET_RELBIT, REL_Z);
-        ioctl(uifd, UI_SET_RELBIT, REL_RX);
-        ioctl(uifd, UI_SET_RELBIT, REL_RY);
-        ioctl(uifd, UI_SET_RELBIT, REL_RZ);
-        ioctl(uifd, UI_SET_EVBIT, EV_KEY);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_RESERVED);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_ESC);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_1);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_2);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_3);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_4);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_5);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_6);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_7);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_8);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_9);
-        ioctl(uifd, UI_SET_KEYBIT, KEY_0);
-    }
-
-    ioctl(uifd, UI_SET_EVBIT, EV_MSC);
-    ioctl(uifd, UI_SET_MSCBIT, MSC_SCAN);
-
-    /* create event device          */
-    if (ioctl(uifd, UI_DEV_CREATE, NULL) < 0)   {
-        fprintf(stderr, "/dev/uinput create error[%d]\n", errno);
-        fflush(stderr);
-        close(uifd);
-        exit(1);
-    }
-
-    for (ii = 0; ii < 16; ii++) {
-        snprintf(devFile, 64, "/dev/input/event%d", ii);
-        fd = open(devFile, O_RDONLY);
-        if (fd < 0)     continue;
-
-        memset(devName, 0, sizeof(devName));
-        ioctl(fd, EVIOCGNAME(sizeof(devName)), devName);
-        close(fd);
-    }
-}
-
-static int
-convert_value(const char *value, char **errp, int base)
-{
-    int i;
-
-    for (i = 0; value[i]; i++)  {
-        if ((value[i] == ',') || (value[i] == ';') ||
-            (value[i] == ';') || (value[i] == ' ')) {
-            break;
-        }
-    }
-    if (errp)   {
-        *errp = (char *)&value[i];
-    }
-
-    if ((strncasecmp(value, "on", i) == 0) ||
-        (strncasecmp(value, "true", i) == 0) ||
-        (strncasecmp(value, "push", i) == 0) ||
-        (strncasecmp(value, "down", i) == 0) ||
-        (strncasecmp(value, "right", i) == 0))  {
-        return 1;
-    }
-    else if ((strncasecmp(value, "off", i) == 0) ||
-             (strncasecmp(value, "false", i) == 0) ||
-             (strncasecmp(value, "pop", i) == 0) ||
-             (strncasecmp(value, "up", i) == 0) ||
-             (strncasecmp(value, "left", i) == 0))  {
-        return 0;
-    }
-    return strtol(value, (char **)0, 0);
-}
-
-static void
-send_event(const char *cmd)
-{
-    int     i, j;
-    int     key;
-    char    prop[64];
-    char    value[128];
-    int     sec, msec;
-    char    *errp;
-    struct input_event  event;
-    struct js_event     js;
-
-    j = 0;
-    for (i = 0; cmd[i]; i++)    {
-        if ((cmd[i] == '=') || (cmd[i] == ' ')) break;
-        if (j < (int)(sizeof(prop)-1))  {
-            prop[j++] = cmd[i];
-        }
-    }
-
-    prop[j] = 0;
-    j = 0;
-    if (cmd[i] != 0)    {
-        for (i++; cmd[i]; i++)  {
-            if (cmd[i] == ' ')  continue;
-            if (j < (int)(sizeof(value)-1)) {
-                value[j++] = cmd[i];
-            }
-        }
-    }
-    value[j] = 0;
-
-    if (strcasecmp(prop, "sleep") == 0) {
-        sec = 0;
-        msec = 0;
-        for (i = 0; value[i]; i++)  {
-            if (value[i] == '.')        break;
-            sec = sec * 10 + (value[i] & 0x0f);
-        }
-        if (value[i] == '.')    {
-            i++;
-            if (value[i] != 0)  {
-                msec = (value[i] & 0x0f) * 100;
-                i++;
-            }
-            if (value[i] != 0)  {
-                msec = msec + (value[i] & 0x0f) * 10;
-                i++;
-            }
-            if (value[i] != 0)  {
-                msec = msec + (value[i] & 0x0f);
-            }
-        }
-        if (sec > 0)    sleep(sec);
-        if (msec > 0)   usleep(msec * 1000);
-
-        return;
-    }
-
-    for (key = 0; event_key[key].prop[0]; key++)    {
-        if (strcasecmp(prop, event_key[key].prop) == 0) break;
-    }
-    if (! event_key[key].prop[0])   {
-        fprintf(stderr, "UnKnown Event name[%s]\n", prop);
-        return;
-    }
-
-    if (mTouch != 0)    {
-        memset(&event, 0, sizeof(event));
-        gettimeofday(&event.time, NULL);
-        if (event_key[key].type == SPECIALTYPE_XY)  {
-            event.type = EV_ABS;
-            event.code = ABS_X;
-            event.value = convert_value(value, &errp, 0);
-            if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-                fprintf(stderr, "event write error 1[%d]\n", errno);
-                fflush(stderr);
-                return;
-            }
-            event.code = ABS_Y;
-            if (*errp == ',')   {
-                event.value = convert_value(errp + 1, (char **)0, 0);
-            }
-            else    {
-                event.value = 0;
-            }
-            event.time.tv_usec += 200;
-            if (event.time.tv_usec >= 1000000)  {
-                event.time.tv_sec ++;
-                event.time.tv_usec -= 1000000;
-            }
-        }
-        else    {
-            event.type = event_key[key].type;
-
-            if (event_key[key].code == -1)   {
-                event.code = convert_value(value, (char **)0, 0);
-            }
-            else    {
-                event.code = event_key[key].code;
-                event.value = convert_value(value, (char **)0, 0);
-            }
-            if (mDebug) {
-                if ((event.type == EV_ABS) && (event.code == ABS_X))    {
-                }
-                else if ((event.type == EV_ABS) && (event.code == ABS_Y))    {
-                }
-                else if ((event.type == EV_KEY) && (event.code == BTN_LEFT) && (event.value == 1))    {
-                }
-                else if ((event.type == EV_KEY) && (event.code == BTN_LEFT) && (event.value == 0))   {
-                }
-                else    {
-                    if ((event.type == EV_REL) && (event.value == 0))   {
-                        event.value = 9;
-                    }
-                    else if ((event.type == EV_KEY) && (event.code == 0))   {
-                        event.code = 9;
-                    }
-                }
-            }
-        }
-        if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-            fprintf(stderr, "event write error 2[%d]\n", errno);
-            fflush(stderr);
-        }
-        else    {
-            /* send EV_SYN */
-            memset(&event, 0, sizeof(event));
-            gettimeofday(&event.time, NULL);
-            event.type = EV_SYN;
-            event.code = SYN_REPORT;
-            if (write(uifd, &event, sizeof(struct input_event)) < 0)    {
-                fprintf(stderr, "syn event write error 3[%d]\n", errno);
-            }
-        }
-    }
-    else    {
-        memset(&js, 0, sizeof(js));
-        gettimeofday(&event.time, NULL);
-        js.time = (event.time.tv_sec * 1000) + (event.time.tv_usec / 1000);
-        js.type = event_key[key].type;
-        js.number = event_key[key].code;
-        js.value = convert_value(value, (char **)0, 0);
-        if (write(uifd, &js, sizeof(struct js_event)) < 0)  {
-            fprintf(stderr, "event write error 4[%d]\n", errno);
-            fflush(stderr);
-        }
-    }
-}
-
-static void
-usage(const char *prog)
-{
-    fprintf(stderr, "Usage: %s [-device=device] [{-m/-t/-j}] [-mq[=key]] [-d] [event=value] [event=value] ...\n", prog);
-    exit(0);
-}
-
-int
-main(int argc, char *argv[])
-{
-    int     i, j, k;
-    int     mqkey = 0;
-    struct {
-        long    mtype;
-        char    buf[240];
-    }       mqbuf;
-    char    buf[240];
-
-    j = 0;
-    strcpy(buf, "ico_test_device");
-    for (i = 1; i < argc; i++)  {
-        if (argv[i][0] == '-')  {
-            if (strncasecmp(argv[i], "-device=", 8) == 0)   {
-                strcpy(buf, &argv[i][8]);
-            }
-            else if (strcasecmp(argv[i], "-m") == 0)   {
-                mTouch = 1;                 /* Simulate mouse               */
-            }
-            else if (strcasecmp(argv[i], "-t") == 0)   {
-                mTouch = 2;                 /* Simulate touch-panel         */
-            }
-            else if (strcmp(argv[i], "-j") == 0)   {
-                mTouch = 0;                 /* Simulate joystick            */
-            }
-            else if (strcmp(argv[i], "-J") == 0)   {
-                mTouch = 3;                 /* Simulate joystick, but event is mouse    */
-            }
-            else if (strncasecmp(argv[i], "-mq", 3) == 0)   {
-                if (argv[i][3] == '=')  {
-                    mqkey = strtol(&argv[i][4], (char **)0, 0);
-                }
-                else    {
-                    mqkey = 55551;          /* default message queue key    */
-                }
-            }
-            else if (strcasecmp(argv[i], "-d") == 0)   {
-                mDebug = 1;
-            }
-            else    {
-                usage(argv[0]);
-            }
-        }
-        else    {
-            j++;
-        }
-    }
-
-    init_mq(mqkey);
-
-    init_device(buf);
-
-    mRun = 1;
-
-    signal(SIGTERM, term_signal);
-    signal(SIGINT, term_signal);
-
-    if (mqid >= 0)  {
-        while (mRun)  {
-            memset(&mqbuf, 0, sizeof(mqbuf));
-            if (msgrcv(mqid, &mqbuf, sizeof(mqbuf)-sizeof(long), 0, 0) < 0) {
-                if (errno == EINTR) continue;
-                fprintf(stderr, "test-send_event: mq(%d) receive error[%d]\n",
-                        mqkey, errno);
-                fflush(stderr);
-                break;
-            }
-            k = 0;
-            j = -1;
-            for (i = 0; mqbuf.buf[i]; i++)    {
-                if ((mqbuf.buf[i] == '#') || (mqbuf.buf[i] == '\n')
-                    || (mqbuf.buf[i] == '\r'))    break;
-                if (mqbuf.buf[i] == '\t') buf[k++] = ' ';
-                else                        buf[k++] = mqbuf.buf[i];
-                if ((j < 0) && (mqbuf.buf[i] != ' ')) j = i;
-            }
-            if (j < 0)  continue;
-            buf[k] = 0;
-            send_event(&buf[j]);
-        }
-        msgctl(mqid, IPC_RMID, NULL);
-    }
-    else if (j <= 0) {
-        while ((mRun != 0) && (fgets(buf, sizeof(buf), stdin) != NULL))  {
-            j = -1;
-            for (i = 0; buf[i]; i++)    {
-                if ((buf[i] == '#') || (buf[i] == '\n') || (buf[i] == '\r'))    break;
-                if (buf[i] == '\t') buf[i] = ' ';
-                if ((j < 0) && (buf[i] != ' ')) j = i;
-            }
-            if (j < 0)  continue;
-            buf[i] = 0;
-            send_event(&buf[j]);
-        }
-    }
-    else    {
-        for (i = 1; i < argc; i++)  {
-            if (argv[i][0] == '-')  continue;
-            if (mRun == 0)  break;
-            send_event(argv[i]);
-        }
-    }
-    exit(0);
-}
-