[ITC][ACR-1479][notification][remove noti type] 24/225324/4
authormanoj <manoj.g2@samsung.com>
Wed, 19 Feb 2020 06:04:44 +0000 (11:34 +0530)
committershobhit verma <shobhit.v@samsung.com>
Wed, 19 Feb 2020 10:52:22 +0000 (10:52 +0000)
Change-Id: I5a316fb5462864030189b3c8cec1a6d51bbbc6e8
Signed-off-by: manoj <manoj.g2@samsung.com>
src/itc/notification/ITs-notification-common.c
src/itc/notification/ITs-notification-common.h
src/itc/notification/ITs-notification-ex.c
src/itc/notification/ITs-notification.c

index 551f829dc610dbf5e3d2f91681cf4e374850f052..2cccf763a6b326cfa2f5a5691608a7a61cebf6f4 100755 (executable)
@@ -79,68 +79,9 @@ bool NotificationAppendToAppDataPath(char* pInputPath, char* pFinalPath)
        return true;
 }
 
-/**
-* @function            CreateNotification
-* @description         Creates internal structure data and returns a notification handle.
-* @parameter       NotificationType
-* @return                      NA
-*/ 
-bool CreateNotification(notification_type_e eNotificationType)
-{
-       int nRet = 0;
-       FreeAndDeleteNotificationResourceHandle();
-       g_NotificationHandle = notification_create(eNotificationType);
-       CHECK_HANDLE(g_NotificationHandle, "notification_create");
 
-       nRet = notification_post(g_NotificationHandle);
-       if ( nRet != NOTIFICATION_ERROR_NONE )
-       {
-               FPRINTF("[Line : %d][%s] notification_post failed, error returned = %s\\n", __LINE__, API_NAMESPACE, NotificationGetError(nRet));
-               return false;
-       }       
 
-       return true;
-}
 
