Update change log and spec for wrt-plugins-tizen_0.4.58
[platform/framework/web/wrt-plugins-tizen.git] / src / Notification / StatusNotification.cpp
1 //
2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17
18 #include <PlatformException.h>
19 #include <Logger.h>
20 #include <sstream>
21 #include <appsvc/appsvc.h>
22 #include <sstream>
23
24 #include <boost/algorithm/string.hpp>
25 #include "StatusNotification.h"
26
27 namespace DeviceAPI {
28 namespace Notification {
29
30 #define DEFAULT_ICON_PATH "/opt/share/icons/default/"
31 #define MAX_NOTIFICATION_DETAIL_INFO_LENGTH 2
32 #define MAX_THUMBNAIL_LENGTH 4
33
34 extern "C" int service_create_event(bundle *data, struct service_s **service);
35 //tern "C" int service_to_bundle(service_h service, bundle **data);
36
37 //callback functions.
38 static bool service_extra_data_cb(service_h service, const char *key, void *user_data)
39 {
40         LoggerI("OK");
41         char **value = NULL;
42         int length = 0;
43
44         if (user_data != NULL && key != NULL)
45         {       
46                 LoggerI("user data & key is existed");
47
48                 DeviceAPI::Application::ApplicationControlPtr* appControl = 
49                         (DeviceAPI::Application::ApplicationControlPtr*)(user_data);
50
51                 DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData());
52                 LoggerI("key = " << key);
53                 std::string keyStr = key;
54                 std::vector<std::string> keyValue;
55                 int index = 0;
56
57                 if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE)
58                 {
59                         LoggerI("extra_data_array length = " << length);
60                         
61                         if (value != NULL && length != 0)
62                         {
63                                 LoggerI("extra_data_length = " << length);
64                                 data->setKey(key);
65                                 for (index = 0; index < length; index++)
66                                 {
67                                         LoggerI("Value=" << value[index]);
68                                         keyValue.push_back(value[index]);
69                                 }
70                                 
71                                 data->setValue(keyValue);
72                                 (*appControl)->addAppControlData(data);
73                         }
74                         
75                         if(value)
76                                 free(value);
77                 }
78         }
79         return true;
80 }
81
82 StatusNotification::StatusNotification(NotificationType statusType) :
83         m_notiType(NOTI_TYPE_NONE),
84         m_service(NULL),
85         m_notiHandle(NULL),
86         m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
87         m_notiUpdated(false),
88         m_launchFlag(false)
89 {
90         LoggerI("statusType =" << statusType);
91
92         notification_type_e type = NOTIFICATION_TYPE_NONE;
93         setNotiType(statusType);
94
95         if (statusType == NOTI_TYPE_SIMPLE || statusType == NOTI_TYPE_MUTIPLE || statusType == NOTI_TYPE_THUMBNAIL)
96         {
97                 type = NOTIFICATION_TYPE_NOTI;
98         }
99         else if ( statusType == NOTI_TYPE_ONGOING || statusType == NOTI_TYPE_PROGRESS)
100         {
101                 type = NOTIFICATION_TYPE_ONGOING;
102         }
103         else
104         {
105                 LoggerI(" invalide noti type");
106                 throw TypeMismatchException("value is not notification type");
107         }
108
109         //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE);       //default
110
111         LoggerI("Notification Type : " << type);
112
113         notification_h noti = notification_create(type);        //create notificatin.
114         if ( noti )
115         {
116                 LoggerI("noti =" << noti);
117                 setNotificationHandle((void*)noti);
118
119                 if (NOTIFICATION_TYPE_ONGOING ==  type)
120                 {       //ongoing no ticker.
121                         LoggerI("ongoing type");
122                         if ( NOTIFICATION_ERROR_NONE != notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |NOTIFICATION_DISPLAY_APP_INDICATOR ))
123                         {
124                                 throw UnknownException("can't set notification display applist");
125                         }
126                 }
127                 
128         }
129         else
130         {
131                 throw UnknownException("can't make new notification object");
132         }
133         
134         //m_detailInfos = new std::vector<NotificationDetailInfo*>();   
135         //m_thumbs = new std::vector<std::string>();
136         
137 }
138
139 StatusNotification::StatusNotification(void* noti) :
140         m_notiType(NOTI_TYPE_NONE),
141         m_service(NULL),
142         m_notiHandle(NULL),
143         m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
144         m_notiUpdated(false),
145         m_launchFlag(false)
146 {
147         LoggerI("noti : " << noti);
148         
149         notification_h notification = (notification_h)noti;
150
151         if ( notification )
152         {
153                 NotificationType type = NOTI_TYPE_NONE;
154                 notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
155                 notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
156
157                 notification_get_type(notification, &noti_type);
158                 notification_get_layout(notification, &noti_layout);
159
160                 //get type.
161                 if ( noti_type == NOTIFICATION_TYPE_NOTI )
162                 {
163                         if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE || 
164                                 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
165                         {
166                                 type = NOTI_TYPE_SIMPLE;
167                         }
168                         else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
169                         {
170                                 type = NOTI_TYPE_THUMBNAIL;
171                         }
172                 }
173                 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
174                 {
175                         if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
176                         {
177                                 type = NOTI_TYPE_ONGOING;
178                         }
179                         else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
180                         {
181                                 type = NOTI_TYPE_PROGRESS;
182                         }
183                 }
184
185                 LoggerI(" notification type  =" << type);
186                 setNotiType(type);
187                 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default.
188                 //read Progress type value.
189                 char *strProgressType = NULL;
190                 if (NOTIFICATION_ERROR_NONE == notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_LIST_5,  &strProgressType))
191                 {
192                         if ( strProgressType )
193                         {
194                                 std::string notiProgressType(strProgressType);
195                                 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
196                                         m_progressType = NOTI_PROGRESS_TYPE_SIZE;
197                         }
198                 }
199                 
200                 setNotificationHandle((void*)notification);
201                 loadThumbnails();
202                 loadDetailInfos();
203
204 #if 0
205                  if ( type  == NOTI_TYPE_PROGRESS)
206                 {
207                         notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
208                 }
209 #endif
210                 //service
211                 bundle *bSvc = NULL;
212
213                 int ret =  notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc);
214                 LoggerI("ret = " << ret); 
215                 if (ret == NOTIFICATION_ERROR_NONE)
216                 {
217                         LoggerI(" bundle = " << bSvc);
218                         if (bSvc)
219                         {
220                                 LoggerI("bundle is valid");     
221                                 int ret = service_create_event(bSvc, &m_service);
222                                 if (ret != SERVICE_ERROR_NONE)
223                                 {
224                                         LoggerI("Service Create Event Error");
225                                         throw UnknownException("can't make service object");
226                                 }
227                         }
228                 }
229                 else
230                 {
231                         notification_free(notification);
232                         throw UnknownException("can't get service data");
233                 }
234                 
235         }
236         else
237         {
238                 throw InvalidValuesException("It is not notification object.");
239         }
240         
241 }
242
243 StatusNotification::StatusNotification(int privID) :
244         m_notiType(NOTI_TYPE_NONE),
245         m_service(NULL),
246         m_notiHandle(NULL),
247         m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
248         m_notiUpdated(false),
249         m_launchFlag(false)
250 {
251         LoggerI("priv ID : " << privID);
252
253         notification_h notification = notification_load( NULL, privID); //load notification.
254         LoggerI(" notification " << notification);
255
256         if ( notification )
257         {
258                 NotificationType type = NOTI_TYPE_NONE; 
259                 notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
260                 notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
261                 
262                 notification_get_type(notification, &noti_type);
263                 notification_get_layout(notification, &noti_layout);
264                 
265                 if ( noti_type == NOTIFICATION_TYPE_NOTI )
266                 {
267                         if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE || 
268                                 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
269                         {
270                                 type = NOTI_TYPE_SIMPLE;
271                         }
272                         else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
273                         {
274                                 type = NOTI_TYPE_THUMBNAIL;
275                         }
276                 }
277                 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
278                 {
279                         if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
280                         {
281                                 type = NOTI_TYPE_ONGOING;
282                         }
283                         else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
284                         {
285                                 type = NOTI_TYPE_PROGRESS;
286                         }
287                 }
288
289                 LoggerI(" notification type  =" << type);
290                 setNotiType(type);
291                 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default.
292                 //read Progress type value.
293                 char *strProgressType = NULL;
294                 if (NOTIFICATION_ERROR_NONE == notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_LIST_5,  &strProgressType))
295                 {
296                         if ( strProgressType )
297                         {
298                                 std::string notiProgressType(strProgressType);
299                                 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
300                                         m_progressType = NOTI_PROGRESS_TYPE_SIZE;
301                         }
302                 }
303                 
304                 setNotificationHandle((void*)notification);
305                 loadThumbnails();
306                 loadDetailInfos();
307 #if 0
308                  if ( type  == NOTI_TYPE_PROGRESS)
309                 {
310                         notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
311                 }
312 #endif
313                 //service
314                 bundle *bSvc = NULL;
315
316                 int ret =  notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc);
317                 LoggerI("ret = " << ret); 
318                 if (ret == NOTIFICATION_ERROR_NONE)
319                 {
320                         LoggerI(" bundle = " << bSvc);
321                         if (bSvc)
322                         {
323                                 LoggerI("bundle is valid");     
324                                 int ret = service_create_event(bSvc, &m_service);
325                                 if (ret != SERVICE_ERROR_NONE)
326                                 {
327                                         LoggerI("Service Create Event Error");
328                                         throw UnknownException("can't make service object");
329                                 }
330                         }
331                 }
332                 else
333                 {
334                         notification_free(notification);
335                         throw UnknownException("can't get service data");
336                 }
337                 
338         }
339         else
340         {
341                 throw NotFoundException("It is not notification ID or removed notification");
342         }
343         
344 }
345
346 StatusNotification::~StatusNotification() 
347 {
348         LoggerI(" notification = " << m_notiHandle);
349
350         //clear thumbnail.
351         //clearDetailInfos();
352         
353         if (m_notiHandle)
354         {
355                 LoggerI(" service = " << m_service);
356                 if (m_service != NULL)
357                 {
358                         service_destroy(m_service);
359                         m_service = NULL;
360                 }
361
362                 if (notification_free(m_notiHandle) != NOTIFICATION_ERROR_NONE)
363                 {
364                         throw UnknownException("notification free failed...");
365                 }
366                 
367                 m_notiHandle = NULL;
368         }
369 }
370
371 int StatusNotification::getID()
372 {
373         int id = -1;    // notification not inserted yet.
374         if (m_notiHandle)
375         {
376                 notification_get_id(m_notiHandle, NULL, &id);
377         }
378
379         return id;
380 }
381
382 std::string StatusNotification::getStatusType()
383 {
384         std::string type;
385         
386         if ( NOTI_TYPE_SIMPLE ==  getNotiType())
387         {
388                 type = "SIMPLE";
389         }
390         else if ( NOTI_TYPE_ONGOING ==  getNotiType())
391         {
392                 type = "ONGOING";
393         }
394         else if ( NOTI_TYPE_PROGRESS ==  getNotiType())
395         {
396                 type = "PROGRESS"; 
397         }
398         else if ( NOTI_TYPE_THUMBNAIL ==  getNotiType())
399         {
400                 type = "THUMBNAIL"; 
401         }
402
403         return type;
404                 
405 }
406
407
408
409 void StatusNotification::setStatusType(std::string type)
410 {
411         LoggerI("type = " << type);
412         
413         NotificationType notiType = NOTI_TYPE_NONE; 
414         
415         if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_SIMPLE) == 0)
416                 notiType = NOTI_TYPE_SIMPLE;
417         else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_THUMBNAIL) == 0)
418                 notiType = NOTI_TYPE_THUMBNAIL;
419         else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_ONGOING) == 0)
420                 notiType = NOTI_TYPE_ONGOING;    
421         else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_PROGRESS) == 0)
422                 notiType = NOTI_TYPE_PROGRESS;
423         else
424         throw InvalidValuesException("Invalid Status Type.");
425
426         LoggerI("Notification type = " << notiType);
427         setNotiType(notiType);
428 }
429
430 time_t StatusNotification::getPostedTime()
431 {
432         LoggerI("get m_notiHandle = " << m_notiHandle);
433         
434         time_t postedTime = 0;
435         
436         if (m_notiHandle)
437         {                       
438                 if (notification_get_insert_time(m_notiHandle, &postedTime) != NOTIFICATION_ERROR_NONE)
439                 {
440                         throw UnknownException("get notification posted time error");
441                 }
442         }
443         
444         LoggerI("posted Time =" << ctime(&postedTime));
445         return postedTime;
446 }
447
448 std::string StatusNotification::getTitle()
449 {
450         if (m_notiHandle)
451         {
452                 char *title = NULL;
453         
454                 if (notification_get_text(m_notiHandle,NOTIFICATION_TEXT_TYPE_TITLE, &title) != NOTIFICATION_ERROR_NONE)
455                 {
456                         throw UnknownException("get notification title error");
457                 }
458
459                 std::string notiTitle;
460                 if (title)
461                 {               
462                         notiTitle = title;
463                         LoggerI(" get title : " << title);
464                 }
465
466                 return notiTitle;       
467         }
468         else
469         {
470                 throw UnknownException("notification handle is null");
471         }
472 }
473
474 void StatusNotification::setTitle(std::string title)
475 {
476         LoggerI("Title : " << title);
477         if (m_notiHandle)
478         {
479                 LoggerI("get Title : " << getTitle());
480                 if((getTitle()).compare(title)) //different value.
481                 {
482                         if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, title.c_str(), 
483                                 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
484                         {
485                                 throw UnknownException("set notification title error");
486                         }
487                         
488                         setUpdatedFlag(true);
489                 }
490                 else
491                 {
492                         LoggerI(" title = " << title << " getTitle = " << getTitle());
493                 }
494         }
495         else
496         {       
497                 LoggerD("noti Handle is NULL");
498                 throw UnknownException("notification handle is null");
499         }
500 }
501
502 std::string StatusNotification::getContent()
503 {
504         LoggerI("get Content handle: " << m_notiHandle);
505         if (m_notiHandle)
506         {
507                 char *content = NULL;
508
509                 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
510                 {
511                         throw UnknownException("get notification Content error");
512                 }
513                 
514                 std::string notiContent;
515                 
516                 if(content)
517                 {
518                         notiContent = content;
519                         LoggerI(" get Content : " << content);
520                 }
521
522                 return notiContent;
523                 
524         }
525         else
526         {
527                 throw UnknownException("notification handle is null");
528         }
529         
530 }
531
532 char* StatusNotification::getStrContent()
533 {
534         LoggerI("get Content handle: " << m_notiHandle);
535         if (m_notiHandle)
536         {
537                 char *content = NULL;
538
539                 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
540                 {
541                         throw UnknownException("get notification Content error");
542                 }
543                 
544                 return content;
545         }
546         else
547         {
548                 throw UnknownException("notification handle is null");
549         }
550 }
551
552 void StatusNotification::setContent(std::string content)
553 {
554         LoggerI("Content : " << content);
555         if (m_notiHandle)
556         {
557                 if((getContent()).compare(content))     //different value.
558                 {
559                         if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, content.c_str(),
560                                 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
561                         {
562                                 throw UnknownException("set notification content error");
563                         }
564                         setUpdatedFlag(true);
565                 }
566         }
567         else
568         {       
569                 LoggerD("noti Handle is NULL");
570                 throw UnknownException("notification handle is null");
571         }
572 }
573
574 std::string StatusNotification::getIconPath()
575 {
576
577         LoggerI("m_notiHandle = " << m_notiHandle);
578         if (m_notiHandle)
579         {
580                 char *iconPath = NULL;
581                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON,  &iconPath) != NOTIFICATION_ERROR_NONE)
582                 {
583                         throw UnknownException("get notification icon path error");
584                 }
585
586                 std::string notiIconPath;
587                 if (iconPath)
588                 {
589                         notiIconPath = iconPath;
590                         LoggerI("icon Path = " << iconPath);
591                 }
592                 
593                 //if icon path invalid, return empty string.
594                 if ( notiIconPath.find(DEFAULT_ICON_PATH,0) == std::string::npos)
595                         return notiIconPath;    
596                 else
597                 {
598                         return std::string(""); //return empty string.
599                 }
600         }
601         else
602         {
603                 throw UnknownException("notification handle is null");
604         }
605 }
606
607 void StatusNotification::setIconPath(const std::string& iconPath)
608 {
609         if (m_notiHandle)
610         {
611                 LoggerI("icon path = " << iconPath << " origin icon path = " << getIconPath());
612                 if( getIconPath().compare(iconPath))
613                 {
614                         if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON, iconPath.c_str()) != NOTIFICATION_ERROR_NONE)
615                         {
616                                 throw UnknownException("set notification icon error");
617                         }
618                         setUpdatedFlag(true);
619                 }
620         }
621         else
622         {
623                 LoggerD("noti Handle is NULL");
624                 throw UnknownException("notification handle is null");
625         }
626 }
627
628 std::string StatusNotification::getSoundPath()
629 {
630         LoggerI("Handle = " << m_notiHandle);
631
632         if (m_notiHandle)
633         {
634                 const char *soundPath = NULL;
635                 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
636                 
637                 if (notification_get_sound(m_notiHandle, &type,  &soundPath) != NOTIFICATION_ERROR_NONE)
638                 {
639                         throw UnknownException("get notification sound error");
640                 }
641                 
642                 std::string strSoundPath;
643                 if (soundPath)
644                 {
645                         LoggerI(" soudn type=" << type);
646                         if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA)
647                         {
648                                 LoggerI("soundPath = " << soundPath);
649                                 strSoundPath = soundPath;
650                         }
651                 }
652                 
653                 LoggerI("soundPath :" << strSoundPath);
654                 return strSoundPath;
655
656         }
657         else
658         {
659                 LoggerD("noti Handle is NULL");
660                 throw UnknownException("notification handle is null");
661         }
662 }
663
664 void StatusNotification::setSoundPath(const std::string& sound)
665 {
666         if (m_notiHandle)
667         {
668                 LoggerI("sound path = " << sound << " origin sound path = " << getSoundPath());
669                 
670                 if( getSoundPath().compare(sound))
671                 {
672                         if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_USER_DATA, sound.c_str()) != NOTIFICATION_ERROR_NONE)
673                         {
674                                 throw UnknownException("set notification sound error");
675                         }
676                         setUpdatedFlag(true);
677                 }
678
679                 if (sound.empty()) 
680                 {
681                     LoggerI("sound path is NULL");
682                     if ( NOTI_TYPE_ONGOING == getNotiType() || NOTI_TYPE_PROGRESS == getNotiType())
683                     {
684                                 LoggerI("Ongoing Type" );
685                                 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_NONE, NULL) != NOTIFICATION_ERROR_NONE)
686                                 {
687                                         throw UnknownException("set notification sound error");
688                                 }
689                     }
690                     else
691                     {
692                                 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_DEFAULT, sound.c_str()) != NOTIFICATION_ERROR_NONE)
693                                 {
694                                         throw UnknownException("set notification sound error");
695                                 }
696                     }           
697                     
698                 }
699         }
700         else
701         {       
702                 LoggerD("noti Handle is NULL");
703                 throw UnknownException("notification handle is null");
704         }
705 }
706
707 bool StatusNotification::getDefaultVibration()
708 {
709         LoggerI("getDefaultVibration");
710         if (m_notiHandle)
711         {
712                 notification_vibration_type_e vib_type;
713                 if (notification_get_vibration(m_notiHandle, &vib_type,  NULL) != NOTIFICATION_ERROR_NONE)
714                 {
715                         throw UnknownException("set notification sound error");
716                 }
717
718                 if (NOTIFICATION_VIBRATION_TYPE_DEFAULT == vib_type  || NOTIFICATION_VIBRATION_TYPE_USER_DATA == vib_type)
719                 {
720                         return true;
721                 }
722                 else
723                 {
724                         return false;
725                 }
726         }
727         else
728         {
729                 LoggerD("noti Handle is NULL");
730                 throw UnknownException("notification handle is null");
731         }
732
733         return false;
734 }
735
736 void StatusNotification::setDefaultVibration(const bool& vibration) 
737 {
738     LoggerI("vibration = " << vibration);
739         if (m_notiHandle)
740         {
741                 notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
742                 LoggerI("old vibration = " << getDefaultVibration());
743                 if (getDefaultVibration() != vibration)
744                 {
745                         if (vibration)
746                         {
747                                 vib_type = NOTIFICATION_VIBRATION_TYPE_DEFAULT;
748                         }
749                         else
750                         {
751                                 vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
752                         }
753                         LoggerI("type vibration type= " << vib_type);
754
755                         if (notification_set_vibration(m_notiHandle, vib_type , NULL) != NOTIFICATION_ERROR_NONE)
756                         {
757                                 throw UnknownException("set notification sound error");
758                         }
759                         setUpdatedFlag(true);
760                 }
761         }
762         else
763         {
764                 LoggerD("noti Handle is NULL");
765                 throw UnknownException("notification handle is null");
766         }
767
768 }
769
770 DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplicationControl()
771 {
772
773     service_h service = NULL;
774     char *tempStr = NULL;
775
776     DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
777
778     try {
779                 if (m_service)
780                 {
781                         appControl->setService_h(m_service);
782                         // mandatory
783                         if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE)
784                         {
785                                 LoggerD("Operation Str = " << tempStr);
786                                 if (tempStr) 
787                                 {
788                                         appControl->setOperation(tempStr);
789                                         free(tempStr);
790                                         tempStr = NULL;
791                                 }
792                         }
793
794                         // optional
795                         if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE)
796                         {
797                                 LoggerD("Mime Str = " << tempStr);
798                                 if (tempStr) 
799                                 {
800                                         appControl->setMime(tempStr);
801                                         free(tempStr);
802                                         tempStr = NULL;
803                                 }
804                         }
805
806                         // optional
807                         if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE)
808                         {
809                                 LoggerD("Uri Str = " << tempStr);
810                                 if (tempStr)
811                                 {
812                                         appControl->setUri(tempStr);
813                                         free(tempStr);
814                                         tempStr = NULL;
815                                 }
816                         }
817
818                         if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE)
819                         {
820                                 LoggerD("Category Str = " << tempStr);
821                                 if (tempStr)
822                                 {
823                                         appControl->setCategory(tempStr);
824                                         free(tempStr);
825                                         tempStr = NULL;
826                                 }
827                         }
828                         
829                         // optional
830                         if ( service_foreach_extra_data(m_service, service_extra_data_cb,(void*)&appControl) != SERVICE_ERROR_NONE)
831                         {
832                                 ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get notification service uri error");
833                         }
834
835                         return appControl;
836                 }
837
838         }
839         Catch (WrtDeviceApis::Commons::Exception) 
840         {
841                 if (tempStr) 
842                 {
843                         free(tempStr);
844                         tempStr = NULL;
845                 }
846
847                 if (service)
848                 {
849                         free(service);
850                         service = NULL;
851                 }
852
853                 LoggerW(_rethrown_exception.GetMessage());
854         }
855         
856     return appControl;
857 }
858
859 void StatusNotification::setApplicationControl(DeviceAPI::Application::ApplicationControlPtr control)
860 {
861         LoggerI("Entered m_service : " << m_service << " control : " << control);
862
863         //delete old service.
864         if (m_service)
865         {
866                 service_destroy(m_service);
867                 m_service = NULL;
868         }
869         
870         if(service_create(&m_service) != SERVICE_ERROR_NONE)
871         {
872                 throw UnknownException("service creation error");
873         }
874         else
875         {
876                 LoggerI("getOperation : " << control->getOperation().c_str());
877                 if (control->getOperation().size() != 0)
878                 {
879                         m_launchFlag = true;            //default attribute
880                         if (service_set_operation(m_service, control->getOperation().c_str()) != SERVICE_ERROR_NONE)
881                         {
882                                 throw UnknownException("service set operation error");
883                         }
884                 }
885                         
886                 // optional
887                 LoggerI("getUri : " << control->getUri().c_str());
888                 if (control->getUri().size() != 0)
889                 {
890                         if (service_set_uri(m_service, control->getUri().c_str() ) != SERVICE_ERROR_NONE)
891                         {
892                                 throw UnknownException("service set uri error");
893                         }
894                 }
895         
896                 // optional
897                 LoggerI("getMime : " << control->getMime().c_str());
898                 if (control->getMime().size() != 0)
899                 {
900                         if (service_set_mime(m_service, control->getMime().c_str() ) != SERVICE_ERROR_NONE)
901                         {
902                                 throw UnknownException("service set mime error");
903                         }
904                 }
905         
906                 LoggerI("Category : " << control->getCategory().c_str());
907                 if (control->getCategory().size() != 0)
908                 {
909                         if (service_set_category(m_service, control->getCategory().c_str() ) != SERVICE_ERROR_NONE)
910                         {
911                                 throw UnknownException("service set mime error");
912                         }
913                 }
914 #if 0
915                 //remove key
916                 if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE)
917                 {
918                         throw UnknownException("get notification service uri error");
919                 }
920 #endif          
921                 std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = control->getAppControlDataArray();
922                 size_t index = 0;
923         
924                 LoggerI (" App Control Datas Count : " << appControlDataArray.size());
925         
926                 DeviceAPI::Application::ApplicationControlDataArray::iterator iter;
927         
928                 for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++)
929                 {
930                         DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter;
931                         std::string key = appControlData->getKey();
932                         LoggerI(" key : " << key);
933                 
934                         if (key.empty())
935                                 continue;
936                 
937                         std::vector<std::string> value = appControlDataArray[index]->getValue();
938                         const char **arrayValue = (const char**)calloc(sizeof(char*), value.size());
939         
940                         for (size_t indexArray = 0; indexArray < value.size(); indexArray++)
941                         {
942                                 arrayValue[indexArray] = (char*)value[indexArray].c_str();
943                                 LoggerI( " value : " << arrayValue[indexArray]);
944                         }
945         
946                         const char* strKey = key.c_str();
947                         LoggerI( " value size: " << value.size());
948                         if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
949                         {
950                                 throw UnknownException("service set extra data error");                 
951                         }
952                          
953                         if (arrayValue)
954                                 free(arrayValue);
955                 }                                       
956
957 #if 0
958                 bundle *bundle_data=NULL;
959                 
960                 if(service_to_bundle(m_service, &bundle_data) != SERVICE_ERROR_NONE)
961                 {
962                         throw UnknownException("service get bundle");                   
963                 }
964
965                 LoggerD("bundle_data : " << bundle_data);
966                 
967                 if (bundle_data)
968                 {
969                         notification_set_execute_option(m_notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
970                                 NULL,NULL, bundle_data);
971                 }
972 #endif
973                                 
974         }
975         
976 }
977
978 void StatusNotification::setApplicationId(const std::string& appId)
979 {
980         LoggerI("m_service = "  << m_service << " appId = " << appId);
981         if (!m_service)
982         {       
983                 if (service_create(&m_service) != SERVICE_ERROR_NONE)
984                 {
985                         LoggerW("Create Service Failed..");
986                         throw UnknownException("service creation error");
987                 }
988         }
989
990         if (m_service)
991         {
992                 m_launchFlag = true;
993                 if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
994                 {
995                         throw UnknownException("service set appId error");      
996                 }
997         }
998
999 }
1000
1001 std::string StatusNotification::getApplicationId()
1002 {
1003         std::string retString;
1004         char* appIdStr = NULL;
1005 #if 0   
1006         service_h service = NULL;
1007
1008         if (m_service != NULL)
1009         {
1010                 int retcode;
1011                 retcode = service_clone(&service, m_service);   
1012                 
1013                 if (retcode != SERVICE_ERROR_NONE)
1014                 {
1015                         if (retcode == SERVICE_ERROR_OUT_OF_MEMORY)
1016                         {
1017                                 LoggerW("SERVICE_ERROR_OUT_OF_MEMORY");
1018                         }
1019                         else
1020                         {
1021                                 LoggerW("UI_NOTIFICATION_ERROR_INVALID_PARAMETER");
1022                         }
1023                         throw UnknownException ("get notification service error ");
1024                 }
1025                 else
1026                 {
1027                         if (service == NULL)
1028                         {
1029                                 throw UnknownException ("get notification service ok, but service null");                       
1030                         }
1031                 }
1032         }
1033 #endif
1034         if (m_service != NULL) 
1035         {
1036                 if (service_get_app_id(m_service, &appIdStr) != SERVICE_ERROR_NONE)
1037                 {
1038                         throw UnknownException ("get a appId error");
1039                 }
1040
1041                 if (appIdStr != NULL)
1042                 {
1043                         retString = appIdStr;
1044                         free(appIdStr);
1045                 }
1046         }
1047         LoggerI(retString);
1048         
1049         return retString;
1050
1051 }
1052
1053 double StatusNotification::getProgressValue() 
1054 {
1055         double value = 0.0;
1056         
1057         if (m_notiHandle)
1058         {
1059                 NotificationProgressType progressType = getProgressType();
1060         
1061                 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1062                 {
1063                         if (notification_get_size(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1064                         {
1065                                 throw UnknownException("get notification size error");
1066                         }
1067                         LoggerI("Size Val = " << value);
1068                 }
1069                 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1070                 {
1071                         if (notification_get_progress(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1072                         {
1073                                 throw UnknownException("get notification percentage error");
1074                         }
1075                         LoggerI("Percentage Val = " << value);
1076                 }
1077                 else
1078                 {
1079                         throw UnknownException("get notification progress type error");
1080                 }
1081         }
1082         else
1083         {
1084                 LoggerD("noti Handle is NULL");
1085         }
1086         LoggerI("value = " << value);
1087         return value;
1088         
1089 }
1090
1091 void StatusNotification::setProgressValue(const double &progressValue)
1092 {
1093         if (m_notiHandle)
1094         {       
1095                 NotificationProgressType progressType = getProgressType();
1096                 LoggerI("Progress Type : " << progressType);
1097                 
1098                 double val = getProgressValue();
1099                 LoggerI("Progress value = " << progressValue << " origin Progress Value =" << val);
1100                 
1101                 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1102                 {
1103                         if (notification_set_size(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1104                         {
1105                                 throw UnknownException("set notification progress size error");
1106                         }
1107                 }
1108                 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1109                 {       
1110                         if (notification_set_progress(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1111                         {
1112                                 throw UnknownException("set notification percentage error");
1113                         }
1114                 }
1115                 else
1116                 {
1117                         throw UnknownException("get notification progress type error");
1118                 }
1119         }
1120         else
1121         {
1122                 LoggerD("noti Handle is NULL");
1123                 throw UnknownException( "notification handle is null");
1124         }
1125 }
1126
1127 NotificationProgressType StatusNotification::getProgressType()
1128 {
1129         return m_progressType;
1130 }
1131
1132 void StatusNotification::setProgressType(NotificationProgressType type)
1133 {
1134         
1135         if (m_notiHandle)
1136         {
1137                 LoggerI(" NotificationProgressType = " << type);
1138
1139                 std::string progressType;
1140
1141                 if ( type == NOTI_PROGRESS_TYPE_PERCENTAGE)
1142                 {
1143                         progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
1144                 }
1145                 else if ( type == NOTI_PROGRESS_TYPE_SIZE)
1146                 {
1147                         progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE;
1148                 }
1149                 else
1150                 {
1151                         throw TypeMismatchException("Invalid Progress Type.");
1152                 }
1153                 
1154                 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_LIST_5, progressType.c_str()) != NOTIFICATION_ERROR_NONE)
1155                 {
1156                         throw UnknownException("set notification sound error");
1157                 }
1158
1159                 m_progressType = type;
1160         }
1161         else
1162         {       
1163                 LoggerD("noti Handle is NULL");
1164                 throw UnknownException("notification handle is null");
1165         }
1166         
1167 }
1168
1169 std::string StatusNotification::getSubIconPath()
1170 {
1171         LoggerI("Handle = " << m_notiHandle);
1172         if (m_notiHandle)
1173         {
1174                 char *subIconPath = NULL;
1175         
1176                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON_SUB,  &subIconPath) != NOTIFICATION_ERROR_NONE)
1177                 {
1178                         throw UnknownException("get notification sub icon error");
1179                 }
1180
1181                 std::string notiSubIconPath;
1182                 if(subIconPath)
1183                         notiSubIconPath = subIconPath;
1184                 return notiSubIconPath; 
1185         }
1186         else
1187         {
1188                 throw UnknownException("notification handle is null");
1189         }
1190
1191 }
1192
1193 void StatusNotification::setSubIconPath(const std::string& subIconPath)
1194 {
1195         if (m_notiHandle)
1196         {
1197                 LoggerI(" subIconPath = " << subIconPath << " origin SubIconPath = " << getSubIconPath());      
1198
1199                 if( getSubIconPath().compare(subIconPath))
1200                 {
1201                         if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON_SUB, subIconPath.c_str()) != NOTIFICATION_ERROR_NONE)
1202                         {
1203                                 throw UnknownException("set notification sound error");
1204                         }
1205                         setUpdatedFlag(true);
1206                 }
1207         }
1208         else
1209         {       
1210                 LoggerD("noti Handle is NULL");
1211                 throw UnknownException("notification handle is null");
1212         }
1213 }
1214
1215 #if 0
1216 std::string StatusNotification::getInformation(int index)
1217 {
1218         if (m_notiHandle)
1219         {
1220                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
1221                 switch (index)
1222                 {
1223                         case 0:
1224                                 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1225                                 break;
1226                         case 1:
1227                                 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1228                                 break;
1229                         case 2:
1230                                 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1231                                 break;
1232                         default :
1233                                 type = NOTIFICATION_TEXT_TYPE_NONE;
1234                 }
1235                 char *info = NULL;
1236                 
1237                 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
1238                 {
1239                         throw UnknownException("get notification information error");
1240                 }
1241
1242                 std::string strInfo;
1243                 if (info)
1244                         strInfo = info;
1245                 LoggerD(" info " << strInfo);
1246                 return strInfo;
1247
1248         }
1249         else
1250         {       
1251                 LoggerD("noti Handle is NULL");
1252                 throw UnknownException("notification handle is null");
1253         }
1254         
1255 }
1256
1257 void StatusNotification::setInformation( const std::string& info, int index)
1258 {
1259
1260         if (m_notiHandle)
1261         {
1262                 int idx = index;
1263                 LoggerD(" index : " << idx);
1264                 LoggerD(" log : " << info);
1265                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
1266                 
1267                 switch (idx)
1268                 {
1269                         case 0:
1270                                 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1271                                 break;
1272                         case 1:
1273                                 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1274                                 break;
1275                         case 2:
1276                                 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1277                                 break;
1278                         default :
1279                                 type = NOTIFICATION_TEXT_TYPE_NONE;
1280                 }
1281
1282                 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1283                 {
1284                         if (getInformation(idx).compare(info))
1285                         {
1286                                 if (notification_set_text(m_notiHandle, type, info.c_str(),
1287                                         NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1288                                 {
1289                                         throw UnknownException("set notification sound error");
1290                                 }
1291                                 setUpdatedFlag(true);
1292                         }
1293                 }
1294         }
1295         else
1296         {       
1297                 LoggerD("noti Handle is NULL");
1298                 throw UnknownException("notification handle is null");
1299         }
1300 }
1301
1302 std::string StatusNotification::getSubInformation(int index)
1303 {
1304
1305         if (m_notiHandle)
1306         {
1307                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
1308                 switch (index)
1309                 {
1310                         case 0:
1311                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1312                                 break;
1313                         case 1:
1314                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1315                                 break;
1316                         case 2:
1317                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1318                                 break;
1319                         default :
1320                                 type = NOTIFICATION_TEXT_TYPE_NONE;
1321                 }
1322                                 
1323                 char *subInfo = NULL;
1324                 
1325                 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
1326                 {
1327                         throw UnknownException( "get notification sub information error");
1328                 }
1329
1330                 std::string strSubInfo;
1331                 if (subInfo)
1332                         strSubInfo = subInfo;
1333                 LoggerD(" subInfo " << strSubInfo);
1334                 return strSubInfo;
1335                                 
1336         }
1337         else
1338         {       
1339                 LoggerD("noti Handle is NULL");
1340                 throw UnknownException( "notification handle is null");
1341         }
1342         
1343 }
1344
1345 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
1346 {
1347         if (m_notiHandle)
1348         {
1349                 int idx = index;
1350                 LoggerD(" index : " << idx);
1351                 LoggerD(" log : " << subInfo);
1352                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
1353                 
1354                 switch (idx)
1355                 {
1356                         case 0:
1357                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1358                                 break;
1359                         case 1:
1360                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1361                                 break;
1362                         case 2:
1363                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1364                                 break;
1365                         default :
1366                                 type = NOTIFICATION_TEXT_TYPE_NONE;
1367                 }
1368
1369                 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1370                 {
1371                         if (getSubInformation(idx).compare(subInfo))
1372                         {
1373                                 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
1374                                         NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1375                                 {
1376                                         throw UnknownException( "set notification sound error");
1377                                 }
1378                                 setUpdatedFlag(true);
1379                         }
1380                 }
1381         }
1382         else
1383         {       
1384                 LoggerD("noti Handle is NULL");
1385                 throw UnknownException( "notification handle is null");
1386         }
1387                 
1388 }
1389 #endif
1390
1391 void StatusNotification::loadThumbnails()
1392 {
1393         if (m_notiHandle)
1394         {       
1395                 if (!m_thumbs.empty())
1396                         m_thumbs.clear();
1397
1398                 char *thumb = NULL;
1399                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_1, &thumb) != NOTIFICATION_ERROR_NONE)
1400                 {
1401                         throw UnknownException( "get notification thumbnail error");
1402                 }
1403                 if (thumb)
1404                         m_thumbs.push_back(thumb);
1405                 //else
1406                 //      m_thumbs.push_back(std::string("")); //set empty
1407                 thumb = NULL;
1408                 
1409                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_2, &thumb) != NOTIFICATION_ERROR_NONE)
1410                 {
1411                         throw UnknownException( "get notification sub information error");
1412                 }       
1413                 if (thumb)
1414                         m_thumbs.push_back(thumb);
1415                 //else
1416                 //      m_thumbs.push_back(std::string("")); //set empty
1417                 thumb = NULL;
1418                 
1419                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_3, &thumb) != NOTIFICATION_ERROR_NONE)
1420                 {
1421                         throw UnknownException( "get notification sub information error");
1422                 }
1423                 
1424                 if (thumb)
1425                         m_thumbs.push_back(thumb);
1426                 //else
1427                 //      m_thumbs.push_back(std::string("")); //set empty
1428                 thumb = NULL;
1429
1430                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_4, &thumb) != NOTIFICATION_ERROR_NONE)
1431                 {
1432                         throw UnknownException( "get notification sub information error");
1433                 }
1434                 
1435                 if (thumb)
1436                         m_thumbs.push_back(thumb);
1437                 //else
1438                 //      m_thumbs.push_back(std::string("")); //set empty
1439                 thumb = NULL;
1440 #if 0   
1441                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_5, &thumb) != NOTIFICATION_ERROR_NONE)
1442                 {
1443                         throw UnknownException( "get notification sub information error");
1444                 }
1445                 
1446                 if (thumb)
1447                         m_thumbs.push_back(thumb);
1448                 else
1449                         m_thumbs.push_back(std::string("")); //set empty
1450                 thumb = NULL;
1451 #endif          
1452                 
1453         }
1454         else
1455         {       
1456                 LoggerD("noti Handle is NULL");
1457                 throw UnknownException( "notification handle is null");
1458         }
1459 }
1460
1461 std::vector<std::string> StatusNotification::getThumbnails()
1462 {
1463         LoggerI(" thumbnail Size : " << m_thumbs.size());
1464         return m_thumbs;
1465 }
1466
1467 std::string StatusNotification::getThumbnail(int index)
1468 {
1469         if (m_notiHandle)
1470         {
1471                 LoggerI(" index : " << index);
1472                 
1473                 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE; 
1474                 
1475                 switch (index)
1476                 {
1477                         case 0:
1478                                 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1479                                 break;
1480                         case 1:
1481                                 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1482                                 break;
1483                         case 2:
1484                                 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1485                                 break;
1486                         case 3:
1487                                 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1488                                 break;
1489                         case 4:
1490                                 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1491                                 break;
1492                         default :
1493                                 type = NOTIFICATION_IMAGE_TYPE_NONE;
1494                 }
1495
1496                 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1497                 {
1498                         char *thumb = NULL;
1499                         if (notification_get_image(m_notiHandle, type, &thumb) != NOTIFICATION_ERROR_NONE)
1500                         {
1501                                 throw UnknownException( "set notification thumbnail error");
1502                         }
1503
1504                         std::string thumbnail;
1505                         if(thumb)
1506                                 thumbnail = thumb;
1507                         return thumbnail;
1508                 }
1509                 else
1510                 {
1511                         throw UnknownException( "notification handle is null");
1512                 }
1513                 
1514         }
1515         else
1516         {       
1517                 LoggerD("noti Handle is NULL");
1518                 throw UnknownException( "notification handle is null");
1519         }
1520 #if 0
1521         if (m_thumbs.size() > index)
1522                 return m_thumbs[index];
1523         else
1524                 return std::string("");
1525 #endif
1526
1527 }
1528
1529 void StatusNotification::setThumbnails(std::vector<std::string> thumbs)
1530 {
1531         LoggerI("set thumbnails");
1532         if (m_notiHandle)
1533         {
1534                 std::vector<std::string>::iterator it;
1535
1536                 int idx = 0;
1537                 for (it = thumbs.begin(); it < thumbs.end(); ++it)
1538                 {
1539                         std::string str = *it;
1540                         if ( idx < MAX_THUMBNAIL_LENGTH )
1541                                 setThumbnail(str, idx); //set notification's thumbnail value.
1542                         idx ++;
1543                 }
1544
1545                 m_thumbs = thumbs;
1546         }
1547         else
1548         {       
1549                 LoggerD("noti Handle is NULL");
1550                 throw UnknownException( "notification handle is null");
1551         }
1552 }
1553
1554 void StatusNotification::setThumbnail( const std::string& thumb, int index)
1555 {
1556         if (m_notiHandle)
1557         {
1558                 LoggerI(" index : " << index);
1559                 LoggerI(" thumb : " << thumb);
1560                 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE; 
1561                 
1562                 switch (index)
1563                 {
1564                         case 0:
1565                                 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1566                                 break;
1567                         case 1:
1568                                 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1569                                 break;
1570                         case 2:
1571                                 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1572                                 break;
1573                         case 3:
1574                                 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1575                                 break;
1576                         case 4:
1577                                 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1578                                 break;
1579                         default :
1580                                 type = NOTIFICATION_IMAGE_TYPE_NONE;
1581                 }
1582
1583                 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1584                 {
1585                         if (getThumbnail(index).compare(thumb))
1586                         {
1587                                 if (notification_set_image(m_notiHandle, type, thumb.c_str()) != NOTIFICATION_ERROR_NONE)
1588                                 {
1589                                         throw UnknownException( "set notification thumbnail error");
1590                                 }
1591                                 setUpdatedFlag(true);
1592                         }
1593                 }
1594         }
1595 }
1596
1597 std::string StatusNotification::getBackground()
1598 {
1599         LoggerI(" Handle : " << m_notiHandle);
1600
1601         if (m_notiHandle)
1602         {
1603                 char *background = NULL;
1604         
1605                 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, &background) != NOTIFICATION_ERROR_NONE)
1606                 {
1607                         throw UnknownException( "get notification background error");
1608                 }
1609                 
1610                 std::string notiBackground;
1611                 if (background)
1612                         notiBackground = background;
1613                 return notiBackground;
1614         }
1615         else
1616         {
1617                 LoggerD("noti Handle is NULL");
1618                 throw UnknownException( "notification handle is null");
1619         }
1620
1621 }
1622
1623 void StatusNotification::setBackground(const std::string imagePath)
1624 {
1625         LoggerI(" imagePath : " << imagePath);
1626         if (m_notiHandle)
1627         {
1628                 if (getBackground().compare(imagePath))
1629                 {
1630                         if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_BACKGROUND, imagePath.c_str()) != NOTIFICATION_ERROR_NONE)
1631                         {
1632                                 throw UnknownException( "set notification sound error");
1633                         }
1634                         setUpdatedFlag(true);
1635                 }
1636         }
1637         else
1638         {       
1639                 LoggerD("noti Handle is NULL");
1640                 throw UnknownException( "notification handle is null");
1641         }
1642 }
1643
1644 long StatusNotification::getNumber()
1645 {
1646         LoggerI("Handle = " << m_notiHandle);
1647         if (m_notiHandle)
1648         {
1649                 long number = 0;
1650                 char *strNumber = NULL;
1651
1652                 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1653                 {
1654                         throw UnknownException( "get notification background error");
1655                 }
1656
1657                 if (strNumber)
1658                         std::istringstream(strNumber) >> number;
1659                 else
1660                         LoggerI("Number Is NULL");
1661
1662                 LoggerI("number = " << number);
1663
1664                 return number;
1665         }
1666         else
1667         {
1668                 LoggerD("noti Handle is NULL");
1669                 return 0;
1670         }
1671 }
1672
1673 const char* StatusNotification::getStrNumber()
1674 {
1675         LoggerI("Handle = " << m_notiHandle);
1676         if (m_notiHandle)
1677         {
1678                 char *strNumber = NULL;
1679
1680                 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1681                 {
1682                         throw UnknownException( "get notification background error");
1683                 }
1684
1685                 if (!strNumber)
1686                 {
1687                         return NULL;
1688                 }
1689
1690                 return strNumber;
1691         }
1692         else
1693         {
1694                 LoggerD("noti Handle is NULL");
1695                 return NULL;
1696         }
1697 }
1698
1699 void StatusNotification::setNumber(const long number)
1700 {
1701         LoggerI("Number = " << number);
1702         if (m_notiHandle)
1703         {
1704                 if(number!=getNumber())
1705                 {
1706                         std::stringstream stream;
1707                         stream << number;
1708                         if (stream.fail()) {
1709                                 throw UnknownException(
1710                                                  "Couldn't convert notification number");
1711                         }
1712                         
1713                         std::string strNumber = stream.str();           
1714                         if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, strNumber.c_str(),
1715                                 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1716                         {
1717                                 throw UnknownException( "set notification text error");
1718                         }
1719                         setUpdatedFlag(true);
1720                 }
1721         }
1722         else
1723         {               
1724                 LoggerD("noti Handle is NULL");
1725                 throw UnknownException( "notification handle is null");
1726         }
1727 }
1728
1729 void* StatusNotification::getNotificationHandle()
1730 {
1731         return m_notiHandle;
1732 }
1733
1734 void StatusNotification::setNotificationHandle(void *handle)
1735 {
1736         if (handle == NULL)
1737         {
1738                 throw UnknownException( "notification handle null error");
1739         }
1740         LoggerI("handle = " << handle << " m_notiHandle = " << m_notiHandle);
1741         
1742         if (m_notiHandle != NULL)
1743         {       
1744                 //delete old noti.
1745                 if ( notification_delete(m_notiHandle) != NOTIFICATION_ERROR_NONE)
1746                 {
1747                         throw UnknownException( "notification delete error");
1748                 }
1749                 m_notiHandle = NULL;
1750         }
1751         
1752         m_notiHandle = (notification_h)handle;
1753 }
1754
1755 service_h StatusNotification::getService()
1756 {
1757         return m_service;
1758 }
1759
1760 std::string StatusNotification::getLight()
1761 {
1762         LoggerI("get Light handle: " << m_notiHandle);
1763         if (m_notiHandle)
1764         {
1765                 int ledColor = 0;
1766                 notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1767                 if (notification_get_led(m_notiHandle, &type, &ledColor) != NOTIFICATION_ERROR_NONE)
1768                 {
1769                         throw UnknownException("get notification Content error");
1770                 }
1771                 std::string light;
1772                 std::stringstream stream;
1773                 if (NOTIFICATION_LED_OP_OFF != type)
1774                 {
1775                         stream <<  std::hex  << ledColor;
1776                         light = "#" + stream.str();
1777                 }
1778                 
1779                 return boost::to_lower_copy(light);
1780         }
1781         else
1782         {
1783                 throw UnknownException("notification handle is null");
1784         }
1785 }
1786
1787 bool StatusNotification::isColorFormatNumberic(std::string& color)
1788 {
1789         //first check length
1790         std::string hexCode = "0123456789abcdef";
1791         if (color.length() == 7 && !color.compare(0, 1, "#") )
1792         {
1793                 for ( size_t i = 1 ; i < color.length() ; i++)
1794                 {
1795                         if (std::string::npos == hexCode.find(color[i]))
1796                                 return false;
1797                 }
1798                 return true;
1799         }
1800         return false;
1801 }
1802
1803 void StatusNotification::setLight(std::string color)
1804 {
1805         LoggerI("set Light handle: " << m_notiHandle);
1806         LoggerI("led Color : " << color);
1807         if (m_notiHandle)
1808         {       
1809                 color = boost::to_lower_copy(color);     //convert lowercase.
1810                 if ( isColorFormatNumberic(color))
1811                 {
1812                         std::stringstream stream;       
1813                         int ledColor = 0;
1814                         notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1815                         std::string colorCode = color.substr(1, color.length());
1816
1817                         stream << std::hex << colorCode;
1818                         LoggerI("LedColor = " << stream.str());
1819                         stream >> ledColor;
1820                         LoggerI("LedColor = " << ledColor);
1821
1822                         if (ledColor != 0)
1823                                 type = NOTIFICATION_LED_OP_ON_CUSTOM_COLOR;
1824                         else
1825                                 type = NOTIFICATION_LED_OP_OFF;
1826                         
1827                         if (notification_set_led(m_notiHandle, type, ledColor) != NOTIFICATION_ERROR_NONE)
1828                         {
1829                                 throw UnknownException("set notification led ");
1830                         }                       
1831                         
1832                 }
1833                 else
1834                 {
1835                         LoggerI("color.length()=" << color.length());
1836                         if (color.length() == 0)
1837                         {
1838                                 if (notification_set_led(m_notiHandle, NOTIFICATION_LED_OP_OFF, 0) != NOTIFICATION_ERROR_NONE)
1839                                 {
1840                                         throw UnknownException("set notification led ");
1841                                 }
1842                         }
1843                         else
1844                         {
1845                                 throw InvalidValuesException("color code error!");
1846                         }
1847                 }
1848         }
1849         else
1850         {
1851                 throw UnknownException("notification handle is null");
1852         }
1853 }
1854
1855 unsigned long StatusNotification::getLightOnTime()
1856 {
1857         LoggerI("get Light on Time handle: " << m_notiHandle);
1858         if (m_notiHandle)
1859         {
1860                 int onTime = 0;
1861                 int offTime = 0;
1862                 
1863                 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1864                 {
1865                         throw UnknownException("set notification led ");
1866                 }
1867                 LoggerI("onTime " << onTime);
1868                 
1869                 return (unsigned long) onTime;
1870         }
1871         else
1872         {
1873                 throw UnknownException("notification handle is null");
1874         }
1875 }
1876
1877 void StatusNotification::setLightOnTime(unsigned long time)
1878 {
1879         LoggerI("set Light on Time handle: " << m_notiHandle);
1880         LoggerI("itme = " << time);
1881         if (m_notiHandle)
1882         {
1883                 int offTime = getLightOffTime();
1884                 
1885                 if (notification_set_led_time_period(m_notiHandle, time, offTime ) != NOTIFICATION_ERROR_NONE)
1886                 {
1887                         throw UnknownException("set notification led ");
1888                 }
1889                 
1890         }
1891         else
1892         {
1893                 throw UnknownException("notification handle is null");
1894         }
1895 }
1896
1897 unsigned long StatusNotification::getLightOffTime()
1898 {
1899
1900         LoggerI("get Light on Time handle: " << m_notiHandle);
1901         if (m_notiHandle)
1902         {
1903                 int onTime = 0;
1904                 int offTime = 0;
1905                 
1906                 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1907                 {
1908                         throw UnknownException("set notification led ");
1909                 }
1910                 LoggerI("offTime " << offTime);
1911                 
1912                 return offTime;
1913         }
1914         else
1915         {
1916                 throw UnknownException("notification handle is null");
1917         }
1918
1919 }
1920
1921 void StatusNotification::setLightOffTime(unsigned long time)
1922 {
1923         LoggerI("set Light off Time handle: " << m_notiHandle);
1924         LoggerI("time = " << time);
1925         if (m_notiHandle)
1926         {
1927                 int onTime = getLightOnTime();
1928                 
1929                 if (notification_set_led_time_period(m_notiHandle, onTime, time ) != NOTIFICATION_ERROR_NONE)
1930                 {
1931                         throw UnknownException("set notification led ");
1932                 }
1933         }
1934         else
1935         {
1936                 throw UnknownException("notification handle is null");
1937         }
1938 }
1939
1940 //Detail Info
1941 void StatusNotification::loadDetailInfos()
1942 {
1943         LoggerI("noti Handle = " << m_notiHandle);
1944
1945         if (m_notiHandle)
1946         {
1947                 for ( int idx = 0; idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH; idx++)
1948                 {
1949                     if (!isNullInformation(idx))
1950                     {
1951                             std::string main = getInformation(idx);
1952                             std::string sub = getSubInformation(idx);
1953
1954                             LoggerI("Main : [" << main << "] Sub : ['" << sub <<"]");      
1955                             
1956                             NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub);
1957                             m_detailInfos.push_back(info);
1958                     }
1959                 }
1960         }
1961         else
1962         {               
1963                 LoggerD("noti Handle is NULL");
1964                 throw UnknownException( "notification handle is null");
1965         }
1966         
1967 }
1968
1969 std::vector<NotificationDetailInfo*> StatusNotification::getDetailInfos() const
1970 {
1971         return m_detailInfos;
1972 }
1973
1974 void StatusNotification::setDetailInfos(const std::vector<NotificationDetailInfo*> value)
1975 {
1976     LoggerI("DetailInfos = " << value.size());
1977
1978     if (m_notiHandle)
1979     {
1980         std::vector<NotificationDetailInfo*>::const_iterator it;
1981         
1982         int idx = 0;
1983         for (it = value.begin(); it < value.end(); ++it)
1984         {
1985             NotificationDetailInfo* info = *it;
1986             if ( idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH )
1987             {
1988             
1989                 LoggerI("main " << info->getMainText() << " sub " << info->getSubText() );
1990                 setInformation(info->getMainText(), idx);
1991                 setSubInformation(info->getSubText(), idx);
1992             }
1993             idx ++;
1994         }
1995     
1996         m_detailInfos = value;
1997     }
1998     else
1999     {   
2000         LoggerD("noti Handle is NULL");
2001         throw UnknownException( "notification handle is null");
2002     }
2003         
2004 }
2005
2006 int StatusNotification::getDetailInfosNum() const
2007 {
2008         return m_detailInfos.size();
2009 }
2010
2011 void StatusNotification::clearDetailInfos()
2012 {
2013         if ( !m_detailInfos.empty() )
2014         {
2015                 std::vector<NotificationDetailInfo*>::const_iterator it;
2016                
2017                 int idx = 0;
2018                 for (it = m_detailInfos.begin(); it < m_detailInfos.end(); ++it)
2019                 {
2020                     NotificationDetailInfo* info = *it;
2021                     LoggerI("Delete Detail Info : " << info);
2022                     if (info)
2023                         delete info;
2024                     idx ++;
2025                 }
2026                 m_detailInfos.clear();          //clear
2027         }
2028 }
2029
2030 std::string StatusNotification::getInformation(int index)
2031 {
2032         if (m_notiHandle)
2033         {
2034                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
2035                 switch (index)
2036                 {
2037                         case 0:
2038                                 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2039                                 break;
2040                         case 1:
2041                                 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2042                                 break;
2043                         case 2:
2044                                 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2045                                 break;
2046                         default :
2047                                 type = NOTIFICATION_TEXT_TYPE_NONE;
2048                 }
2049                 char *info = NULL;
2050                 
2051                 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
2052                 {
2053                         throw UnknownException("Detail Info index value is invalid or mainText value getting is failed in Detail Info.");
2054                 }
2055
2056                 std::string strInfo;
2057                 if (info)
2058                         strInfo = info;
2059                 LoggerI(" info " << strInfo);
2060                 return strInfo;
2061
2062         }
2063         else
2064         {       
2065                 LoggerW("noti Handle is NULL");
2066                 throw UnknownException( "notification handle is null");
2067         }
2068         
2069 }
2070
2071 bool StatusNotification::isNullInformation(int index)
2072 {
2073         if (m_notiHandle)
2074         {
2075                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
2076                 switch (index)
2077                 {
2078                         case 0:
2079                                 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2080                                 break;
2081                         case 1:
2082                                 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2083                                 break;
2084                         case 2:
2085                                 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2086                                 break;
2087                         default :
2088                                 type = NOTIFICATION_TEXT_TYPE_NONE;
2089                 }
2090                 char *info = NULL;
2091                 
2092                 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
2093                 {
2094                         throw UnknownException("Detail Info index value is invalid or mainText value getting is failed in Detail Info.");
2095                 }
2096                 
2097                 if (info)
2098                 {
2099                         LoggerI("is not null");
2100                         return false;
2101                 }
2102                 else
2103                 {
2104                         LoggerI("is null");
2105                         return true;
2106                 }
2107
2108         }
2109         else
2110         {       
2111                 LoggerW("noti Handle is NULL");
2112                 throw UnknownException( "notification handle is null");
2113         }
2114 }
2115
2116 std::string StatusNotification::getSubInformation(int index)
2117 {
2118         if (m_notiHandle)
2119         {
2120                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
2121                 switch (index)
2122                 {
2123                         case 0:
2124                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2125                                 break;
2126                         case 1:
2127                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2128                                 break;
2129                         case 2:
2130                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2131                                 break;
2132                         default :
2133                                 type = NOTIFICATION_TEXT_TYPE_NONE;
2134                 }
2135                                 
2136                 char *subInfo = NULL;
2137                 
2138                 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
2139                 {
2140                         throw UnknownException("Detail Info index value is invalid or subText value getting is failed in Detail Info.");
2141                 }
2142
2143                 std::string strSubInfo;
2144                 if (subInfo)
2145                         strSubInfo = subInfo;
2146                 LoggerI(" subInfo " << strSubInfo);
2147                 return strSubInfo;
2148                                 
2149         }
2150         else
2151         {       
2152                 LoggerW("noti Handle is NULL");
2153                 throw UnknownException ("notification handle is null");
2154         }
2155         
2156 }
2157
2158 void StatusNotification::setInformation( const std::string& info, int index)
2159 {
2160         if (m_notiHandle)
2161         {
2162                 int idx = index;
2163                 LoggerD(" index : " << idx);
2164                 LoggerD(" log : " << info);
2165                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
2166                 
2167                 switch (idx)
2168                 {
2169                         case 0:
2170                                 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2171                                 break;
2172                         case 1:
2173                                 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2174                                 break;
2175                         case 2:
2176                                 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2177                                 break;
2178                         default :
2179                                 type = NOTIFICATION_TEXT_TYPE_NONE;
2180                 }
2181
2182                 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2183                 {
2184                         if (getInformation(idx).compare(info) || isNullInformation(idx))
2185                         {
2186                                 if (notification_set_text(m_notiHandle, type, info.c_str(),
2187                                         NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2188                                 {
2189                                         throw UnknownException("set notification sound error");
2190                                 }
2191                                 setUpdatedFlag(true);
2192                         }
2193                 }
2194                 else
2195                 {       
2196                         LoggerW("noti Handle is NULL");
2197                         throw UnknownException("notification handle is null");
2198                 }
2199         }
2200         else
2201         {       
2202                 LoggerW("noti Handle is NULL");
2203                 throw UnknownException("notification handle is null");
2204         }
2205 }
2206
2207 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
2208 {
2209
2210         if (m_notiHandle)
2211         {
2212                 int idx = index;
2213                 LoggerD(" index : " << idx);
2214                 LoggerD(" log : " << subInfo);
2215                 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE; 
2216                 
2217                 switch (idx)
2218                 {
2219                         case 0:
2220                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2221                                 break;
2222                         case 1:
2223                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2224                                 break;
2225                         case 2:
2226                                 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2227                                 break;
2228                         default :
2229                                 type = NOTIFICATION_TEXT_TYPE_NONE;
2230                 }
2231
2232                 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2233                 {
2234                         if (getSubInformation(idx).compare(subInfo))
2235                         {
2236                                 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
2237                                         NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2238                                 {
2239                                         throw UnknownException("set notification sound error");
2240                                 }
2241                                 setUpdatedFlag(true);
2242                         }
2243                 }
2244         }
2245         else
2246         {       
2247                 LoggerW("noti Handle is NULL");
2248                 throw UnknownException("notification handle is null");
2249         }
2250 }
2251
2252 } // Notification
2253 } // DeviceAPI