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>
23 #include "StatusNotification.h"
26 namespace Notification {
28 #define DEFAULT_ICON_PATH "/opt/share/icons/default/"
29 #define MAX_NOTIFICATION_DETAIL_INFO_LENGTH 2
30 #define MAX_THUMBNAIL_LENGTH 4
32 extern "C" int service_create_event(bundle *data, struct service_s **service);
33 //tern "C" int service_to_bundle(service_h service, bundle **data);
36 static bool service_extra_data_cb(service_h service, const char *key, void *user_data)
42 if (user_data != NULL && key != NULL)
44 LoggerI("user data & key is existed");
46 DeviceAPI::Application::ApplicationControlPtr* appControl =
47 (DeviceAPI::Application::ApplicationControlPtr*)(user_data);
49 DeviceAPI::Application::ApplicationControlDataPtr data(new DeviceAPI::Application::ApplicationControlData());
50 LoggerI("key = " << key);
51 std::string keyStr = key;
52 std::vector<std::string> keyValue;
55 if (service_get_extra_data_array((*appControl)->getService_h(), key, &value, &length) == SERVICE_ERROR_NONE)
57 LoggerI("extra_data_array length = " << length);
59 if (value != NULL && length != 0)
61 LoggerI("extra_data_length = " << length);
63 for (index = 0; index < length; index++)
65 LoggerI("Value=" << value[index]);
66 keyValue.push_back(value[index]);
69 data->setValue(keyValue);
70 (*appControl)->addAppControlData(data);
81 static bool service_extra_data_delete_cb(service_h service, const char *key, void *user_data)
86 LoggerI("del key = " << key);
88 if (service_remove_extra_data(service, key) != SERVICE_ERROR_NONE)
90 LoggerW("remove extra data failed");
98 StatusNotification::StatusNotification(NotificationType statusType) :
99 m_notiType(NOTI_TYPE_NONE),
102 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
103 m_notiUpdated(false),
106 LoggerI("statusType =" << statusType);
108 notification_type_e type = NOTIFICATION_TYPE_NONE;
109 setNotiType(statusType);
111 if (statusType == NOTI_TYPE_SIMPLE || statusType == NOTI_TYPE_MUTIPLE || statusType == NOTI_TYPE_THUMBNAIL)
113 type = NOTIFICATION_TYPE_NOTI;
115 else if ( statusType == NOTI_TYPE_ONGOING || statusType == NOTI_TYPE_PROGRESS)
117 type = NOTIFICATION_TYPE_ONGOING;
121 LoggerI(" invalide noti type");
122 throw TypeMismatchException("value is not notification type");
125 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default
127 LoggerI("Notification Type : " << type);
129 notification_h noti = notification_create(type); //create notificatin.
132 LoggerI("noti =" << noti);
133 setNotificationHandle((void*)noti);
135 if (NOTIFICATION_TYPE_ONGOING == type)
136 { //ongoing no ticker.
137 LoggerI("ongoing type");
138 if ( NOTIFICATION_ERROR_NONE != notification_set_display_applist(noti, NOTIFICATION_DISPLAY_APP_NOTIFICATION_TRAY |NOTIFICATION_DISPLAY_APP_INDICATOR ))
140 throw UnknownException("can't set notification display applist");
147 throw UnknownException("can't make new notification object");
150 //m_detailInfos = new std::vector<NotificationDetailInfo*>();
151 //m_thumbs = new std::vector<std::string>();
155 StatusNotification::StatusNotification(void* noti) :
156 m_notiType(NOTI_TYPE_NONE),
159 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
160 m_notiUpdated(false),
163 LoggerI("noti : " << noti);
165 notification_h notification = (notification_h)noti;
169 NotificationType type = NOTI_TYPE_NONE;
170 notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
171 notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
173 notification_get_type(notification, ¬i_type);
174 notification_get_layout(notification, ¬i_layout);
177 if ( noti_type == NOTIFICATION_TYPE_NOTI )
179 if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE ||
180 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
182 type = NOTI_TYPE_SIMPLE;
184 else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
186 type = NOTI_TYPE_THUMBNAIL;
189 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
191 if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
193 type = NOTI_TYPE_ONGOING;
195 else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
197 type = NOTI_TYPE_PROGRESS;
201 LoggerI(" notification type =" << type);
203 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default.
204 //read Progress type value.
205 char *strProgressType = NULL;
206 if (NOTIFICATION_ERROR_NONE == notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_LIST_5, &strProgressType))
208 if ( strProgressType )
210 std::string notiProgressType(strProgressType);
211 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
212 m_progressType = NOTI_PROGRESS_TYPE_SIZE;
216 setNotificationHandle((void*)notification);
221 if ( type == NOTI_TYPE_PROGRESS)
223 notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
229 int ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc);
230 LoggerI("ret = " << ret);
231 if (ret == NOTIFICATION_ERROR_NONE)
233 LoggerI(" bundle = " << bSvc);
236 LoggerI("bundle is valid");
237 int ret = service_create_event(bSvc, &m_service);
238 if (ret != SERVICE_ERROR_NONE)
240 LoggerI("Service Create Event Error");
241 throw UnknownException("can't make service object");
247 notification_free(notification);
248 throw UnknownException("can't get service data");
254 throw InvalidValuesException("It is not notification object.");
259 StatusNotification::StatusNotification(int privID) :
260 m_notiType(NOTI_TYPE_NONE),
263 m_progressType(NOTI_PROGRESS_TYPE_PERCENTAGE),
264 m_notiUpdated(false),
267 LoggerI("priv ID : " << privID);
269 notification_h notification = notification_load( NULL, privID); //load notification.
270 LoggerI(" notification " << notification);
274 NotificationType type = NOTI_TYPE_NONE;
275 notification_type_e noti_type = NOTIFICATION_TYPE_NONE;
276 notification_ly_type_e noti_layout = NOTIFICATION_LY_NONE;
278 notification_get_type(notification, ¬i_type);
279 notification_get_layout(notification, ¬i_layout);
281 if ( noti_type == NOTIFICATION_TYPE_NOTI )
283 if ( noti_layout == NOTIFICATION_LY_NOTI_EVENT_SINGLE ||
284 noti_layout == NOTIFICATION_LY_NOTI_EVENT_MULTIPLE )
286 type = NOTI_TYPE_SIMPLE;
288 else if (noti_layout == NOTIFICATION_LY_NOTI_THUMBNAIL)
290 type = NOTI_TYPE_THUMBNAIL;
293 else if ( noti_type == NOTIFICATION_TYPE_ONGOING)
295 if ( noti_layout == NOTIFICATION_LY_ONGOING_EVENT )
297 type = NOTI_TYPE_ONGOING;
299 else if ( noti_layout == NOTIFICATION_LY_ONGOING_PROGRESS)
301 type = NOTI_TYPE_PROGRESS;
305 LoggerI(" notification type =" << type);
307 //setProgressType(NOTI_PROGRESS_TYPE_PERCENTAGE); //default.
308 //read Progress type value.
309 char *strProgressType = NULL;
310 if (NOTIFICATION_ERROR_NONE == notification_get_image(notification, NOTIFICATION_IMAGE_TYPE_LIST_5, &strProgressType))
312 if ( strProgressType )
314 std::string notiProgressType(strProgressType);
315 if( notiProgressType.compare(TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE) == 0)
316 m_progressType = NOTI_PROGRESS_TYPE_SIZE;
320 setNotificationHandle((void*)notification);
324 if ( type == NOTI_TYPE_PROGRESS)
326 notification_update_progress(notification, NOTIFICATION_PRIV_ID_NONE, getProgressValue());
332 int ret = notification_get_execute_option(notification, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH, NULL, &bSvc);
333 LoggerI("ret = " << ret);
334 if (ret == NOTIFICATION_ERROR_NONE)
336 LoggerI(" bundle = " << bSvc);
339 LoggerI("bundle is valid");
340 int ret = service_create_event(bSvc, &m_service);
341 if (ret != SERVICE_ERROR_NONE)
343 LoggerI("Service Create Event Error");
344 throw UnknownException("can't make service object");
350 notification_free(notification);
351 throw UnknownException("can't get service data");
357 throw NotFoundException("It is not notification ID or removed notification");
362 StatusNotification::~StatusNotification()
364 LoggerI(" notification = " << m_notiHandle);
367 //clearDetailInfos();
371 LoggerI(" service = " << m_service);
372 if (m_service != NULL)
374 service_destroy(m_service);
378 if (notification_free(m_notiHandle) != NOTIFICATION_ERROR_NONE)
380 throw UnknownException("notification free failed...");
387 int StatusNotification::getID()
389 int id = -1; // notification not inserted yet.
392 notification_get_id(m_notiHandle, NULL, &id);
398 std::string StatusNotification::getStatusType()
402 if ( NOTI_TYPE_SIMPLE == getNotiType())
406 else if ( NOTI_TYPE_ONGOING == getNotiType())
410 else if ( NOTI_TYPE_PROGRESS == getNotiType())
414 else if ( NOTI_TYPE_THUMBNAIL == getNotiType())
425 void StatusNotification::setStatusType(std::string type)
427 LoggerI("type = " << type);
429 NotificationType notiType = NOTI_TYPE_NONE;
431 if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_SIMPLE) == 0)
432 notiType = NOTI_TYPE_SIMPLE;
433 else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_THUMBNAIL) == 0)
434 notiType = NOTI_TYPE_THUMBNAIL;
435 else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_ONGOING) == 0)
436 notiType = NOTI_TYPE_ONGOING;
437 else if( type.compare(TIZEN_STATUS_NOTIFICATION_TYPE_PROGRESS) == 0)
438 notiType = NOTI_TYPE_PROGRESS;
440 throw InvalidValuesException("Invalid Status Type.");
442 LoggerI("Notification type = " << notiType);
443 setNotiType(notiType);
446 time_t StatusNotification::getPostedTime()
448 LoggerI("get m_notiHandle = " << m_notiHandle);
450 time_t postedTime = 0;
454 if (notification_get_insert_time(m_notiHandle, &postedTime) != NOTIFICATION_ERROR_NONE)
456 throw UnknownException("get notification posted time error");
460 LoggerI("posted Time =" << ctime(&postedTime));
464 std::string StatusNotification::getTitle()
470 if (notification_get_text(m_notiHandle,NOTIFICATION_TEXT_TYPE_TITLE, &title) != NOTIFICATION_ERROR_NONE)
472 throw UnknownException("get notification title error");
475 std::string notiTitle(title);
480 throw UnknownException("notification handle is null");
484 void StatusNotification::setTitle(std::string title)
486 LoggerI("Title : " << title);
489 LoggerI("get Title : " << getTitle());
490 if((getTitle()).compare(title)) //different value.
492 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_TITLE, title.c_str(),
493 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
495 throw UnknownException("set notification title error");
498 setUpdatedFlag(true);
502 LoggerI(" title = " << title << " getTitle = " << getTitle());
507 LoggerD("noti Handle is NULL");
508 throw UnknownException("notification handle is null");
513 std::string StatusNotification::getContent()
515 LoggerI("get Content handle: " << m_notiHandle);
518 char *content = NULL;
520 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
522 throw UnknownException("get notification Content error");
525 std::string notiContent;
529 notiContent = content;
530 LoggerI(" get Content : " << content);
538 throw UnknownException("notification handle is null");
543 char* StatusNotification::getStrContent()
545 LoggerI("get Content handle: " << m_notiHandle);
548 char *content = NULL;
550 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, &content) != NOTIFICATION_ERROR_NONE)
552 throw UnknownException("get notification Content error");
559 throw UnknownException("notification handle is null");
563 void StatusNotification::setContent(std::string content)
565 LoggerI("Content : " << content);
568 if((getContent()).compare(content)) //different value.
570 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_CONTENT, content.c_str(),
571 NULL, NOTIFICATION_VARIABLE_TYPE_NONE ) != NOTIFICATION_ERROR_NONE)
573 throw UnknownException("set notification content error");
575 setUpdatedFlag(true);
580 LoggerD("noti Handle is NULL");
581 throw UnknownException("notification handle is null");
585 std::string StatusNotification::getIconPath()
588 LoggerI("m_notiHandle = " << m_notiHandle);
591 char *iconPath = NULL;
592 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON, &iconPath) != NOTIFICATION_ERROR_NONE)
594 throw UnknownException("get notification icon path error");
597 std::string notiIconPath(iconPath);
598 LoggerI("icon Path = " << iconPath);
600 //if icon path invalid, return empty string.
601 if ( notiIconPath.find(DEFAULT_ICON_PATH,0) == std::string::npos)
605 return std::string(""); //return empty string.
610 throw UnknownException("notification handle is null");
614 void StatusNotification::setIconPath(const std::string& iconPath)
618 LoggerI("icon path = " << iconPath << " origin icon path = " << getIconPath());
619 if( getIconPath().compare(iconPath))
621 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON, iconPath.c_str()) != NOTIFICATION_ERROR_NONE)
623 throw UnknownException("set notification icon error");
625 setUpdatedFlag(true);
630 LoggerD("noti Handle is NULL");
631 throw UnknownException("notification handle is null");
635 std::string StatusNotification::getSoundPath()
637 LoggerI("Handle = " << m_notiHandle);
641 const char *soundPath = NULL;
642 notification_sound_type_e type = NOTIFICATION_SOUND_TYPE_NONE;
644 if (notification_get_sound(m_notiHandle, &type, &soundPath) != NOTIFICATION_ERROR_NONE)
646 throw UnknownException("get notification sound error");
649 LoggerI(" sound type = " << type << " path = " << soundPath);
650 if ( type == NOTIFICATION_SOUND_TYPE_USER_DATA )
652 LoggerI("soundPath = " << soundPath);
653 return std::string(soundPath);
657 return std::string("");
662 LoggerD("noti Handle is NULL");
663 throw UnknownException("notification handle is null");
667 void StatusNotification::setSoundPath(const std::string& sound)
671 LoggerI("sound path = " << sound << " origin sound path = " << getSoundPath());
673 if( getSoundPath().compare(sound))
675 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_USER_DATA, sound.c_str()) != NOTIFICATION_ERROR_NONE)
677 throw UnknownException("set notification sound error");
679 setUpdatedFlag(true);
684 LoggerI("sound path is NULL");
685 if ( NOTI_TYPE_ONGOING == getNotiType() || NOTI_TYPE_PROGRESS == getNotiType())
687 LoggerI("Ongoing Type" );
688 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_NONE, NULL) != NOTIFICATION_ERROR_NONE)
690 throw UnknownException("set notification sound error");
695 if (notification_set_sound(m_notiHandle,NOTIFICATION_SOUND_TYPE_DEFAULT, sound.c_str()) != NOTIFICATION_ERROR_NONE)
697 throw UnknownException("set notification sound error");
705 LoggerD("noti Handle is NULL");
706 throw UnknownException("notification handle is null");
710 bool StatusNotification::getDefaultVibration()
712 LoggerI("getDefaultVibration");
715 notification_vibration_type_e vib_type;
716 if (notification_get_vibration(m_notiHandle, &vib_type, NULL) != NOTIFICATION_ERROR_NONE)
718 throw UnknownException("set notification sound error");
721 if (NOTIFICATION_VIBRATION_TYPE_DEFAULT == vib_type || NOTIFICATION_VIBRATION_TYPE_USER_DATA == vib_type)
732 LoggerD("noti Handle is NULL");
733 throw UnknownException("notification handle is null");
739 void StatusNotification::setDefaultVibration(const bool& vibration)
741 LoggerI("vibration = " << vibration);
744 notification_vibration_type_e vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
745 LoggerI("old vibration = " << getDefaultVibration());
746 if (getDefaultVibration() != vibration)
750 vib_type = NOTIFICATION_VIBRATION_TYPE_DEFAULT;
754 vib_type = NOTIFICATION_VIBRATION_TYPE_NONE;
756 LoggerI("type vibration type= " << vib_type);
758 if (notification_set_vibration(m_notiHandle, vib_type , NULL) != NOTIFICATION_ERROR_NONE)
760 throw UnknownException("set notification sound error");
762 setUpdatedFlag(true);
767 LoggerD("noti Handle is NULL");
768 throw UnknownException("notification handle is null");
773 DeviceAPI::Application::ApplicationControlPtr StatusNotification::getApplicationControl()
776 service_h service = NULL;
777 char *tempStr = NULL;
779 DeviceAPI::Application::ApplicationControlPtr appControl(new DeviceAPI::Application::ApplicationControl());
784 appControl->setService_h(m_service);
786 if(service_get_operation(m_service, &tempStr) == SERVICE_ERROR_NONE)
788 LoggerD("Operation Str = " << tempStr);
791 appControl->setOperation(tempStr);
798 if (service_get_mime(m_service, &tempStr) == SERVICE_ERROR_NONE)
800 LoggerD("Mime Str = " << tempStr);
803 appControl->setMime(tempStr);
810 if (service_get_uri(m_service, &tempStr) == SERVICE_ERROR_NONE)
812 LoggerD("Uri Str = " << tempStr);
815 appControl->setUri(tempStr);
821 if (service_get_category(m_service, &tempStr) == SERVICE_ERROR_NONE)
823 LoggerD("Category Str = " << tempStr);
826 appControl->setCategory(tempStr);
833 if ( service_foreach_extra_data(m_service, service_extra_data_cb,(void*)&appControl) != SERVICE_ERROR_NONE)
835 ThrowMsg(WrtDeviceApis::Commons::UnknownException, "get notification service uri error");
842 Catch (WrtDeviceApis::Commons::Exception)
856 LoggerW(_rethrown_exception.GetMessage());
862 void StatusNotification::setApplicationControl(DeviceAPI::Application::ApplicationControlPtr control)
864 LoggerI("Entered m_service : " << m_service << " control : " << control);
866 //delete old service.
869 service_destroy(m_service);
873 if(service_create(&m_service) != SERVICE_ERROR_NONE)
875 throw UnknownException("service creation error");
879 LoggerI("getOperation : " << control->getOperation().c_str());
880 if (control->getOperation().size() != 0)
882 m_launchFlag = true; //default attribute
883 if (service_set_operation(m_service, control->getOperation().c_str()) != SERVICE_ERROR_NONE)
885 throw UnknownException("service set operation error");
890 LoggerI("getUri : " << control->getUri().c_str());
891 if (control->getUri().size() != 0)
893 if (service_set_uri(m_service, control->getUri().c_str() ) != SERVICE_ERROR_NONE)
895 throw UnknownException("service set uri error");
900 LoggerI("getMime : " << control->getMime().c_str());
901 if (control->getMime().size() != 0)
903 if (service_set_mime(m_service, control->getMime().c_str() ) != SERVICE_ERROR_NONE)
905 throw UnknownException("service set mime error");
909 LoggerI("Category : " << control->getCategory().c_str());
910 if (control->getCategory().size() != 0)
912 if (service_set_category(m_service, control->getCategory().c_str() ) != SERVICE_ERROR_NONE)
914 throw UnknownException("service set mime error");
919 if ( service_foreach_extra_data(m_service, service_extra_data_delete_cb, NULL) != SERVICE_ERROR_NONE)
921 throw UnknownException("get notification service uri error");
924 std::vector<DeviceAPI::Application::ApplicationControlDataPtr> appControlDataArray = control->getAppControlDataArray();
927 LoggerI (" App Control Datas Count : " << appControlDataArray.size());
929 DeviceAPI::Application::ApplicationControlDataArray::iterator iter;
931 for(iter = appControlDataArray.begin(); iter != appControlDataArray.end(); iter++)
933 DeviceAPI::Application::ApplicationControlDataPtr appControlData = *iter;
934 std::string key = appControlData->getKey();
935 LoggerI(" key : " << key);
940 std::vector<std::string> value = appControlDataArray[index]->getValue();
941 const char **arrayValue = (const char**)calloc(sizeof(char*), value.size());
943 for (size_t indexArray = 0; indexArray < value.size(); indexArray++)
945 arrayValue[indexArray] = (char*)value[indexArray].c_str();
946 LoggerI( " value : " << arrayValue[indexArray]);
949 const char* strKey = key.c_str();
950 LoggerI( " value size: " << value.size());
951 if (service_add_extra_data_array(m_service, strKey, arrayValue, value.size()) != SERVICE_ERROR_NONE)
953 throw UnknownException("service set extra data error");
961 bundle *bundle_data=NULL;
963 if(service_to_bundle(m_service, &bundle_data) != SERVICE_ERROR_NONE)
965 throw UnknownException("service get bundle");
968 LoggerD("bundle_data : " << bundle_data);
972 notification_set_execute_option(m_notiHandle, NOTIFICATION_EXECUTE_TYPE_SINGLE_LAUNCH,
973 NULL,NULL, bundle_data);
981 void StatusNotification::setApplicationId(const std::string& appId)
983 LoggerI("m_service = " << m_service << " appId = " << appId);
986 if (service_create(&m_service) != SERVICE_ERROR_NONE)
988 LoggerW("Create Service Failed..");
989 throw UnknownException("service creation error");
998 if (service_set_app_id(m_service, appId.c_str())!= SERVICE_ERROR_NONE)
1000 throw UnknownException("service set appId error");
1007 std::string StatusNotification::getApplicationId()
1009 std::string retString;
1010 char* appIdStr = NULL;
1012 service_h service = NULL;
1014 if (m_service != NULL)
1017 retcode = service_clone(&service, m_service);
1019 if (retcode != SERVICE_ERROR_NONE)
1021 if (retcode == SERVICE_ERROR_OUT_OF_MEMORY)
1023 LoggerW("SERVICE_ERROR_OUT_OF_MEMORY");
1027 LoggerW("UI_NOTIFICATION_ERROR_INVALID_PARAMETER");
1029 throw UnknownException ("get notification service error ");
1033 if (service == NULL)
1035 throw UnknownException ("get notification service ok, but service null");
1040 if (m_service != NULL)
1042 if (service_get_app_id(m_service, &appIdStr) != SERVICE_ERROR_NONE)
1044 throw UnknownException ("get a appId error");
1047 if (appIdStr != NULL)
1049 retString = appIdStr;
1059 double StatusNotification::getProgressValue()
1065 NotificationProgressType progressType = getProgressType();
1067 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1069 if (notification_get_size(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1071 throw UnknownException("get notification size error");
1073 LoggerI("Size Val = " << value);
1075 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1077 if (notification_get_progress(m_notiHandle, &value) != NOTIFICATION_ERROR_NONE)
1079 throw UnknownException("get notification percentage error");
1081 LoggerI("Percentage Val = " << value);
1085 throw UnknownException("get notification progress type error");
1090 LoggerD("noti Handle is NULL");
1092 LoggerI("value = " << value);
1097 void StatusNotification::setProgressValue(const double &progressValue)
1101 NotificationProgressType progressType = getProgressType();
1102 LoggerI("Progress Type : " << progressType);
1104 double val = getProgressValue();
1105 LoggerI("Progress value = " << progressValue << " origin Progress Value =" << val);
1107 if (progressType == NOTI_PROGRESS_TYPE_SIZE)
1109 if (notification_set_size(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1111 throw UnknownException("set notification progress size error");
1114 else if ( progressType == NOTI_PROGRESS_TYPE_PERCENTAGE )
1116 if (notification_set_progress(m_notiHandle, progressValue) != NOTIFICATION_ERROR_NONE)
1118 throw UnknownException("set notification percentage error");
1123 throw UnknownException("get notification progress type error");
1128 LoggerD("noti Handle is NULL");
1129 throw UnknownException( "notification handle is null");
1133 NotificationProgressType StatusNotification::getProgressType()
1135 return m_progressType;
1138 void StatusNotification::setProgressType(NotificationProgressType type)
1143 LoggerI(" NotificationProgressType = " << type);
1145 std::string progressType;
1147 if ( type == NOTI_PROGRESS_TYPE_PERCENTAGE)
1149 progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_PERCENTAGE;
1151 else if ( type == NOTI_PROGRESS_TYPE_SIZE)
1153 progressType = TIZEN_NOTIFICATION_PROGRESS_TYPE_BYTE;
1157 throw TypeMismatchException("Invalid Progress Type.");
1160 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_LIST_5, progressType.c_str()) != NOTIFICATION_ERROR_NONE)
1162 throw UnknownException("set notification sound error");
1165 m_progressType = type;
1169 LoggerD("noti Handle is NULL");
1170 throw UnknownException("notification handle is null");
1175 std::string StatusNotification::getSubIconPath()
1177 LoggerI("Handle = " << m_notiHandle);
1180 char *subIconPath = NULL;
1182 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_ICON_SUB, &subIconPath) != NOTIFICATION_ERROR_NONE)
1184 throw UnknownException("get notification sub icon error");
1187 std::string notiSubIconPath;
1189 notiSubIconPath = subIconPath;
1190 return notiSubIconPath;
1194 throw UnknownException("notification handle is null");
1199 void StatusNotification::setSubIconPath(const std::string& subIconPath)
1203 LoggerI(" subIconPath = " << subIconPath << " origin SubIconPath = " << getSubIconPath());
1205 if( getSubIconPath().compare(subIconPath))
1207 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_ICON_SUB, subIconPath.c_str()) != NOTIFICATION_ERROR_NONE)
1209 throw UnknownException("set notification sound error");
1211 setUpdatedFlag(true);
1216 LoggerD("noti Handle is NULL");
1217 throw UnknownException("notification handle is null");
1222 std::string StatusNotification::getInformation(int index)
1226 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1230 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1233 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1236 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1239 type = NOTIFICATION_TEXT_TYPE_NONE;
1243 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
1245 throw UnknownException("get notification information error");
1248 std::string strInfo;
1251 LoggerD(" info " << strInfo);
1257 LoggerD("noti Handle is NULL");
1258 throw UnknownException("notification handle is null");
1263 void StatusNotification::setInformation( const std::string& info, int index)
1269 LoggerD(" index : " << idx);
1270 LoggerD(" log : " << info);
1271 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1276 type = NOTIFICATION_TEXT_TYPE_INFO_1;
1279 type = NOTIFICATION_TEXT_TYPE_INFO_2;
1282 type = NOTIFICATION_TEXT_TYPE_INFO_3;
1285 type = NOTIFICATION_TEXT_TYPE_NONE;
1288 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1290 if (getInformation(idx).compare(info))
1292 if (notification_set_text(m_notiHandle, type, info.c_str(),
1293 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1295 throw UnknownException("set notification sound error");
1297 setUpdatedFlag(true);
1303 LoggerD("noti Handle is NULL");
1304 throw UnknownException("notification handle is null");
1308 std::string StatusNotification::getSubInformation(int index)
1313 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1317 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1320 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1323 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1326 type = NOTIFICATION_TEXT_TYPE_NONE;
1329 char *subInfo = NULL;
1331 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
1333 throw UnknownException( "get notification sub information error");
1336 std::string strSubInfo;
1338 strSubInfo = subInfo;
1339 LoggerD(" subInfo " << strSubInfo);
1345 LoggerD("noti Handle is NULL");
1346 throw UnknownException( "notification handle is null");
1351 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
1356 LoggerD(" index : " << idx);
1357 LoggerD(" log : " << subInfo);
1358 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1363 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
1366 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
1369 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
1372 type = NOTIFICATION_TEXT_TYPE_NONE;
1375 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
1377 if (getSubInformation(idx).compare(subInfo))
1379 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
1380 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1382 throw UnknownException( "set notification sound error");
1384 setUpdatedFlag(true);
1390 LoggerD("noti Handle is NULL");
1391 throw UnknownException( "notification handle is null");
1397 void StatusNotification::loadThumbnails()
1401 if (!m_thumbs.empty())
1405 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_1, &thumb) != NOTIFICATION_ERROR_NONE)
1407 throw UnknownException( "get notification thumbnail error");
1410 m_thumbs.push_back(thumb);
1412 // m_thumbs.push_back(std::string("")); //set empty
1415 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_2, &thumb) != NOTIFICATION_ERROR_NONE)
1417 throw UnknownException( "get notification sub information error");
1420 m_thumbs.push_back(thumb);
1422 // m_thumbs.push_back(std::string("")); //set empty
1425 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_3, &thumb) != NOTIFICATION_ERROR_NONE)
1427 throw UnknownException( "get notification sub information error");
1431 m_thumbs.push_back(thumb);
1433 // m_thumbs.push_back(std::string("")); //set empty
1436 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_4, &thumb) != NOTIFICATION_ERROR_NONE)
1438 throw UnknownException( "get notification sub information error");
1442 m_thumbs.push_back(thumb);
1444 // m_thumbs.push_back(std::string("")); //set empty
1447 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_LIST_5, &thumb) != NOTIFICATION_ERROR_NONE)
1449 throw UnknownException( "get notification sub information error");
1453 m_thumbs.push_back(thumb);
1455 m_thumbs.push_back(std::string("")); //set empty
1462 LoggerD("noti Handle is NULL");
1463 throw UnknownException( "notification handle is null");
1467 std::vector<std::string> StatusNotification::getThumbnails()
1469 LoggerI(" thumbnail Size : " << m_thumbs.size());
1473 std::string StatusNotification::getThumbnail(int index)
1477 LoggerI(" index : " << index);
1479 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE;
1484 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1487 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1490 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1493 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1496 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1499 type = NOTIFICATION_IMAGE_TYPE_NONE;
1502 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1505 if (notification_get_image(m_notiHandle, type, &thumb) != NOTIFICATION_ERROR_NONE)
1507 throw UnknownException( "set notification thumbnail error");
1510 std::string thumbnail;
1517 throw UnknownException( "notification handle is null");
1523 LoggerD("noti Handle is NULL");
1524 throw UnknownException( "notification handle is null");
1527 if (m_thumbs.size() > index)
1528 return m_thumbs[index];
1530 return std::string("");
1535 void StatusNotification::setThumbnails(std::vector<std::string> thumbs)
1537 LoggerI("set thumbnails");
1540 std::vector<std::string>::iterator it;
1543 for (it = thumbs.begin(); it < thumbs.end(); ++it)
1545 std::string str = *it;
1546 if ( idx < MAX_THUMBNAIL_LENGTH )
1547 setThumbnail(str, idx); //set notification's thumbnail value.
1555 LoggerD("noti Handle is NULL");
1556 throw UnknownException( "notification handle is null");
1560 void StatusNotification::setThumbnail( const std::string& thumb, int index)
1564 LoggerI(" index : " << index);
1565 LoggerI(" thumb : " << thumb);
1566 notification_image_type_e type = NOTIFICATION_IMAGE_TYPE_NONE;
1571 type = NOTIFICATION_IMAGE_TYPE_LIST_1;
1574 type = NOTIFICATION_IMAGE_TYPE_LIST_2;
1577 type = NOTIFICATION_IMAGE_TYPE_LIST_3;
1580 type = NOTIFICATION_IMAGE_TYPE_LIST_4;
1583 type = NOTIFICATION_IMAGE_TYPE_LIST_5;
1586 type = NOTIFICATION_IMAGE_TYPE_NONE;
1589 if ( type != NOTIFICATION_IMAGE_TYPE_NONE)
1591 if (getThumbnail(index).compare(thumb))
1593 if (notification_set_image(m_notiHandle, type, thumb.c_str()) != NOTIFICATION_ERROR_NONE)
1595 throw UnknownException( "set notification thumbnail error");
1597 setUpdatedFlag(true);
1603 std::string StatusNotification::getBackground()
1605 LoggerI(" Handle : " << m_notiHandle);
1609 char *background = NULL;
1611 if (notification_get_image(m_notiHandle, NOTIFICATION_IMAGE_TYPE_BACKGROUND, &background) != NOTIFICATION_ERROR_NONE)
1613 throw UnknownException( "get notification background error");
1616 std::string notiBackground;
1618 notiBackground = background;
1619 return notiBackground;
1623 LoggerD("noti Handle is NULL");
1624 throw UnknownException( "notification handle is null");
1629 void StatusNotification::setBackground(const std::string imagePath)
1631 LoggerI(" imagePath : " << imagePath);
1634 if (getBackground().compare(imagePath))
1636 if (notification_set_image(m_notiHandle,NOTIFICATION_IMAGE_TYPE_BACKGROUND, imagePath.c_str()) != NOTIFICATION_ERROR_NONE)
1638 throw UnknownException( "set notification sound error");
1640 setUpdatedFlag(true);
1645 LoggerD("noti Handle is NULL");
1646 throw UnknownException( "notification handle is null");
1650 long StatusNotification::getNumber()
1652 LoggerI("Handle = " << m_notiHandle);
1656 char *strNumber = NULL;
1658 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1660 throw UnknownException( "get notification background error");
1664 std::istringstream(strNumber) >> number;
1666 LoggerI("Number Is NULL");
1668 LoggerI("number = " << number);
1674 LoggerD("noti Handle is NULL");
1679 const char* StatusNotification::getStrNumber()
1681 LoggerI("Handle = " << m_notiHandle);
1684 char *strNumber = NULL;
1686 if (notification_get_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, &strNumber) != NOTIFICATION_ERROR_NONE)
1688 throw UnknownException( "get notification background error");
1700 LoggerD("noti Handle is NULL");
1705 void StatusNotification::setNumber(const long number)
1707 LoggerI("Number = " << number);
1710 if(number!=getNumber())
1712 std::stringstream stream;
1714 if (stream.fail()) {
1715 throw UnknownException(
1716 "Couldn't convert notification number");
1719 std::string strNumber = stream.str();
1720 if (notification_set_text(m_notiHandle, NOTIFICATION_TEXT_TYPE_EVENT_COUNT, strNumber.c_str(),
1721 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
1723 throw UnknownException( "set notification text error");
1725 setUpdatedFlag(true);
1730 LoggerD("noti Handle is NULL");
1731 throw UnknownException( "notification handle is null");
1735 void* StatusNotification::getNotificationHandle()
1737 return m_notiHandle;
1740 void StatusNotification::setNotificationHandle(void *handle)
1744 throw UnknownException( "notification handle null error");
1746 LoggerI("handle = " << handle << " m_notiHandle = " << m_notiHandle);
1748 if (m_notiHandle != NULL)
1751 if ( notification_delete(m_notiHandle) != NOTIFICATION_ERROR_NONE)
1753 throw UnknownException( "notification delete error");
1755 m_notiHandle = NULL;
1758 m_notiHandle = (notification_h)handle;
1761 service_h StatusNotification::getService()
1767 std::string StatusNotification::getLight()
1769 LoggerI("get Light handle: " << m_notiHandle);
1773 notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1774 if (notification_get_led(m_notiHandle, &type, &ledColor) != NOTIFICATION_ERROR_NONE)
1776 throw UnknownException("get notification Content error");
1779 //ledColor = ledColor | 0xff000000;
1780 std::stringstream stream;
1781 if (NOTIFICATION_LED_OP_OFF != type)
1783 stream << std::hex << ledColor;
1786 return stream.str();
1790 throw UnknownException("notification handle is null");
1794 void StatusNotification::setLight(std::string color)
1796 LoggerI("set Light handle: " << m_notiHandle);
1797 LoggerI("led Color : " << color);
1801 std::stringstream stream;
1803 notification_led_op_e type = NOTIFICATION_LED_OP_ON;
1805 stream << std::hex << color;
1806 LoggerI("LedColor = " << stream.str());
1808 LoggerI("LedColor = " << ledColor);
1810 if (notification_set_led(m_notiHandle, NOTIFICATION_LED_OP_ON_CUSTOM_COLOR, ledColor) != NOTIFICATION_ERROR_NONE)
1812 throw UnknownException("set notification led ");
1817 throw UnknownException("notification handle is null");
1821 unsigned long StatusNotification::getLightOnTime()
1823 LoggerI("get Light on Time handle: " << m_notiHandle);
1829 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1831 throw UnknownException("set notification led ");
1833 LoggerI("onTime " << onTime);
1835 return (unsigned long) onTime;
1839 throw UnknownException("notification handle is null");
1843 void StatusNotification::setLightOnTime(unsigned long time)
1845 LoggerI("set Light on Time handle: " << m_notiHandle);
1846 LoggerI("itme = " << time);
1849 int offTime = getLightOffTime();
1851 if (notification_set_led_time_period(m_notiHandle, time, offTime ) != NOTIFICATION_ERROR_NONE)
1853 throw UnknownException("set notification led ");
1859 throw UnknownException("notification handle is null");
1863 unsigned long StatusNotification::getLightOffTime()
1866 LoggerI("get Light on Time handle: " << m_notiHandle);
1872 if (notification_get_led_time_period(m_notiHandle, &onTime, &offTime ) != NOTIFICATION_ERROR_NONE)
1874 throw UnknownException("set notification led ");
1876 LoggerI("offTime " << offTime);
1882 throw UnknownException("notification handle is null");
1887 void StatusNotification::setLightOffTime(unsigned long time)
1889 LoggerI("set Light off Time handle: " << m_notiHandle);
1890 LoggerI("time = " << time);
1893 int onTime = getLightOnTime();
1895 if (notification_set_led_time_period(m_notiHandle, onTime, time ) != NOTIFICATION_ERROR_NONE)
1897 throw UnknownException("set notification led ");
1902 throw UnknownException("notification handle is null");
1907 void StatusNotification::loadDetailInfos()
1909 LoggerI("noti Handle = " << m_notiHandle);
1913 for ( int idx = 0; idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH; idx++)
1915 std::string main = getInformation(idx);
1916 std::string sub = getSubInformation(idx);
1917 LoggerI("Main : " << main << " Sub : " << sub);
1918 NotificationDetailInfo *info = new NotificationDetailInfo(m_notiHandle, idx, main, sub);
1919 m_detailInfos.push_back(info);
1924 LoggerD("noti Handle is NULL");
1925 throw UnknownException( "notification handle is null");
1930 std::vector<NotificationDetailInfo*> StatusNotification::getDetailInfos() const
1932 return m_detailInfos;
1935 void StatusNotification::setDetailInfos(const std::vector<NotificationDetailInfo*> value)
1937 LoggerI("DetailInfos = " << value.size());
1941 std::vector<NotificationDetailInfo*>::const_iterator it;
1944 for (it = value.begin(); it < value.end(); ++it)
1946 NotificationDetailInfo* info = *it;
1947 if ( idx < MAX_NOTIFICATION_DETAIL_INFO_LENGTH )
1949 LoggerI("main " << info->getMainText() << " sub " << info->getSubText() );
1950 setInformation(info->getMainText(), idx);
1951 setSubInformation(info->getSubText(), idx);
1956 m_detailInfos = value;
1960 LoggerD("noti Handle is NULL");
1961 throw UnknownException( "notification handle is null");
1966 int StatusNotification::getDetailInfosNum() const
1968 return m_detailInfos.size();
1971 void StatusNotification::clearDetailInfos()
1973 if ( !m_detailInfos.empty() )
1975 std::vector<NotificationDetailInfo*>::const_iterator it;
1978 for (it = m_detailInfos.begin(); it < m_detailInfos.end(); ++it)
1980 NotificationDetailInfo* info = *it;
1981 LoggerI("Delete Detail Info : " << info);
1986 m_detailInfos.clear(); //clear
1990 std::string StatusNotification::getInformation(int index)
1994 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
1998 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2001 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2004 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2007 type = NOTIFICATION_TEXT_TYPE_NONE;
2011 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &info) != NOTIFICATION_ERROR_NONE)
2013 throw UnknownException("Detail Info index value is invalid or mainText value getting is failed in Detail Info.");
2016 std::string strInfo;
2019 LoggerI(" info " << strInfo);
2025 LoggerW("noti Handle is NULL");
2026 throw UnknownException( "notification handle is null");
2031 std::string StatusNotification::getSubInformation(int index)
2035 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2039 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2042 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2045 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2048 type = NOTIFICATION_TEXT_TYPE_NONE;
2051 char *subInfo = NULL;
2053 if (NOTIFICATION_TEXT_TYPE_NONE != type && notification_get_text(m_notiHandle, type, &subInfo) != NOTIFICATION_ERROR_NONE)
2055 throw UnknownException("Detail Info index value is invalid or subText value getting is failed in Detail Info.");
2058 std::string strSubInfo;
2060 strSubInfo = subInfo;
2061 LoggerI(" subInfo " << strSubInfo);
2067 LoggerW("noti Handle is NULL");
2068 throw UnknownException ("notification handle is null");
2073 void StatusNotification::setInformation( const std::string& info, int index)
2078 LoggerD(" index : " << idx);
2079 LoggerD(" log : " << info);
2080 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2085 type = NOTIFICATION_TEXT_TYPE_INFO_1;
2088 type = NOTIFICATION_TEXT_TYPE_INFO_2;
2091 type = NOTIFICATION_TEXT_TYPE_INFO_3;
2094 type = NOTIFICATION_TEXT_TYPE_NONE;
2097 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2099 if (getInformation(idx).compare(info))
2101 if (notification_set_text(m_notiHandle, type, info.c_str(),
2102 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2104 throw UnknownException("set notification sound error");
2106 setUpdatedFlag(true);
2111 LoggerW("noti Handle is NULL");
2112 throw UnknownException("notification handle is null");
2117 LoggerW("noti Handle is NULL");
2118 throw UnknownException("notification handle is null");
2122 void StatusNotification::setSubInformation( const std::string& subInfo, int index)
2128 LoggerD(" index : " << idx);
2129 LoggerD(" log : " << subInfo);
2130 notification_text_type_e type = NOTIFICATION_TEXT_TYPE_NONE;
2135 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_1;
2138 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_2;
2141 type = NOTIFICATION_TEXT_TYPE_INFO_SUB_3;
2144 type = NOTIFICATION_TEXT_TYPE_NONE;
2147 if ( type != NOTIFICATION_TEXT_TYPE_NONE)
2149 if (getSubInformation(idx).compare(subInfo))
2151 if (notification_set_text(m_notiHandle, type, subInfo.c_str(),
2152 NULL, NOTIFICATION_VARIABLE_TYPE_NONE) != NOTIFICATION_ERROR_NONE)
2154 throw UnknownException("set notification sound error");
2156 setUpdatedFlag(true);
2162 LoggerW("noti Handle is NULL");
2163 throw UnknownException("notification handle is null");
2170 StatusNotification::StatusNotification():
2175 m_backgroundImagePath(""),
2183 StatusNotification::~StatusNotification()
2187 std::string StatusNotification::getStatusType() const
2189 return m_statusType;
2192 void StatusNotification::setStatusType(std::string statusType)
2194 m_statusType = statusType;
2197 std::string StatusNotification::getIconPath() const
2202 void StatusNotification::setIconPath(std::string iconPath)
2204 m_iconPath = iconPath;
2207 std::string StatusNotification::getSubIconPath() const
2209 return m_subIconPath;
2212 void StatusNotification::setSubIconPath(std::string subIconPath)
2214 m_subIconPath = subIconPath;
2217 long StatusNotification::getNumber() const
2222 void StatusNotification::setNumber(long number)
2227 std::vector<NotificationDetailInfo*> StatusNotification::getDetailInfo() const
2229 return m_detailInfo;
2232 void StatusNotification::setDetailInfo(std::vector<NotificationDetailInfo*> detailInfo)
2234 m_detailInfo = detailInfo;
2237 std::string StatusNotification::getBackgroundImagePath() const
2239 return m_backgroundImagePath;
2242 void StatusNotification::setBackgroundImagePath(std::string backgroundImagePath)
2244 m_backgroundImagePath = backgroundImagePath;
2247 std::vector<std::string> StatusNotification::getThumbnails() const
2249 return m_thumbnails;
2252 void StatusNotification::setThumbnails(std::vector<std::string> thumbnails)
2254 m_thumbnails = thumbnails;
2257 std::string StatusNotification::getSoundPath() const
2262 void StatusNotification::setSoundPath(std::string soundPath)
2264 m_soundPath = soundPath;
2267 bool StatusNotification::getVibration() const
2272 void StatusNotification::setVibration(bool vibration)
2274 m_vibration = vibration;
2277 ApplicationControl StatusNotification::getAppControl() const
2279 return m_appControl;
2282 void StatusNotification::setAppControl(ApplicationControl appControl)
2284 m_appControl = appControl;
2287 ApplicationId StatusNotification::getAppId() const
2292 void StatusNotification::setAppId(ApplicationId appId)
2297 std::string StatusNotification::getProgressType() const
2299 return m_progressType;
2302 void StatusNotification::setProgressType(std::string progressType)
2304 m_progressType = progressType;
2307 unsigned long StatusNotification::getProgressValue() const
2309 return m_progressValue;
2312 void StatusNotification::setProgressValue(unsigned long progressValue)
2314 m_progressValue = progressValue;