2 // Tizen Web Device API
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <PlatformException.h>
21 #include <appsvc/appsvc.h>
24 #include <boost/algorithm/string.hpp>
25 #include "StatusNotification.h"
28 namespace Notification {
30 #define DEFAULT_ICON_PATH "/opt/share/icons/default/"
31 #define MAX_NOTIFICATION_DETAIL_INFO_LENGTH 2
32 #define MAX_THUMBNAIL_LENGTH 4
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);
38 static bool service_extra_data_cb(service_h service, const char *key, void *user_data)
44 if (user_data != NULL && key != NULL)
46 LoggerI("user data & key is existed");
48 DeviceAPI::Application::ApplicationControlPtr* appControl =
49 (DeviceAPI::Application::ApplicationControlPtr*)(user_data);
51 DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData());
52 LoggerI("key = " << key);
53 std::string keyStr = key;
54 std::vector<std::string> keyValue;
57 if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE)
59 LoggerI("extra_data_array length = " << length);
61 if (value != NULL && length != 0)
63 LoggerI("extra_data_length = " << length);
65 for (index = 0; index < length; index++)
67 LoggerI("Value=" << value[index]);
68 keyValue.push_back(value[index]);
71 data->setValue(keyValue);
72 (*appControl)->addAppControlData(data);
82 StatusNotification::StatusNotification(NotificationType statusType) :
83 m_notiType(NOTI_TYPE_NONE),
86 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
90 LoggerI("statusType =" << statusType);
92 notification_type_e type = NOTIFICATION_TYPE_NONE;
93 setNotiType(statusType);
95 if (statusType == NOTI_TYPE_SIMPLE || statusType == NOTI_TYPE_MUTIPLE || statusType == NOTI_TYPE_THUMBNAIL)
97 type = NOTIFICATION_TYPE_NOTI;
99 else if ( statusType == NOTI_TYPE_ONGOING || statusType == NOTI_TYPE_PROGRESS)
101 type = NOTIFICATION_TYPE_ONGOING;
105 LoggerI(" invalide noti type");
106 throw TypeMismatchException("value is not notification type");
109 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default
111 LoggerI("Notification Type : " << type);
113 notification_h noti = notification_create(type); //create notificatin.
116 LoggerI("noti =" << noti);
117 setNotificationHandle((void*)noti);
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 ))
124 throw UnknownException("can't set notification display applist");
131 throw UnknownException("can't make new notification object");
134 //m_detailInfos = new std::vector<NotificationDetailInfo*>();
135 //m_thumbs = new std::vector<std::string>();
139 StatusNotification::StatusNotification(void* noti) :
140 m_notiType(NOTI_TYPE_NONE),
143 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
144 m_notiUpdated(false),
147 LoggerI("noti : " << noti);
149 notification_h notification = (notification_h)noti;
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;
157 notification_get_type(notification, ¬i_type);
158 notification_get_layout(notification, ¬i_layout);
161 if ( noti_type == NOTIFICATION_TYPE_NOTI )
163 if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE ||
164 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
166 type = NOTI_TYPE_SIMPLE;
168 else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
170 type = NOTI_TYPE_THUMBNAIL;
173 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
175 if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
177 type = NOTI_TYPE_ONGOING;
179 else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
181 type = NOTI_TYPE_PROGRESS;
185 LoggerI(" notification type =" << 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))
192 if ( strProgressType )
194 std::string notiProgressType(strProgressType);
195 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
196 m_progressType = NOTI_PROGRESS_TYPE_SIZE;
200 setNotificationHandle((void*)notification);
205 if ( type == NOTI_TYPE_PROGRESS)
207 notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
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)
217 LoggerI(" bundle = " << bSvc);
220 LoggerI("bundle is valid");
221 int ret = service_create_event(bSvc, &m_service);
222 if (ret != SERVICE_ERROR_NONE)
224 LoggerI("Service Create Event Error");
225 throw UnknownException("can't make service object");
231 notification_free(notification);
232 throw UnknownException("can't get service data");
238 throw InvalidValuesException("It is not notification object.");
243 StatusNotification::StatusNotification(int privID) :
244 m_notiType(NOTI_TYPE_NONE),
247 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
248 m_notiUpdated(false),
251 LoggerI("priv ID : " << privID);
253 notification_h notification = notification_load( NULL, privID); //load notification.
254 LoggerI(" notification " << notification);
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;
262 notification_get_type(notification, ¬i_type);
263 notification_get_layout(notification, ¬i_layout);
265 if ( noti_type == NOTIFICATION_TYPE_NOTI )
267 if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE ||
268 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
270 type = NOTI_TYPE_SIMPLE;
272 else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
274 type = NOTI_TYPE_THUMBNAIL;
277 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
279 if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
281 type = NOTI_TYPE_ONGOING;
283 else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
285 type = NOTI_TYPE_PROGRESS;
289 LoggerI(" notification type =" << 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))
296 if ( strProgressType )
298 std::string notiProgressType(strProgressType);
299 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
300 m_progressType = NOTI_PROGRESS_TYPE_SIZE;
304 setNotificationHandle((void*)notification);
308 if ( type == NOTI_TYPE_PROGRESS)
310 notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
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)
320 LoggerI(" bundle = " << bSvc);
323 LoggerI("bundle is valid");
324 int ret = service_create_event(bSvc, &m_service);
325 if (ret != SERVICE_ERROR_NONE)
327 LoggerI("Service Create Event Error");
328 throw UnknownException("can't make service object");
334 notification_free(notification);
335 throw UnknownException("can't get service data");
341 throw NotFoundException("It is not notification ID or removed notification");
346 StatusNotification::~StatusNotification()
348 LoggerI(" notification = " << m_notiHandle);
351 //clearDetailInfos();
355 LoggerI(" service = " << m_service);
356 if (m_service != NULL)
358 service_destroy(m_service);
362 if (notification_free(m_notiHandle) != NOTIFICATION_ERROR_NONE)
364 throw UnknownException("notification free failed...");
371 int StatusNotification::getID()
373 int id = -1; // notification not inserted yet.
376 notification_get_id(m_notiHandle, NULL, &id);
382 std::string StatusNotification::getStatusType()
386 if ( NOTI_TYPE_SIMPLE == getNotiType())
390 else if ( NOTI_TYPE_ONGOING == getNotiType())
394 else if ( NOTI_TYPE_PROGRESS == getNotiType())
398 else if ( NOTI_TYPE_THUMBNAIL == getNotiType())
409 void StatusNotification::setStatusType(std::string type)
411 LoggerI("type = " << type);
413 NotificationType notiType = NOTI_TYPE_NONE;
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;
424 throw InvalidValuesException("Invalid Status Type.");
426 LoggerI("Notification type = " << notiType);
427 setNotiType(notiType);
430 time_t StatusNotification::getPostedTime()
432 LoggerI("get m_notiHandle = " << m_notiHandle);
434 time_t postedTime = 0;
438 if (notification_get_insert_time(m_notiHandle, &postedTime) != NOTIFICATION_ERROR_NONE)
440 throw UnknownException("get notification posted time error");
444 LoggerI("posted Time =" << ctime(&postedTime));
448 std::string StatusNotification::getTitle()
454 if (notification_get_text(m_notiHandle,NOTIFICATION_TEXT_TYPE_TITLE, &title) != NOTIFICATION_ERROR_NONE)
456 throw UnknownException("get notification title error");
459 std::string notiTitle(title);
464 throw UnknownException("notification handle is null");
468 void StatusNotification::setTitle(std::string title)
470 LoggerI("Title : " << title);
473 LoggerI("get Title : " << getTitle());
474 if((getTitle()).compare(title)) //different value.
476 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, title.c_str(),
477 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
479 throw UnknownException("set notification title error");
482 setUpdatedFlag(true);
486 LoggerI(" title = " << title << " getTitle = " << getTitle());
491 LoggerD("noti Handle is NULL");
492 throw UnknownException("notification handle is null");
496 std::string StatusNotification::getContent()
498 LoggerI("get Content handle: " << m_notiHandle);
501 char *content = NULL;
503 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
505 throw UnknownException("get notification Content error");
508 std::string notiContent;
512 notiContent = content;
513 LoggerI(" get Content : " << content);
521 throw UnknownException("notification handle is null");
526 char* StatusNotification::getStrContent()
528 LoggerI("get Content handle: " << m_notiHandle);
531 char *content = NULL;
533 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
535 throw UnknownException("get notification Content error");
542 throw UnknownException("notification handle is null");
546 void StatusNotification::setContent(std::string content)
548 LoggerI("Content : " << content);
551 if((getContent()).compare(content)) //different value.
553 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, content.c_str(),
554 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
556 throw UnknownException("set notification content error");
558 setUpdatedFlag(true);
563 LoggerD("noti Handle is NULL");
564 throw UnknownException("notification handle is null");
568 std::string StatusNotification::getIconPath()
571 LoggerI("m_notiHandle = " << m_notiHandle);
574 char *iconPath = NULL;
575 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON, &iconPath) != NOTIFICATION_ERROR_NONE)
577 throw UnknownException("get notification icon path error");
580 std::string notiIconPath(iconPath);
581 LoggerI("icon Path = " << iconPath);
583 //if icon path invalid, return empty string.
584 if ( notiIconPath.find(DEFAULT_ICON_PATH,0) == std::string::npos)
588 return std::string(""); //return empty string.
593 throw UnknownException("notification handle is null");
597 void StatusNotification::setIconPath(const std::string& iconPath)
601 LoggerI("icon path = " << iconPath << " origin icon path = " << getIconPath());
602 if( getIconPath().compare(iconPath))
604 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON, iconPath.c_str()) != NOTIFICATION_ERROR_NONE)
606 throw UnknownException("set notification icon error");
608 setUpdatedFlag(true);
613 LoggerD("noti Handle is NULL");
614 throw UnknownException("notification handle is null");
618 std::string StatusNotification::getSoundPath()
620 LoggerI("Handle = " << m_notiHandle);
624 const char *soundPath = NULL;
625 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
627 if (notification_get_sound(m_notiHandle, &type, &soundPath) != NOTIFICATION_ERROR_NONE)
629 throw UnknownException("get notification sound error");
632 LoggerI(" sound type = " << type << " path = " << soundPath);
633 if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA )
635 LoggerI("soundPath = " << soundPath);
636 return std::string(soundPath);
640 return std::string("");
645 LoggerD("noti Handle is NULL");
646 throw UnknownException("notification handle is null");
650 void StatusNotification::setSoundPath(const std::string& sound)
654 LoggerI("sound path = " << sound << " origin sound path = " << getSoundPath());
656 if( getSoundPath().compare(sound))
658 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_USER_DATA, sound.c_str()) != NOTIFICATION_ERROR_NONE)
660 throw UnknownException("set notification sound error");
662 setUpdatedFlag(true);
667 LoggerI("sound path is NULL");
668 if ( NOTI_TYPE_ONGOING == getNotiType() || NOTI_TYPE_PROGRESS == getNotiType())
670 LoggerI("Ongoing Type" );
671 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_NONE, NULL) != NOTIFICATION_ERROR_NONE)
673 throw UnknownException("set notification sound error");
678 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_DEFAULT, sound.c_str()) != NOTIFICATION_ERROR_NONE)
680 throw UnknownException("set notification sound error");
688 LoggerD("noti Handle is NULL");
689 throw UnknownException("notification handle is null");
693 bool StatusNotification::getDefaultVibration()
695 LoggerI("getDefaultVibration");
698 notification_vibration_type_e vib_type;
699 if (notification_get_vibration(m_notiHandle, &vib_type, NULL) != NOTIFICATION_ERROR_NONE)
701 throw UnknownException("set notification sound error");
704 if (NOTIFICATION_VIBRATION_TYPE_DEFAULT == vib_type || NOTIFICATION_VIBRATION_TYPE_USER_DATA == vib_type)
715 LoggerD("noti Handle is NULL");
716 throw UnknownException("notification handle is null");
722 void StatusNotification::setDefaultVibration(const bool& vibration)
724 LoggerI("vibration = " << vibration);
727 notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
728 LoggerI("old vibration = " << getDefaultVibration());
729 if (getDefaultVibration() != vibration)
733 vib_type = NOTIFICATION_VIBRATION_TYPE_DEFAULT;
737 vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
739 LoggerI("type vibration type= " << vib_type);
741 if (notification_set_vibration(m_notiHandle, vib_type , NULL) != NOTIFICATION_ERROR_NONE)
743 throw UnknownException("set notification sound error");
745 setUpdatedFlag(true);
750 LoggerD("noti Handle is NULL");
751 throw UnknownException("notification handle is null");
756 DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplicationControl()
759 service_h service = NULL;
760 char *tempStr = NULL;
762 DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
767 appControl->setService_h(m_service);
769 if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE)
771 LoggerD("Operation Str = " << tempStr);
774 appControl->setOperation(tempStr);
781 if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE)
783 LoggerD("Mime Str = " << tempStr);
786 appControl->setMime(tempStr);
793 if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE)
795 LoggerD("Uri Str = " << tempStr);
798 appControl->setUri(tempStr);
804 if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE)
806 LoggerD("Category Str = " << tempStr);
809 appControl->setCategory(tempStr);
816 if ( service_foreach_extra_data(m_service, service_extra_data_cb,(void*)&appControl) != SERVICE_ERROR_NONE)
818 ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get notification service uri error");
825 Catch (WrtDeviceApis::Commons::Exception)
839 LoggerW(_rethrown_exception.GetMessage());
845 void StatusNotification::setApplicationControl(DeviceAPI::Application::ApplicationControlPtr control)
847 LoggerI("Entered m_service : " << m_service << " control : " << control);
849 //delete old service.
852 service_destroy(m_service);
856 if(service_create(&m_service) != SERVICE_ERROR_NONE)
858 throw UnknownException("service creation error");
862 LoggerI("getOperation : " << control->getOperation().c_str());
863 if (control->getOperation().size() != 0)
865 m_launchFlag = true; //default attribute
866 if (service_set_operation(m_service, control->getOperation().c_str()) != SERVICE_ERROR_NONE)
868 throw UnknownException("service set operation error");
873 LoggerI("getUri : " << control->getUri().c_str());
874 if (control->getUri().size() != 0)
876 if (service_set_uri(m_service, control->getUri().c_str() ) != SERVICE_ERROR_NONE)
878 throw UnknownException("service set uri error");
883 LoggerI("getMime : " << control->getMime().c_str());
884 if (control->getMime().size() != 0)
886 if (service_set_mime(m_service, control->getMime().c_str() ) != SERVICE_ERROR_NONE)
888 throw UnknownException("service set mime error");
892 LoggerI("Category : " << control->getCategory().c_str());
893 if (control->getCategory().size() != 0)
895 if (service_set_category(m_service, control->getCategory().c_str() ) != SERVICE_ERROR_NONE)
897 throw UnknownException("service set mime error");
902 if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE)
904 throw UnknownException("get notification service uri error");
907 std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = control->getAppControlDataArray();
910 LoggerI (" App Control Datas Count : " << appControlDataArray.size());
912 DeviceAPI::Application::ApplicationControlDataArray::iterator iter;
914 for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++)
916 DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter;
917 std::string key = appControlData->getKey();
918 LoggerI(" key : " << key);
923 std::vector<std::string> value = appControlDataArray[index]->getValue();
924 const char **arrayValue = (const char**)calloc(sizeof(char*), value.size());
926 for (size_t indexArray = 0; indexArray < value.size(); indexArray++)
928 arrayValue[indexArray] = (char*)value[indexArray].c_str();
929 LoggerI( " value : " << arrayValue[indexArray]);
932 const char* strKey = key.c_str();
933 LoggerI( " value size: " << value.size());
934 if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
936 throw UnknownException("service set extra data error");
944 bundle *bundle_data=NULL;
946 if(service_to_bundle(m_service, &bundle_data) != SERVICE_ERROR_NONE)
948 throw UnknownException("service get bundle");
951 LoggerD("bundle_data : " << bundle_data);
955 notification_set_execute_option(m_notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
956 NULL,NULL, bundle_data);
964 void StatusNotification::setApplicationId(const std::string& appId)
966 LoggerI("m_service = " << m_service << " appId = " << appId);
969 if (service_create(&m_service) != SERVICE_ERROR_NONE)
971 LoggerW("Create Service Failed..");
972 throw UnknownException("service creation error");
981 if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
983 throw UnknownException("service set appId error");
990 std::string StatusNotification::getApplicationId()
992 std::string retString;
993 char* appIdStr = NULL;
995 service_h service = NULL;
997 if (m_service != NULL)
1000 retcode = service_clone(&service, m_service);
1002 if (retcode != SERVICE_ERROR_NONE)
1004 if (retcode == SERVICE_ERROR_OUT_OF_MEMORY)
1006 LoggerW("SERVICE_ERROR_OUT_OF_MEMORY");
1010 LoggerW("UI_NOTIFICATION_ERROR_INVALID_PARAMETER");
1012 throw UnknownException ("get notification service error ");
1016 if (service == NULL)
1018 throw UnknownException ("get notification service ok, but service null");
1023 if (m_service != NULL)
1025 if (service_get_app_id(m_service, &appIdStr) != SERVICE_ERROR_NONE)
1027 throw UnknownException ("get a appId error");
1030 if (appIdStr != NULL)
1032 retString = appIdStr;
1042 double StatusNotification::getProgressValue()
1048 NotificationProgressType progressType = getProgressType();
1050 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1052 if (notification_get_size(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1054 throw UnknownException("get notification size error");
1056 LoggerI("Size Val = " << value);
1058 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1060 if (notification_get_progress(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1062 throw UnknownException("get notification percentage error");
1064 LoggerI("Percentage Val = " << value);
1068 throw UnknownException("get notification progress type error");
1073 LoggerD("noti Handle is NULL");
1075 LoggerI("value = " << value);
1080 void StatusNotification::setProgressValue(const double &progressValue)
1084 NotificationProgressType progressType = getProgressType();
1085 LoggerI("Progress Type : " << progressType);
1087 double val = getProgressValue();
1088 LoggerI("Progress value = " << progressValue << " origin Progress Value =" << val);
1090 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1092 if (notification_set_size(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1094 throw UnknownException("set notification progress size error");
1097 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1099 if (notification_set_progress(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1101 throw UnknownException("set notification percentage error");
1106 throw UnknownException("get notification progress type error");
1111 LoggerD("noti Handle is NULL");
1112 throw UnknownException( "notification handle is null");
1116 NotificationProgressType StatusNotification::getProgressType()
1118 return m_progressType;
1121 void StatusNotification::setProgressType(NotificationProgressType type)
1126 LoggerI(" NotificationProgressType = " << type);
1128 std::string progressType;
1130 if ( type == NOTI_PROGRESS_TYPE_PERCENTAGE)
1132 progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
1134 else if ( type == NOTI_PROGRESS_TYPE_SIZE)
1136 progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE;
1140 throw TypeMismatchException("Invalid Progress Type.");
1143 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_LIST_5, progressType.c_str()) != NOTIFICATION_ERROR_NONE)
1145 throw UnknownException("set notification sound error");
1148 m_progressType = type;
1152 LoggerD("noti Handle is NULL");
1153 throw UnknownException("notification handle is null");
1158 std::string StatusNotification::getSubIconPath()
1160 LoggerI("Handle = " << m_notiHandle);
1163 char *subIconPath = NULL;
1165 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON_SUB, &subIconPath) != NOTIFICATION_ERROR_NONE)
1167 throw UnknownException("get notification sub icon error");
1170 std::string notiSubIconPath;
1172 notiSubIconPath = subIconPath;
1173 return notiSubIconPath;
1177 throw UnknownException("notification handle is null");
1182 void StatusNotification::setSubIconPath(const std::string& subIconPath)
1186 LoggerI(" subIconPath = " << subIconPath << " origin SubIconPath = " << getSubIconPath());
1188 if( getSubIconPath().compare(subIconPath))
1190 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON_SUB, subIconPath.c_str()) != NOTIFICATION_ERROR_NONE)
1192 throw UnknownException("set notification sound error");
1194 setUpdatedFlag(true);
1199 LoggerD("noti Handle is NULL");
1200 throw UnknownException("notification handle is null");
1205 std::string StatusNotification::getInformation(int index)
1209 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1213 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1216 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1219 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1222 type = NOTIFICATION_TEXT_TYPE_NONE;
1226 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
1228 throw UnknownException("get notification information error");
1231 std::string strInfo;
1234 LoggerD(" info " << strInfo);
1240 LoggerD("noti Handle is NULL");
1241 throw UnknownException("notification handle is null");
1246 void StatusNotification::setInformation( const std::string& info, int index)
1252 LoggerD(" index : " << idx);
1253 LoggerD(" log : " << info);
1254 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1259 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1262 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1265 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1268 type = NOTIFICATION_TEXT_TYPE_NONE;
1271 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1273 if (getInformation(idx).compare(info))
1275 if (notification_set_text(m_notiHandle, type, info.c_str(),
1276 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1278 throw UnknownException("set notification sound error");
1280 setUpdatedFlag(true);
1286 LoggerD("noti Handle is NULL");
1287 throw UnknownException("notification handle is null");
1291 std::string StatusNotification::getSubInformation(int index)
1296 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1300 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1303 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1306 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1309 type = NOTIFICATION_TEXT_TYPE_NONE;
1312 char *subInfo = NULL;
1314 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
1316 throw UnknownException( "get notification sub information error");
1319 std::string strSubInfo;
1321 strSubInfo = subInfo;
1322 LoggerD(" subInfo " << strSubInfo);
1328 LoggerD("noti Handle is NULL");
1329 throw UnknownException( "notification handle is null");
1334 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
1339 LoggerD(" index : " << idx);
1340 LoggerD(" log : " << subInfo);
1341 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1346 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1349 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1352 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1355 type = NOTIFICATION_TEXT_TYPE_NONE;
1358 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1360 if (getSubInformation(idx).compare(subInfo))
1362 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
1363 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1365 throw UnknownException( "set notification sound error");
1367 setUpdatedFlag(true);
1373 LoggerD("noti Handle is NULL");
1374 throw UnknownException( "notification handle is null");
1380 void StatusNotification::loadThumbnails()
1384 if (!m_thumbs.empty())
1388 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_1, &thumb) != NOTIFICATION_ERROR_NONE)
1390 throw UnknownException( "get notification thumbnail error");
1393 m_thumbs.push_back(thumb);
1395 // m_thumbs.push_back(std::string("")); //set empty
1398 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_2, &thumb) != NOTIFICATION_ERROR_NONE)
1400 throw UnknownException( "get notification sub information error");
1403 m_thumbs.push_back(thumb);
1405 // m_thumbs.push_back(std::string("")); //set empty
1408 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_3, &thumb) != NOTIFICATION_ERROR_NONE)
1410 throw UnknownException( "get notification sub information error");
1414 m_thumbs.push_back(thumb);
1416 // m_thumbs.push_back(std::string("")); //set empty
1419 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_4, &thumb) != NOTIFICATION_ERROR_NONE)
1421 throw UnknownException( "get notification sub information error");
1425 m_thumbs.push_back(thumb);
1427 // m_thumbs.push_back(std::string("")); //set empty
1430 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_5, &thumb) != NOTIFICATION_ERROR_NONE)
1432 throw UnknownException( "get notification sub information error");
1436 m_thumbs.push_back(thumb);
1438 m_thumbs.push_back(std::string("")); //set empty
1445 LoggerD("noti Handle is NULL");
1446 throw UnknownException( "notification handle is null");
1450 std::vector<std::string> StatusNotification::getThumbnails()
1452 LoggerI(" thumbnail Size : " << m_thumbs.size());
1456 std::string StatusNotification::getThumbnail(int index)
1460 LoggerI(" index : " << index);
1462 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE;
1467 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1470 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1473 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1476 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1479 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1482 type = NOTIFICATION_IMAGE_TYPE_NONE;
1485 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1488 if (notification_get_image(m_notiHandle, type, &thumb) != NOTIFICATION_ERROR_NONE)
1490 throw UnknownException( "set notification thumbnail error");
1493 std::string thumbnail;
1500 throw UnknownException( "notification handle is null");
1506 LoggerD("noti Handle is NULL");
1507 throw UnknownException( "notification handle is null");
1510 if (m_thumbs.size() > index)
1511 return m_thumbs[index];
1513 return std::string("");
1518 void StatusNotification::setThumbnails(std::vector<std::string> thumbs)
1520 LoggerI("set thumbnails");
1523 std::vector<std::string>::iterator it;
1526 for (it = thumbs.begin(); it < thumbs.end(); ++it)
1528 std::string str = *it;
1529 if ( idx < MAX_THUMBNAIL_LENGTH )
1530 setThumbnail(str, idx); //set notification's thumbnail value.
1538 LoggerD("noti Handle is NULL");
1539 throw UnknownException( "notification handle is null");
1543 void StatusNotification::setThumbnail( const std::string& thumb, int index)
1547 LoggerI(" index : " << index);
1548 LoggerI(" thumb : " << thumb);
1549 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE;
1554 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1557 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1560 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1563 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1566 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1569 type = NOTIFICATION_IMAGE_TYPE_NONE;
1572 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1574 if (getThumbnail(index).compare(thumb))
1576 if (notification_set_image(m_notiHandle, type, thumb.c_str()) != NOTIFICATION_ERROR_NONE)
1578 throw UnknownException( "set notification thumbnail error");
1580 setUpdatedFlag(true);
1586 std::string StatusNotification::getBackground()
1588 LoggerI(" Handle : " << m_notiHandle);
1592 char *background = NULL;
1594 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, &background) != NOTIFICATION_ERROR_NONE)
1596 throw UnknownException( "get notification background error");
1599 std::string notiBackground;
1601 notiBackground = background;
1602 return notiBackground;
1606 LoggerD("noti Handle is NULL");
1607 throw UnknownException( "notification handle is null");
1612 void StatusNotification::setBackground(const std::string imagePath)
1614 LoggerI(" imagePath : " << imagePath);
1617 if (getBackground().compare(imagePath))
1619 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_BACKGROUND, imagePath.c_str()) != NOTIFICATION_ERROR_NONE)
1621 throw UnknownException( "set notification sound error");
1623 setUpdatedFlag(true);
1628 LoggerD("noti Handle is NULL");
1629 throw UnknownException( "notification handle is null");
1633 long StatusNotification::getNumber()
1635 LoggerI("Handle = " << m_notiHandle);
1639 char *strNumber = NULL;
1641 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1643 throw UnknownException( "get notification background error");
1647 std::istringstream(strNumber) >> number;
1649 LoggerI("Number Is NULL");
1651 LoggerI("number = " << number);
1657 LoggerD("noti Handle is NULL");
1662 const char* StatusNotification::getStrNumber()
1664 LoggerI("Handle = " << m_notiHandle);
1667 char *strNumber = NULL;
1669 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1671 throw UnknownException( "get notification background error");
1683 LoggerD("noti Handle is NULL");
1688 void StatusNotification::setNumber(const long number)
1690 LoggerI("Number = " << number);
1693 if(number!=getNumber())
1695 std::stringstream stream;
1697 if (stream.fail()) {
1698 throw UnknownException(
1699 "Couldn't convert notification number");
1702 std::string strNumber = stream.str();
1703 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, strNumber.c_str(),
1704 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1706 throw UnknownException( "set notification text error");
1708 setUpdatedFlag(true);
1713 LoggerD("noti Handle is NULL");
1714 throw UnknownException( "notification handle is null");
1718 void* StatusNotification::getNotificationHandle()
1720 return m_notiHandle;
1723 void StatusNotification::setNotificationHandle(void *handle)
1727 throw UnknownException( "notification handle null error");
1729 LoggerI("handle = " << handle << " m_notiHandle = " << m_notiHandle);
1731 if (m_notiHandle != NULL)
1734 if ( notification_delete(m_notiHandle) != NOTIFICATION_ERROR_NONE)
1736 throw UnknownException( "notification delete error");
1738 m_notiHandle = NULL;
1741 m_notiHandle = (notification_h)handle;
1744 service_h StatusNotification::getService()
1749 std::string StatusNotification::getLight()
1751 LoggerI("get Light handle: " << m_notiHandle);
1755 notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1756 if (notification_get_led(m_notiHandle, &type, &ledColor) != NOTIFICATION_ERROR_NONE)
1758 throw UnknownException("get notification Content error");
1761 std::stringstream stream;
1762 if (NOTIFICATION_LED_OP_OFF != type)
1764 stream << std::hex << ledColor;
1765 light = "#" + stream.str();
1768 return boost::to_lower_copy(light);
1772 throw UnknownException("notification handle is null");
1776 bool StatusNotification::isColorFormatNumberic(std::string& color)
1778 //first check length
1779 std::string hexCode = "0123456789abcdef";
1780 if (color.length() == 7 && !color.compare(0, 1, "#") )
1782 for ( int i = 1 ; i < color.length() ; i++)
1784 if (std::string::npos == hexCode.find(color[i]))
1792 void StatusNotification::setLight(std::string color)
1794 LoggerI("set Light handle: " << m_notiHandle);
1795 LoggerI("led Color : " << color);
1798 color = boost::to_lower_copy(color); //convert lowercase.
1799 if ( isColorFormatNumberic(color))
1801 std::stringstream stream;
1803 notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1804 std::string colorCode = color.substr(1, color.length());
1806 stream << std::hex << colorCode;
1807 LoggerI("LedColor = " << stream.str());
1809 LoggerI("LedColor = " << ledColor);
1812 type = NOTIFICATION_LED_OP_ON_CUSTOM_COLOR;
1814 type = NOTIFICATION_LED_OP_OFF;
1816 if (notification_set_led(m_notiHandle, type, ledColor) != NOTIFICATION_ERROR_NONE)
1818 throw UnknownException("set notification led ");
1824 LoggerI("color.length()=" << color.length());
1825 if (color.length() == 0)
1827 if (notification_set_led(m_notiHandle, NOTIFICATION_LED_OP_OFF, NULL) != NOTIFICATION_ERROR_NONE)
1829 throw UnknownException("set notification led ");
1834 throw InvalidValuesException("color code error!");
1840 throw UnknownException("notification handle is null");
1844 unsigned long StatusNotification::getLightOnTime()
1846 LoggerI("get Light on Time handle: " << m_notiHandle);
1852 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1854 throw UnknownException("set notification led ");
1856 LoggerI("onTime " << onTime);
1858 return (unsigned long) onTime;
1862 throw UnknownException("notification handle is null");
1866 void StatusNotification::setLightOnTime(unsigned long time)
1868 LoggerI("set Light on Time handle: " << m_notiHandle);
1869 LoggerI("itme = " << time);
1872 int offTime = getLightOffTime();
1874 if (notification_set_led_time_period(m_notiHandle, time, offTime ) != NOTIFICATION_ERROR_NONE)
1876 throw UnknownException("set notification led ");
1882 throw UnknownException("notification handle is null");
1886 unsigned long StatusNotification::getLightOffTime()
1889 LoggerI("get Light on Time handle: " << m_notiHandle);
1895 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1897 throw UnknownException("set notification led ");
1899 LoggerI("offTime " << offTime);
1905 throw UnknownException("notification handle is null");
1910 void StatusNotification::setLightOffTime(unsigned long time)
1912 LoggerI("set Light off Time handle: " << m_notiHandle);
1913 LoggerI("time = " << time);
1916 int onTime = getLightOnTime();
1918 if (notification_set_led_time_period(m_notiHandle, onTime, time ) != NOTIFICATION_ERROR_NONE)
1920 throw UnknownException("set notification led ");
1925 throw UnknownException("notification handle is null");
1930 void StatusNotification::loadDetailInfos()
1932 LoggerI("noti Handle = " << m_notiHandle);
1936 for ( int idx = 0; idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH; idx++)
1938 std::string main = getInformation(idx);
1939 std::string sub = getSubInformation(idx);
1940 LoggerI("Main : " << main << " Sub : " << sub);
1941 NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub);
1942 m_detailInfos.push_back(info);
1947 LoggerD("noti Handle is NULL");
1948 throw UnknownException( "notification handle is null");
1953 std::vector<NotificationDetailInfo*> StatusNotification::getDetailInfos() const
1955 return m_detailInfos;
1958 void StatusNotification::setDetailInfos(const std::vector<NotificationDetailInfo*> value)
1960 LoggerI("DetailInfos = " << value.size());
1964 std::vector<NotificationDetailInfo*>::const_iterator it;
1967 for (it = value.begin(); it < value.end(); ++it)
1969 NotificationDetailInfo* info = *it;
1970 if ( idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH )
1972 LoggerI("main " << info->getMainText() << " sub " << info->getSubText() );
1973 setInformation(info->getMainText(), idx);
1974 setSubInformation(info->getSubText(), idx);
1979 m_detailInfos = value;
1983 LoggerD("noti Handle is NULL");
1984 throw UnknownException( "notification handle is null");
1989 int StatusNotification::getDetailInfosNum() const
1991 return m_detailInfos.size();
1994 void StatusNotification::clearDetailInfos()
1996 if ( !m_detailInfos.empty() )
1998 std::vector<NotificationDetailInfo*>::const_iterator it;
2001 for (it = m_detailInfos.begin(); it < m_detailInfos.end(); ++it)
2003 NotificationDetailInfo* info = *it;
2004 LoggerI("Delete Detail Info : " << info);
2009 m_detailInfos.clear(); //clear
2013 std::string StatusNotification::getInformation(int index)
2017 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2021 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2024 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2027 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2030 type = NOTIFICATION_TEXT_TYPE_NONE;
2034 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
2036 throw UnknownException("Detail Info index value is invalid or mainText value getting is failed in Detail Info.");
2039 std::string strInfo;
2042 LoggerI(" info " << strInfo);
2048 LoggerW("noti Handle is NULL");
2049 throw UnknownException( "notification handle is null");
2054 std::string StatusNotification::getSubInformation(int index)
2058 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2062 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2065 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2068 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2071 type = NOTIFICATION_TEXT_TYPE_NONE;
2074 char *subInfo = NULL;
2076 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
2078 throw UnknownException("Detail Info index value is invalid or subText value getting is failed in Detail Info.");
2081 std::string strSubInfo;
2083 strSubInfo = subInfo;
2084 LoggerI(" subInfo " << strSubInfo);
2090 LoggerW("noti Handle is NULL");
2091 throw UnknownException ("notification handle is null");
2096 void StatusNotification::setInformation( const std::string& info, int index)
2101 LoggerD(" index : " << idx);
2102 LoggerD(" log : " << info);
2103 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2108 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2111 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2114 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2117 type = NOTIFICATION_TEXT_TYPE_NONE;
2120 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2122 if (getInformation(idx).compare(info))
2124 if (notification_set_text(m_notiHandle, type, info.c_str(),
2125 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2127 throw UnknownException("set notification sound error");
2129 setUpdatedFlag(true);
2134 LoggerW("noti Handle is NULL");
2135 throw UnknownException("notification handle is null");
2140 LoggerW("noti Handle is NULL");
2141 throw UnknownException("notification handle is null");
2145 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
2151 LoggerD(" index : " << idx);
2152 LoggerD(" log : " << subInfo);
2153 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2158 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2161 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2164 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2167 type = NOTIFICATION_TEXT_TYPE_NONE;
2170 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2172 if (getSubInformation(idx).compare(subInfo))
2174 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
2175 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2177 throw UnknownException("set notification sound error");
2179 setUpdatedFlag(true);
2185 LoggerW("noti Handle is NULL");
2186 throw UnknownException("notification handle is null");