-/**
-* @function            FreeAndDeleteNotificationResourceHandle
-* @description         Free internal data structure and notification handle.
-* @parameter       
-* @return                      NA
-*/
-void FreeAndDeleteNotificationResourceHandle()
-{
-       DELETE_NOTIFICATION(g_NotificationHandle);
-       FREE_NOTIFICATION(g_NotificationHandle);
-       g_NotificationHandle = NULL;
-}
-
-/**
-* @function            NotificationGetError
-* @description         Maps error enums to string values
-* @parameter           nRet : error code returned
-* @return                      error string
-*/
-char* NotificationGetError(int nRet)
-{
-       char *szErrorVal = NULL;
-       switch ( nRet )
-       {
-       case NOTIFICATION_ERROR_NONE:                                   szErrorVal = "NOTIFICATION_ERROR_NONE";                                         break;
-       case NOTIFICATION_ERROR_INVALID_PARAMETER:              szErrorVal = "NOTIFICATION_ERROR_INVALID_PARAMETER";            break;
-       case NOTIFICATION_ERROR_OUT_OF_MEMORY:                  szErrorVal = "NOTIFICATION_ERROR_OUT_OF_MEMORY";                        break;
-       case NOTIFICATION_ERROR_FROM_DB:                                szErrorVal = "NOTIFICATION_ERROR_FROM_DB";                                      break;
-       case NOTIFICATION_ERROR_ALREADY_EXIST_ID:               szErrorVal = "NOTIFICATION_ERROR_ALREADY_EXIST_ID";                     break;
-       case NOTIFICATION_ERROR_FROM_DBUS:                              szErrorVal = "NOTIFICATION_ERROR_FROM_DBUS";                            break;
-       case NOTIFICATION_ERROR_NOT_EXIST_ID:                   szErrorVal = "NOTIFICATION_ERROR_NOT_EXIST_ID";                         break;
-       case NOTIFICATION_ERROR_IO_ERROR:                               szErrorVal = "NOTIFICATION_ERROR_IO_ERROR";                                     break;
-       case NOTIFICATION_ERROR_SERVICE_NOT_READY:              szErrorVal = "NOTIFICATION_ERROR_SERVICE_NOT_READY";            break;
-       case NOTIFICATION_ERROR_PERMISSION_DENIED:              szErrorVal = "NOTIFICATION_ERROR_PERMISSION_DENIED";            break;
-       default:                                                                                szErrorVal = "Unknown Error";                                                           break;
-       }
-
-       return szErrorVal;
-}
 
 /**
 * @function            Application_AppControlGetError
@@ -184,319 +125,4 @@ gboolean Timeout(gpointer data)
        return false;
 }
 
-/**
-* @function            NotificationExGetError
-* @description         Maps error enums to string values
-* @parameter           nRet : error code returned
-* @return              error string
-*/
-char* NotificationExGetError(int nRet)
-{
-       char *szErrorVal = "Unknown Error";
-       switch ( nRet )
-       {
-       case NOTI_EX_ERROR_NONE:                        szErrorVal = "NOTI_EX_ERROR_NONE";              break;
-       case NOTI_EX_ERROR_INVALID_PARAMETER:           szErrorVal = "NOTI_EX_ERROR_INVALID_PARAMETER";         break;
-       case NOTI_EX_ERROR_OUT_OF_MEMORY:               szErrorVal = "NOTI_EX_ERROR_OUT_OF_MEMORY";             break;
-       case NOTI_EX_ERROR_IO_ERROR:            szErrorVal = "NOTI_EX_ERROR_IO_ERROR";          break;
-       case NOTI_EX_ERROR_PERMISSION_DENIED:           szErrorVal = "NOTI_EX_ERROR_PERMISSION_DENIED";         break;
-       case NOTI_EX_ERROR_FROM_DB:             szErrorVal = "NOTI_EX_ERROR_FROM_DB";           break;
-       case NOTI_EX_ERROR_ALREADY_EXIST_ID:            szErrorVal = "NOTI_EX_ERROR_ALREADY_EXIST_ID";          break;
-       case NOTI_EX_ERROR_FROM_DBUS:           szErrorVal = "NOTI_EX_ERROR_FROM_DBUS";         break;
-       case NOTI_EX_ERROR_NOT_EXIST_ID:                        szErrorVal = "NOTI_EX_ERROR_NOT_EXIST_ID";              break;
-       case NOTI_EX_ERROR_SERVICE_NOT_READY:           szErrorVal = "NOTI_EX_ERROR_SERVICE_NOT_READY";         break;
-       }
-       return szErrorVal;
-}
-
-void EventinfoReporterEventsErrorCB(noti_ex_reporter_h handle, noti_ex_error_e error, int req_id, void *data)
-{
-       g_CallBackHit = true;
-#if DEBUG
-       FPRINTF("[Line : %d][%s] EventinfoReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE);
-#endif
-}
-
-void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data)
-{
-       g_CallBackHit = true;
-#if DEBUG
-       FPRINTF("[Line : %d][%s] ReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE);
-#endif
-}
-
-/**
-* @function            SendNotification
-* @description         Helper function, sends notification to invoke callback.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int SendNotification()
-{
-       int nReqID;
-       int nRet = NOTI_EX_ERROR_NONE;
-
-       if (g_hEventinfoReporter == NULL) {
-               noti_ex_reporter_events_s hEvent = {0};
-               hEvent.error = EventinfoReporterEventsErrorCB;
-               nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hEvent, NULL);
-               CHECK_HANDLE(g_hEventinfoReporter, "noti_ex_reporter_create");
-               PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet));
-       }
-       nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet));
-
-       noti_ex_item_h hGroupItem = NULL;
-       noti_ex_item_h hButtonItem1 = NULL;
-       noti_ex_item_h hButtonItem2 = NULL;
-
-       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup");
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1");
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2");
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_set_channel(hGroupItem, "test_channel");
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_set_channel", NotificationExGetError(nRet));
-
-       nRet = noti_ex_reporter_post(g_hEventinfoReporter, hGroupItem, &nReqID);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_post", NotificationExGetError(nRet));
-
-       return nRet;
-}
-
-/**
-* @function            CreateNotificationList
-* @description         Helper function, create notification and update list.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int CreateNotificationList(noti_ex_item_h **pszhItemList)
-{
-       int nRet = NOTI_EX_ERROR_NONE;
-
-       if (g_hEventinfoReporter == NULL) {
-               noti_ex_reporter_events_s hReporterEvent = {0};
-               hReporterEvent.error = ReporterEventsErrorCB;
-               nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hReporterEvent, NULL);
-               PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet));
-       }
-       noti_ex_item_h *hItemlist = (noti_ex_item_h*)calloc(2, sizeof(noti_ex_item_h));
-
-       noti_ex_item_h hGroupItem = NULL;
-       noti_ex_item_h hButtonItem1 = NULL;
-       noti_ex_item_h hButtonItem2 = NULL;
-
-       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-
-       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-
-
-       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       hItemlist[0] = hGroupItem;
-
-       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup2");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-
-       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn3", "test3");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-
-
-       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn4", "test4");
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
-       hItemlist[1] = hGroupItem;
-
-       *pszhItemList = hItemlist;
-       return nRet;
-}
-
-/**
-* @function            CreateChatMsgAttributes
-* @description         Helper function, create handles prior creation of chat message handle.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int CreateChatMsgAttributes()
-{
-       g_pszNameID = "name_id";
-       g_pszNameText = "test_name";
-       g_pszTextID = "text_id";
-       g_pszTextText = "test_text";
-       g_pszImageID = "text_id";
-       g_pszImagePath = "test_image_path";
-       g_pszTimeID = "time_id";
-       g_pszChatID = "chat_id";
-       g_eChatMsgType = NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER;
-
-       int nRet = NOTI_EX_ERROR_NONE;
-       nRet = noti_ex_item_text_create(&g_hItemName, g_pszNameID, g_pszNameText, NULL);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet));
-       CHECK_HANDLE(g_hItemName, "noti_ex_item_text_create");
-
-       nRet = noti_ex_item_text_create(&g_hItemText, g_pszTextID, g_pszTextText, NULL);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName));
-       CHECK_HANDLE_CLEANUP(g_hItemText, "noti_ex_item_text_create", noti_ex_item_destroy(g_hItemName));
-
-       nRet = noti_ex_item_image_create(&g_hItemImage, g_pszImageID, g_pszImagePath);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_image_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText));
-       CHECK_HANDLE_CLEANUP(g_hItemImage, "noti_ex_item_image_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText));
-
-       time(&g_tCurrTime);
-
-       nRet = noti_ex_item_time_create(&g_hItemTime, g_pszTimeID, g_tCurrTime);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_time_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage));
-       CHECK_HANDLE_CLEANUP(g_hItemName, "noti_ex_item_time_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage));
-       return nRet;
-}
-
-/**
-* @function            DestroyChatMsgAttributes
-* @description         Helper function, Destroys chat message related handles.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int DestroyChatMsgAttributes()
-{
-       int nRet = NOTI_EX_ERROR_NONE;
-       nRet = noti_ex_item_destroy(g_hItemName);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_destroy(g_hItemText);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_destroy(g_hItemImage);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_destroy(g_hItemTime);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_item_destroy(g_hItemChatMsg);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
-       return nRet;
-}
-
-/**
-* @function            CreateStyleAttributes
-* @description         Helper function, create all required handles for style handle creation.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int CreateStyleAttributes()
-{
-       g_cAlpha = 1;
-       g_cRed = 2;
-       g_cGreen = 3;
-       g_cBlue = 4;
-       g_nLeft = 1;
-       g_nTop = 2;
-       g_nRight = 3;
-       g_nBottom = 4;
-       g_nX = 1;
-       g_nY = 2;
-       g_nW = 3;
-       g_nH = 4;
-       int nRet = NOTI_EX_ERROR_NONE;
-
-       nRet = noti_ex_color_create(&g_hColor, g_cAlpha, g_cRed, g_cGreen, g_cBlue);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_create", NotificationExGetError(nRet));
-       CHECK_HANDLE(g_hColor, "noti_ex_color_create");
-
-       nRet = noti_ex_padding_create(&g_hPadding, g_nLeft, g_nTop, g_nRight, g_nBottom);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor));
-       CHECK_HANDLE_CLEANUP(g_hPadding, "noti_ex_padding_create", noti_ex_color_destroy(g_hColor));
-
-       nRet = noti_ex_geometry_create(&g_hGeometry, g_nX, g_nY, g_nW, g_nH);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding));
-       CHECK_HANDLE_CLEANUP(g_hGeometry, "noti_ex_geometry_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding));
-
-       nRet = noti_ex_style_create(&g_hStyle, g_hColor, g_hPadding, g_hGeometry);
-       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry));
-       CHECK_HANDLE_CLEANUP(g_hStyle, "noti_ex_style_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry));
-
-       return nRet;
-}
-
-/**
-* @function            DestroyStyleAttributes
-* @description         Helper function, destroys style and its related handle created.
-* @parameter           None
-* @return              '0' if pass, Error value in case any API fails.
-*/
-int DestroyStyleAttributes()
-{
-       int nRet = NOTI_EX_ERROR_NONE;
-
-       nRet = noti_ex_style_destroy(g_hStyle);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_color_destroy(g_hColor);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_padding_destroy(g_hPadding);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_destroy", NotificationExGetError(nRet));
-
-       nRet = noti_ex_geometry_destroy(g_hGeometry);
-       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_destroy", NotificationExGetError(nRet));
-
-       return nRet;
-}
-
-/**
-* @function            CreateButton
-* @description         Helper function, to create button ex-item.
-* @parameter           None
-* @return              nRet, API return value.
-*/
-int CreateButton()
-{
-       int nRet = NOTI_EX_ERROR_NONE;
-       g_hItemButton = NULL;
-       g_pszButtonID = "buttonID";
-       g_pszButtonTitle = "buttonTitle";
-
-       nRet = noti_ex_item_button_create(&g_hItemButton, g_pszButtonID, g_pszButtonTitle);
-       return nRet;
-}
-
-/**
-* @function            CreateMultiLangHandle
-* @description         Helper function, to create multilang handle.
-* @parameter           None
-* @return              nRet, API return value.
-*/
-int CreateMultiLangHandle()
-{
-       int nRet = 0;
-       g_hMultiLang = NULL;
-       g_pszMsgID = "TEST_ID";
-       g_pszText = "test string(%s) integer(%d) float(%f)";
-       g_pszArg1 = "test";
-       g_nArg2 = 777;
-       g_fArg3 = 0.77;
-
-       nRet = noti_ex_multi_lang_create(&g_hMultiLang, g_pszMsgID, g_pszText, g_pszArg1, g_nArg2, g_fArg3);
-       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_multi_lang_create", NotificationExGetError(nRet));
-       CHECK_HANDLE(g_hMultiLang, "noti_ex_multi_lang_create");
-
-       return nRet;
-}
-
 /** @} */ //end of itc-notification
index e41e475292f32f3e219e1c9eb4bcf6bcc100dcfa..ea51035ae78a483facde43e4d892ece0c3ac3c24 100755 (executable)
 #define _ITS_NOTIFICATION_COMMON_H_
 
 #include "tct_common.h"
-#include <notification.h>
 #include <app.h>
 
 #include <glib.h>
 #include <glib-object.h>
-#include <notification_ex.h>
 /** @addtogroup itc-notification
 * @ingroup             itc
 * @{
@@ -93,28 +91,11 @@ typedef enum ExEventInfoAPI
 
 eExEventInfoAPI g_eEventInfoAPI;
 
-notification_h g_NotificationHandle;
 bool g_bFeatureSupported;
 
 GMainLoop *g_pNotificationMainLoop;
 bool g_CallBackHit;
 bool g_bAPIFailed;
-
-noti_ex_reporter_h g_hEventinfoReporter;
-noti_ex_manager_h g_hEventinfoManager;
-noti_ex_manager_h g_hExManager;
-noti_ex_item_h g_hItemButton;
-noti_ex_item_h g_hItemChatMsg;
-noti_ex_item_h g_hItemName;
-noti_ex_item_h g_hItemText;
-noti_ex_item_h g_hItemImage;
-noti_ex_item_h g_hItemTime;
-noti_ex_style_h g_hStyle;
-noti_ex_color_h g_hColor;
-noti_ex_padding_h g_hPadding;
-noti_ex_geometry_h g_hGeometry;
-noti_ex_multi_lang_h g_hMultiLang;
-
 time_t g_tCurrTime;
 
 const char *g_pszNameID;
@@ -133,18 +114,14 @@ const char *g_pszArg1;
 
 unsigned char g_cAlpha, g_cRed, g_cGreen, g_cBlue;
 int g_nLeft, g_nTop, g_nRight, g_nBottom, g_nX, g_nY, g_nW, g_nH, g_nArg2;
-noti_ex_item_chat_message_type_e g_eChatMsgType;
 float g_fArg3;
 
 char* NotificationExGetError(int nRet);
 int SendNotification(void);
 gboolean Timeout(gpointer data);
-bool CreateNotification(notification_type_e eNotificationType);
 void FreeAndDeleteNotificationResourceHandle();
 char* NotificationGetError(int nRet);
 char* Application_AppControlGetError(int nRet);
-void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data);
-int CreateNotificationList(noti_ex_item_h **pszhItemList);
 int CreateChatMsgAttributes();
 int DestroyChatMsgAttributes();
 int CreateStyleAttributes();
index 581f053a335bb653c50744bb5d06cc2e48d678dd..ef8f3bd3f5ac2b80da529bc41e54bcf5060138bd 100755 (executable)
 // limitations under the License.
 //
 #include "ITs-notification-common.h"
+#include <notification_ex.h>
+
+noti_ex_reporter_h g_hEventinfoReporter;
+noti_ex_manager_h g_hEventinfoManager;
+noti_ex_manager_h g_hExManager;
+noti_ex_item_h g_hItemButton;
+noti_ex_item_h g_hItemChatMsg;
+noti_ex_item_h g_hItemName;
+noti_ex_item_h g_hItemText;
+noti_ex_item_h g_hItemImage;
+noti_ex_item_h g_hItemTime;
+noti_ex_style_h g_hStyle;
+noti_ex_color_h g_hColor;
+noti_ex_padding_h g_hPadding;
+noti_ex_geometry_h g_hGeometry;
+noti_ex_multi_lang_h g_hMultiLang;
+noti_ex_item_chat_message_type_e g_eChatMsgType;
+void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data);
+int CreateNotificationList(noti_ex_item_h **pszhItemList);
+
+
+void ReporterEventsErrorCB(noti_ex_reporter_h hExReporter, noti_ex_error_e eExError, int nReqID, void *data)
+{
+       g_CallBackHit = true;
+#if DEBUG
+       FPRINTF("[Line : %d][%s] ReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE);
+#endif
+}
+
+void EventinfoReporterEventsErrorCB(noti_ex_reporter_h handle, noti_ex_error_e error, int req_id, void *data)
+{
+               g_CallBackHit = true;
+#if DEBUG
+                       FPRINTF("[Line : %d][%s] EventinfoReporterEventsErrorCB Callback Invoked\\n", __LINE__, API_NAMESPACE);
+#endif
+}
+
+/**
+* @function            NotificationExGetError
+* @description         Maps error enums to string values
+* @parameter           nRet : error code returned
+* @return              error string
+*/
+char* NotificationExGetError(int nRet)
+{
+       char *szErrorVal = "Unknown Error";
+       switch ( nRet )
+       {
+       case NOTI_EX_ERROR_NONE:                        szErrorVal = "NOTI_EX_ERROR_NONE";              break;
+       case NOTI_EX_ERROR_INVALID_PARAMETER:           szErrorVal = "NOTI_EX_ERROR_INVALID_PARAMETER";         break;
+       case NOTI_EX_ERROR_OUT_OF_MEMORY:               szErrorVal = "NOTI_EX_ERROR_OUT_OF_MEMORY";             break;
+       case NOTI_EX_ERROR_IO_ERROR:            szErrorVal = "NOTI_EX_ERROR_IO_ERROR";          break;
+       case NOTI_EX_ERROR_PERMISSION_DENIED:           szErrorVal = "NOTI_EX_ERROR_PERMISSION_DENIED";         break;
+       case NOTI_EX_ERROR_FROM_DB:             szErrorVal = "NOTI_EX_ERROR_FROM_DB";           break;
+       case NOTI_EX_ERROR_ALREADY_EXIST_ID:            szErrorVal = "NOTI_EX_ERROR_ALREADY_EXIST_ID";          break;
+       case NOTI_EX_ERROR_FROM_DBUS:           szErrorVal = "NOTI_EX_ERROR_FROM_DBUS";         break;
+       case NOTI_EX_ERROR_NOT_EXIST_ID:                        szErrorVal = "NOTI_EX_ERROR_NOT_EXIST_ID";              break;
+       case NOTI_EX_ERROR_SERVICE_NOT_READY:           szErrorVal = "NOTI_EX_ERROR_SERVICE_NOT_READY";         break;
+       }
+       return szErrorVal;
+}
+
+/**
+* @function            SendNotification
+* @description         Helper function, sends notification to invoke callback.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int SendNotification()
+{
+       int nReqID;
+       int nRet = NOTI_EX_ERROR_NONE;
+
+       if (g_hEventinfoReporter == NULL) {
+               noti_ex_reporter_events_s hEvent = {0};
+               hEvent.error = EventinfoReporterEventsErrorCB;
+               nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hEvent, NULL);
+               CHECK_HANDLE(g_hEventinfoReporter, "noti_ex_reporter_create");
+               PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet));
+       }
+       nRet = noti_ex_reporter_delete_all(g_hEventinfoReporter, &nReqID);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_delete_all", NotificationExGetError(nRet));
+
+       noti_ex_item_h hGroupItem = NULL;
+       noti_ex_item_h hButtonItem1 = NULL;
+       noti_ex_item_h hButtonItem2 = NULL;
+
+       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup");
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1");
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2");
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_set_channel(hGroupItem, "test_channel");
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_set_channel", NotificationExGetError(nRet));
+
+       nRet = noti_ex_reporter_post(g_hEventinfoReporter, hGroupItem, &nReqID);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_post", NotificationExGetError(nRet));
+
+       return nRet;
+}
+
+/**
+* @function            CreateChatMsgAttributes
+* @description         Helper function, create handles prior creation of chat message handle.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int CreateChatMsgAttributes()
+{
+       g_pszNameID = "name_id";
+       g_pszNameText = "test_name";
+       g_pszTextID = "text_id";
+       g_pszTextText = "test_text";
+       g_pszImageID = "text_id";
+       g_pszImagePath = "test_image_path";
+       g_pszTimeID = "time_id";
+       g_pszChatID = "chat_id";
+       g_eChatMsgType = NOTI_EX_ITEM_CHAT_MESSAGE_TYPE_USER;
+
+       int nRet = NOTI_EX_ERROR_NONE;
+       nRet = noti_ex_item_text_create(&g_hItemName, g_pszNameID, g_pszNameText, NULL);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet));
+       CHECK_HANDLE(g_hItemName, "noti_ex_item_text_create");
+
+       nRet = noti_ex_item_text_create(&g_hItemText, g_pszTextID, g_pszTextText, NULL);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_text_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName));
+       CHECK_HANDLE_CLEANUP(g_hItemText, "noti_ex_item_text_create", noti_ex_item_destroy(g_hItemName));
+
+       nRet = noti_ex_item_image_create(&g_hItemImage, g_pszImageID, g_pszImagePath);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_image_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText));
+       CHECK_HANDLE_CLEANUP(g_hItemImage, "noti_ex_item_image_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText));
+
+       time(&g_tCurrTime);
+
+       nRet = noti_ex_item_time_create(&g_hItemTime, g_pszTimeID, g_tCurrTime);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_time_create", NotificationExGetError(nRet), noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage));
+       CHECK_HANDLE_CLEANUP(g_hItemName, "noti_ex_item_time_create", noti_ex_item_destroy(g_hItemName); noti_ex_item_destroy(g_hItemText); noti_ex_item_destroy(g_hItemImage));
+       return nRet;
+}
+
+/**
+* @function            DestroyChatMsgAttributes
+* @description         Helper function, Destroys chat message related handles.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int DestroyChatMsgAttributes()
+{
+       int nRet = NOTI_EX_ERROR_NONE;
+       nRet = noti_ex_item_destroy(g_hItemName);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_destroy(g_hItemText);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_destroy(g_hItemImage);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_destroy(g_hItemTime);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_item_destroy(g_hItemChatMsg);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_destroy", NotificationExGetError(nRet));
+       return nRet;
+}
+
+/**
+* @function            CreateStyleAttributes
+* @description         Helper function, create all required handles for style handle creation.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int CreateStyleAttributes()
+{
+       g_cAlpha = 1;
+       g_cRed = 2;
+       g_cGreen = 3;
+       g_cBlue = 4;
+       g_nLeft = 1;
+       g_nTop = 2;
+       g_nRight = 3;
+       g_nBottom = 4;
+       g_nX = 1;
+       g_nY = 2;
+       g_nW = 3;
+       g_nH = 4;
+       int nRet = NOTI_EX_ERROR_NONE;
+
+       nRet = noti_ex_color_create(&g_hColor, g_cAlpha, g_cRed, g_cGreen, g_cBlue);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_create", NotificationExGetError(nRet));
+       CHECK_HANDLE(g_hColor, "noti_ex_color_create");
+
+       nRet = noti_ex_padding_create(&g_hPadding, g_nLeft, g_nTop, g_nRight, g_nBottom);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor));
+       CHECK_HANDLE_CLEANUP(g_hPadding, "noti_ex_padding_create", noti_ex_color_destroy(g_hColor));
+
+       nRet = noti_ex_geometry_create(&g_hGeometry, g_nX, g_nY, g_nW, g_nH);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding));
+       CHECK_HANDLE_CLEANUP(g_hGeometry, "noti_ex_geometry_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding));
+
+       nRet = noti_ex_style_create(&g_hStyle, g_hColor, g_hPadding, g_hGeometry);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_create", NotificationExGetError(nRet), noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry));
+       CHECK_HANDLE_CLEANUP(g_hStyle, "noti_ex_style_create", noti_ex_color_destroy(g_hColor); noti_ex_padding_destroy(g_hPadding); noti_ex_geometry_destroy(g_hGeometry));
+
+       return nRet;
+}
+
+/**
+* @function            DestroyStyleAttributes
+* @description         Helper function, destroys style and its related handle created.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int DestroyStyleAttributes()
+{
+       int nRet = NOTI_EX_ERROR_NONE;
+
+       nRet = noti_ex_style_destroy(g_hStyle);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_style_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_color_destroy(g_hColor);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_color_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_padding_destroy(g_hPadding);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_padding_destroy", NotificationExGetError(nRet));
+
+       nRet = noti_ex_geometry_destroy(g_hGeometry);
+       PRINT_RESULT_NORETURN(NOTI_EX_ERROR_NONE, nRet, "noti_ex_geometry_destroy", NotificationExGetError(nRet));
+
+       return nRet;
+}
+
+/**
+* @function            CreateButton
+* @description         Helper function, to create button ex-item.
+* @parameter           None
+* @return              nRet, API return value.
+*/
+int CreateButton()
+{
+       int nRet = NOTI_EX_ERROR_NONE;
+       g_hItemButton = NULL;
+       g_pszButtonID = "buttonID";
+       g_pszButtonTitle = "buttonTitle";
+
+       nRet = noti_ex_item_button_create(&g_hItemButton, g_pszButtonID, g_pszButtonTitle);
+       return nRet;
+}
+
+/**
+* @function            CreateMultiLangHandle
+* @description         Helper function, to create multilang handle.
+* @parameter           None
+* @return              nRet, API return value.
+*/
+int CreateMultiLangHandle()
+{
+       int nRet = 0;
+       g_hMultiLang = NULL;
+       g_pszMsgID = "TEST_ID";
+       g_pszText = "test string(%s) integer(%d) float(%f)";
+       g_pszArg1 = "test";
+       g_nArg2 = 777;
+       g_fArg3 = 0.77;
 
+       nRet = noti_ex_multi_lang_create(&g_hMultiLang, g_pszMsgID, g_pszText, g_pszArg1, g_nArg2, g_fArg3);
+       PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_multi_lang_create", NotificationExGetError(nRet));
+       CHECK_HANDLE(g_hMultiLang, "noti_ex_multi_lang_create");
+
+       return nRet;
+}
+/**
+* @function            CreateNotificationList
+* @description         Helper function, create notification and update list.
+* @parameter           None
+* @return              '0' if pass, Error value in case any API fails.
+*/
+int CreateNotificationList(noti_ex_item_h **pszhItemList)
+{
+       int nRet = NOTI_EX_ERROR_NONE;
+
+       if (g_hEventinfoReporter == NULL) {
+               noti_ex_reporter_events_s hReporterEvent = {0};
+               hReporterEvent.error = ReporterEventsErrorCB;
+               nRet = noti_ex_reporter_create(&g_hEventinfoReporter, hReporterEvent, NULL);
+               PRINT_RESULT(NOTI_EX_ERROR_NONE, nRet, "noti_ex_reporter_create", NotificationExGetError(nRet));
+       }
+       noti_ex_item_h *hItemlist = (noti_ex_item_h*)calloc(2, sizeof(noti_ex_item_h));
+
+       noti_ex_item_h hGroupItem = NULL;
+       noti_ex_item_h hButtonItem1 = NULL;
+       noti_ex_item_h hButtonItem2 = NULL;
+
+       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+
+       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn1", "test1");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+
+
+       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn2", "test2");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       hItemlist[0] = hGroupItem;
+
+       nRet = noti_ex_item_group_create(&hGroupItem, "testgroup2");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+
+       nRet = noti_ex_item_button_create(&hButtonItem1, "testbtn3", "test3");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem1);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+
+
+       nRet = noti_ex_item_button_create(&hButtonItem2, "testbtn4", "test4");
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_button_create", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       nRet = noti_ex_item_group_add_child(hGroupItem, hButtonItem2);
+       PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_item_group_add_child", NotificationExGetError(nRet), FREE_MEMORY(hItemlist));
+       hItemlist[1] = hGroupItem;
+
+       *pszhItemList = hItemlist;
+       return nRet;
+}
 /** @addtogroup itc-notification_ex
 * @ingroup             itc
 * @{
@@ -403,12 +736,6 @@ int ITc_noti_ex_action_app_control_create_p(void)
        nRet = app_control_set_app_id(hAppControl, pszSetAppID);
        PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl));
 
-       if ( false == CreateNotification(NOTIFICATION_TYPE_NOTI) )
-       {
-               app_control_destroy(hAppControl);
-               return 1;
-       }
-
        //Target API
        nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL);
        PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl));
@@ -458,12 +785,6 @@ int ITc_noti_ex_action_app_control_set_get_p(void)
        nRet = app_control_set_app_id(hAppControl, pszSetAppID);
        PRINT_RESULT_CLEANUP(APP_CONTROL_ERROR_NONE, nRet, "app_control_set_app_id", Application_AppControlGetError(nRet), app_control_destroy(hAppControl));
 
-       if ( false == CreateNotification(NOTIFICATION_TYPE_NOTI) )
-       {
-               app_control_destroy(hAppControl);
-               return 1;
-       }
-
        nRet = noti_ex_action_app_control_create(&hAction, hAppControl, NULL);
        PRINT_RESULT_CLEANUP(NOTI_EX_ERROR_NONE, nRet, "noti_ex_action_app_control_create", NotificationExGetError(nRet), app_control_destroy(hAppControl));
        CHECK_HANDLE_CLEANUP(hAction, "noti_ex_action_app_control_creat", app_control_destroy(hAppControl));
index af9fe7fde788bad4afab23b405db03ae9b9abbd9..4e58acda4b85a8eea7913bbb9b2f89a0b0dfc4b5 100755 (executable)
 // limitations under the License.
 //
 #include "ITs-notification-common.h"
+#include <notification.h>
+
+bool CreateNotification(notification_type_e eNotificationType);
+
+notification_h g_NotificationHandle;
+/**
+* @function            FreeAndDeleteNotificationResourceHandle
+* @description         Free internal data structure and notification handle.
+* @parameter
+* @return                      NA
+*/
+void FreeAndDeleteNotificationResourceHandle()
+{
+       DELETE_NOTIFICATION(g_NotificationHandle);
+       FREE_NOTIFICATION(g_NotificationHandle);
+       g_NotificationHandle = NULL;
+}
+
+/**
+* @function            NotificationGetError
+* @description         Maps error enums to string values
+* @parameter           nRet : error code returned
+* @return                      error string
+*/
+char* NotificationGetError(int nRet)
+{
+       char *szErrorVal = NULL;
+       switch ( nRet )
+       {
+       case NOTIFICATION_ERROR_NONE:                                   szErrorVal = "NOTIFICATION_ERROR_NONE";                                         break;
+       case NOTIFICATION_ERROR_INVALID_PARAMETER:              szErrorVal = "NOTIFICATION_ERROR_INVALID_PARAMETER";            break;
+       case NOTIFICATION_ERROR_OUT_OF_MEMORY:                  szErrorVal = "NOTIFICATION_ERROR_OUT_OF_MEMORY";                        break;
+       case NOTIFICATION_ERROR_FROM_DB:                                szErrorVal = "NOTIFICATION_ERROR_FROM_DB";                                      break;
+       case NOTIFICATION_ERROR_ALREADY_EXIST_ID:               szErrorVal = "NOTIFICATION_ERROR_ALREADY_EXIST_ID";                     break;
+       case NOTIFICATION_ERROR_FROM_DBUS:                              szErrorVal = "NOTIFICATION_ERROR_FROM_DBUS";                            break;
+       case NOTIFICATION_ERROR_NOT_EXIST_ID:                   szErrorVal = "NOTIFICATION_ERROR_NOT_EXIST_ID";                         break;
+       case NOTIFICATION_ERROR_IO_ERROR:                               szErrorVal = "NOTIFICATION_ERROR_IO_ERROR";                                     break;
+       case NOTIFICATION_ERROR_SERVICE_NOT_READY:              szErrorVal = "NOTIFICATION_ERROR_SERVICE_NOT_READY";            break;
+       case NOTIFICATION_ERROR_PERMISSION_DENIED:              szErrorVal = "NOTIFICATION_ERROR_PERMISSION_DENIED";            break;
+       default:                                                                                szErrorVal = "Unknown Error";                                                           break;
+       }
+
+       return szErrorVal;
+}
+
+/**
+* @function            CreateNotification
+* @description         Creates internal structure data and returns a notification handle.
+* @parameter       NotificationType
+* @return                      NA
+*/
+bool CreateNotification(notification_type_e eNotificationType)
+{
+       int nRet = 0;
+       FreeAndDeleteNotificationResourceHandle();
+       g_NotificationHandle = notification_create(eNotificationType);
+       CHECK_HANDLE(g_NotificationHandle, "notification_create");
+
+       nRet = notification_post(g_NotificationHandle);
+       if ( nRet != NOTIFICATION_ERROR_NONE )
+       {
+               FPRINTF("[Line : %d][%s] notification_post failed, error returned = %s\\n", __LINE__, API_NAMESPACE, NotificationGetError(nRet));
+               return false;
+       }
+
+       return true;
+}
 
 /** @addtogroup itc-notification
 * @ingroup             itc
@@ -675,7 +742,7 @@ int ITc_notification_set_get_sound_p(void)
                eRetNotiErr  = notification_set_sound(g_NotificationHandle, noti_type[enum_counter], (char*)DEFAULT_FILE_PATH);
                PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_set_sound", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle(););
 
-               notification_sound_type_e eSoundType = NOTIFICATION_SOUND_TYPE_DEFAULT;
+               notification_sound_type_e eSoundType = -1;
                const char *pszGetSoundPath = NULL;
 
                eRetNotiErr  = notification_get_sound(g_NotificationHandle, &eSoundType, &pszGetSoundPath);
@@ -731,7 +798,7 @@ int ITc_notification_set_get_vibration_p(void)
                PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_set_vibration", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle(););
 
                const char *pszGetVibrationPath = NULL;
-               notification_vibration_type_e eVibrationType = NOTIFICATION_VIBRATION_TYPE_DEFAULT;
+               notification_vibration_type_e eVibrationType = -1;
                eRetNotiErr  = notification_get_vibration(g_NotificationHandle, &eVibrationType, &pszGetVibrationPath);
                PRINT_RESULT_CLEANUP(NOTIFICATION_ERROR_NONE, eRetNotiErr, "notification_get_vibration", NotificationGetError(eRetNotiErr), FreeAndDeleteNotificationResourceHandle(););