//
-// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
#include <FBaseSysLog.h>
#include <FIoFile.h>
#include <FAppApp.h>
+#include <FGrpColor.h>
#include <FShellNotificationManager.h>
#include <FShellNotificationRequest.h>
#include <FShellIBadgeEventListener.h>
using namespace Tizen::Base::Collection;
using namespace Tizen::App;
using namespace Tizen::Io;
+using namespace Tizen::Graphics;
extern "C" int service_create_request(bundle *data, service_h *service);
extern "C" int service_to_bundle(service_h service, bundle** data);
_NotificationManagerImpl::_NotificationManagerImpl(void)
: __notifyPrivateId(-1)
, __notifyPrivateIdForOngoing(-1)
+ , __lastNotifyPrivateId(-1)
+ , __lightActivated(false)
{
}
{
SysTryReturnResult(NID_SHELL, false, E_INVALID_ARG, "Invalid argument is used.");
}
+ __lastAppId = pAppIdChar.get();
const int badgeNumber = notifyRequest.GetBadgeNumber();
const int badgeOffset = notifyRequest.GetBadgeOffset();
const String& soundPath = notifyRequest.GetSoundFilePath();
const notification_type_e notiType = isOngoing ? NOTIFICATION_TYPE_ONGOING : NOTIFICATION_TYPE_NOTI;
int notiPrivateId = isOngoing ? __notifyPrivateIdForOngoing : __notifyPrivateId;
+ __lastNotifyPrivateId = notiPrivateId;
notification_h notiHandle = null;
bundle* pBundle = null;
bool needUpdate = false;
}
}
+ // light
+ Color lightColor;
+ int lightColor32 = 0;
+
// Set - service
int retVal = SERVICE_ERROR_NONE;
int previousDisplaySet = NOTIFICATION_DISPLAY_APP_ALL;
SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Setting the notification area failed.", GetErrorMessage(r));
}
+ // Set LED
+ lightColor = pRequestImpl->GetColor();
+ lightColor32 = lightColor.GetRGB32();
+
+ if (lightColor32 == 0 || (pRequestImpl->GetOnTime() == 0))
+ { // Turn off case
+ if (needUpdate && __lightActivated)
+ { // Not for first insertion
+ r = ConvertNotificationResult(notification_set_led(notiHandle, NOTIFICATION_LED_OP_OFF, 0x00000000));
+ SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Setting the notification led failed.", GetErrorMessage(r));
+ __lightActivated = false;
+ }
+ }
+ else
+ {
+ r = ConvertNotificationResult(notification_set_led(notiHandle, NOTIFICATION_LED_OP_ON_CUSTOM_COLOR, lightColor32));
+ SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Setting the notification led failed.", GetErrorMessage(r));
+
+ r = ConvertNotificationResult(notification_set_led_time_period(notiHandle, pRequestImpl->GetOnTime(), pRequestImpl->GetOffTime()));
+ SysTryLog(NID_SHELL, !IsFailed(r), "[%s] Setting the notification led time period failed.", GetErrorMessage(r));
+ __lightActivated = true;
+ }
+
// insert for new notification
if (!needUpdate)
{ // new
{
__notifyPrivateId = notiPrivateId;
}
+ __lastNotifyPrivateId = notiPrivateId;
}
else
{
if (notiPrivateId != -1)
{
- notification_h notiHandle = notification_load(null, notiPrivateId);
+ std::unique_ptr<char[]> pAppIdTemp(_StringConverter::CopyToCharArrayN(__lastAppId));
+ notification_h notiHandle = notification_load(pAppIdTemp.get(), notiPrivateId);
if (notiHandle)
{
err = notification_delete(notiHandle);
return _BadgeManagerImpl::GetInstance()->RemovePrimaryBadgeEventListener(*this);
}
+int
+_NotificationManagerImpl::GetLastNotificationId(void) const
+{
+ return __lastNotifyPrivateId;
+}
+
+const Tizen::Base::String&
+_NotificationManagerImpl::GetLastAppId(void) const
+{
+ return __lastAppId;
+}
+
void
_NotificationManagerImpl::OnBadgeUpdated(const Tizen::App::AppId& appId, int badgeNumber)
{