#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
-#include <provider.h>
#include <provider_buffer.h>
-#include <FAppTypes.h>
#include <FBaseRtTimer.h>
-#include <FBaseObject.h>
#include <FBaseColArrayListT.h>
#include "FShell_AppWidgetContextBase.h"
+namespace Tizen { namespace Base { namespace Collection
+{
+class HashMap;
+}}}
+
namespace Tizen { namespace Shell { namespace App
{
extern const int UPDATE_PERIOD_MSEC_MIN;
class _AppWidgetContext
- : public _AppWidgetContextBase
- ,public Tizen::Base::Runtime::ITimerEventListener
+ : public _AppWidgetContextBase
+ , public Tizen::Base::Runtime::ITimerEventListener
{
public:
- _AppWidgetContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId,
- int width, int height, int period, int priority);
- virtual ~_AppWidgetContext();
+ _AppWidgetContext(const Tizen::Base::String& name, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int period, int priority);
+ virtual ~_AppWidgetContext(void);
+
void OnAdded(void);
void OnUpdate(const Tizen::Base::String& argument);
void OnResize(int width, int height);
- void OnRemoved();
- void OnForeground();
- void OnBackground();
+ void OnRemoved(void);
+
+ bool IsPaused(void) const;
+ void OnForeground(void);
+ void OnBackground(void);
virtual void OnPopupCreated(double x, double y, int width, int height);
virtual void OnPopupDestoyed(void);
- virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
+ _AppWidgetPopupContext* GetAppWidgetPopup(void) const;
+ virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
result RequestUpdateRemote(int width, int height);
- _AppWidgetPopupContext* GetAppWidgetPopup() const;
- bool IsPaused(void) const;
int GetPeriod(void) const;
long long GetLastUpdatedTime(void) const;
result SendAddRequest(int width, int height);
result SendUpdateRequest(int width, int height, const Tizen::Base::String& argument);
result SendResizeRequest(int width, int height);
- result SendRemoveRequest();
-
+ result SendRemoveRequest(void);
result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
void SendPendingTouchEvent(void);
virtual Tizen::Base::Collection::HashMap* CreateRequestArgsN(void);
-
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
struct PendingTouchEvent
{
- public:
PendingTouchEvent(int eventType, double timeStamp, double x, double y)
: eventType(eventType), timeStamp(timeStamp), x(x), y(y) { }
int __updateMillis;
long long __lastUpdatedTime;
Tizen::Base::Collection::ArrayListT<PendingTouchEvent*>* __pPendingTouchEventList;
- Tizen::Base::String __pendedArgument;
+ Tizen::Base::String __pendingArgument;
bool __hasPendingRequest;
-};
-} } } // Tizen::Shell::App {
+}; // class _AppWidgetContext
+
+}}} // Tizen::Shell::App
#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_H_
#ifndef _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
#define _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
-#include <provider.h>
+#include <provider_buffer.h>
#include <FAppTypes.h>
-#include <FBaseObject.h>
-#include <FBaseColHashMap.h>
#define APPWIDGET_PROVIDER_ID_ENABLE true
-typedef struct _bundle_t bundle; //TODO: move code to osp-appfw
+namespace Tizen { namespace Base { namespace Collection
+{
+class HashMap;
+}}}
namespace Tizen { namespace Shell { namespace App
{
public:
_AppWidgetContextBase(target_type type, const Tizen::Base::String& userInfo, const Tizen::Base::String& providerId, const Tizen::Base::String& instanceId, int width, int height, int priority);
- virtual ~_AppWidgetContextBase();
-
+ virtual ~_AppWidgetContextBase(void);
virtual void OnPopupCreated(double x, double y, int width, int height) = 0;
virtual void OnPopupDestoyed(void) = 0;
virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y) = 0;
-
void SetIpcClientId(int clientId);
bool HasValidClientId(void) const;
-
// for buffered appWidget
int GetSharedMemId(int w, int h);
result ReleaseSharedMem(void);
-
void Suspend(void);
+ Tizen::Base::String GetInstanceId(void) const;
+ int GetWidth(void) const;
+ int GetHeight(void) const;
+ Tizen::Base::String GetProviderId(void) const;
Tizen::Base::String GetAppId(void) const;
+ int GetPriority(void) const;
Tizen::Base::String GetProviderName(void) const;
protected:
bool IsRunning(void) const;
bool IsSharedMemCreated(void) const;
-
virtual Tizen::Base::Collection::HashMap* CreateRequestArgsN(void) = 0;
result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
+ void SetForeground(bool forground);
+ bool IsForeground(void) const;
+ Tizen::Base::String GetUserInfo(void) const;
+ int GetClientId(void) const;
-public:
+ void SetWidth(int width);
+ void SetHeight(int height);
+
+private:
target_type __type;
Tizen::Base::String __userInfo;
- Tizen::Base::String __appId;
- Tizen::Base::String __providerName;
Tizen::Base::String __providerId;
Tizen::Base::String __instanceId;
int __width;
int __height;
int __priority;
-
-protected:
- bool __isForeground;// LB only?
+ bool __isForeground;
int __ipcClientId;
-
-private:
+ Tizen::Base::String __appId;
+ Tizen::Base::String __providerName;
struct livebox_buffer *__buffer_info;
void *__buffer;
_AppWidgetProviderState __providerState;
-};
+
+}; // class _AppWidgetContextBase
class _AppWidgetRequestHelper
{
public:
static result SendRequestToApp(const Tizen::App::AppId& appId, const Tizen::Base::String& operation, Tizen::Base::Collection::HashMap* pArgs);
-};
+}; // class _AppWidgetRequestHelper
extern const wchar_t ARG_KEY_INSTANCE_ID[];
extern const wchar_t ARG_KEY_PROVIDER_NAME[];
extern const wchar_t ARG_KEY_EVENT_TYPE[];
extern const wchar_t ARG_KEY_TIME_STAMP[];
-} /* namespace App */
-} /* namespace AppWidget */
-} /* namespace Samsung */
+}}} // Tizen::Shell::App
+
#endif // _FSHELL_INTERNAL_APPWIDGET_CONTEXT_BASE_H_
#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
-#include <FBaseObject.h>
-#include <FBaseString.h>
#include <FBaseRtTimer.h>
+#include <FBaseRtThread.h>
#include <FBaseColArrayListT.h>
-#include <FBaseColArrayList.h>
-
#include "FShell_AppWidgetContext.h"
#include "FShell_AppWidgetManagerStub.h"
+namespace Tizen { namespace Base { namespace Collection
+{
+class IList;
+}}}
+
namespace Tizen { namespace Shell { namespace App {
class AppWidgetManagerService
result RemoveAppWidget(const char* pPackageName, const char* pId, bool free);
private:
- result Construct();
+ result Construct(void);
result InitializeMasterDaemonEventReceiver(const char* pServiceExecutableName);
result DeinitializeMasterDaemonEventReceiver(void);
virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
// internal functions
- AppWidgetManagerService();
- virtual ~AppWidgetManagerService();
+ AppWidgetManagerService(void);
+ virtual ~AppWidgetManagerService(void);
virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
result SetIpcClientIds(const Tizen::App::AppId& appId, int clientId);
int UpdateAllAppWidgetsByAppId(const Tizen::Base::String& appId);
- void StartPingTimer();
+ void StartPingTimer(void);
virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
_AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
Tizen::Base::Collection::ArrayListT<_AppWidgetContext*> __appWidgetContextList;
Tizen::Base::Runtime::Timer __pingTimer;
_TaskHandlerThread __handlerThread;
-};
-} } } // Tizen::Shell::App {
+}; // class AppWidgetManagerService
+
+}}} // Tizen::Shell::App
#endif // _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
#ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
#define _FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
-#include <FBaseObject.h>
-#include <FBaseString.h>
#include <FBaseRtIEventListener.h>
-#include <FSystem.h>
-#include <FIo.h>
-
#include <FIo_IIpcServerEventListener.h>
-//#include <FApp_IAppManager.h>
-
namespace Tizen { namespace Shell { namespace App {
protected:
Tizen::Io::_IpcServer *__pIpcServer;
-}; //_AppWidgetManagerStub
-}}}
+}; // class _AppWidgetManagerStub
+
+}}} // Tizen::Shell::App
#endif//_FSHELL_INTERNAL_APPWIDGET_MANAGER_STUB_H_
{
public:
_AppWidgetPopupContext(const Tizen::Base::String& userInfo, const Tizen::Base::String& appId, const Tizen::Base::String& instanceId, int width, int height, int priority, _AppWidgetContext* pParent);
- virtual ~_AppWidgetPopupContext();
+ virtual ~_AppWidgetPopupContext(void);
// event handler
void OnPopupCreated(double x, double y, int width, int height);
// request to app
result SendPopupCreateRequest(double x, double y, int width, int height);
- result SendPopupDestroyRequest();
+ result SendPopupDestroyRequest(void);
virtual result SendTouchEvent(buffer_event event, double timestamp, double x, double y);
-
result RequestUpdateRemote(void);
private:
private:
_AppWidgetContext* __pParent;
-};
+}; // class _AppWidgetPopupContext
+
+}}} // Tizen::Shell::App
-} /* namespace App */
-} /* namespace AppWidget */
-} /* namespace Samsung */
#endif // _FSHELL_INTERNAL_APPWIDGET_POPUP_CONTEXT_H_
public:
- OspAppWidgetService();
- ~OspAppWidgetService();
+ OspAppWidgetService(void);
+ ~OspAppWidgetService(void);
public:
// Called when the battery level changes.
void OnBatteryLevelChanged(Tizen::System::BatteryLevel batteryLevel);
-};
+}; // class OspAppWidgetService
-#endif // _$(baseName_upper)_H_
+#endif // _OSP_APPWIDGET_SERVICE_H_
* @brief This is the implementation for the _AppWidgetContext class.
*/
-#include <stdlib.h>
+#include <provider.h>
#include <unique_ptr.h>
-#include <FBase.h>
#include <FBaseSysLog.h>
+#include <FBaseInteger.h>
+#include <FBaseDouble.h>
+#include <FBaseColHashMap.h>
#include <FSysSystemTime.h>
+#include <FBaseColAllElementsDeleter.h>
#include <FBase_StringConverter.h>
-#include <FApp_AppControlManager.h>
#include "FShell_AppWidgetManagerService.h"
#include "FShell_AppWidgetPopupContext.h"
-#include "FShell_AppWidgetContextBase.h"
#include "FShell_AppWidgetContext.h"
namespace Tizen { namespace Shell { namespace App
,__pPendingTouchEventList(null)
, __hasPendingRequest(false)
{
- if( __updateMillis > 0)
+ if (__updateMillis > 0)
{
__updateMillis = (__updateMillis > UPDATE_PERIOD_MSEC_MIN) ? __updateMillis : UPDATE_PERIOD_MSEC_MIN;
SysLog(NID_SHELL, "period(%d)", __updateMillis);
__pPendingTouchEventList->Construct();
}
-_AppWidgetContext::~_AppWidgetContext()
+_AppWidgetContext::~_AppWidgetContext(void)
{
- SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+ SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), GetHeight(), GetPriority());
__updateTimer.Cancel();
}
_AppWidgetPopupContext*
-_AppWidgetContext::GetAppWidgetPopup() const
+_AppWidgetContext::GetAppWidgetPopup(void) const
{
return __pAppWidgetPopup;
}
void
_AppWidgetContext::OnAdded(void)
{
- SendAddRequest(__width, __height);
+ SendAddRequest(GetWidth(), GetHeight());
}
void
-_AppWidgetContext::OnRemoved()
+_AppWidgetContext::OnRemoved(void)
{
SendRemoveRequest();
}
// Saving the data
if (!argument.IsEmpty())
{
- __pendedArgument = argument;
+ __pendingArgument = argument;
}
__hasPendingRequest = true;
}
else
{
- this->SendUpdateRequest(__width, __height, argument);
+ this->SendUpdateRequest(GetWidth(), GetHeight(), argument);
SystemTime::GetTicks(this->__lastUpdatedTime);
SysLog(NID_SHELL, "The last updated time is %lld.", this->__lastUpdatedTime);
__hasPendingRequest = false;
- __pendedArgument.Clear();
+ __pendingArgument.Clear();
}
}
void
_AppWidgetContext::OnResize(int width, int height)
{
- SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
+ SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), GetHeight(), GetPriority());
- __width = width;
- __height = height;
- SendResizeRequest(__width, __height);
+ SetWidth(width);
+ SetHeight(height);
+
+ SendResizeRequest(width, height);
}
void
-_AppWidgetContext::OnForeground()
+_AppWidgetContext::OnForeground(void)
{
SysLog(NID_SHELL, "OnForeground");
- if (__isForeground)
+ if (!IsPaused())
{
SysLog(NID_SHELL, "%ls is already resumed.", (this->GetAppId()).GetPointer());
return;
}
- __isForeground = true;
+ this->SetForeground(true);
if (__hasPendingRequest == true)
{
- OnUpdate(__pendedArgument);
+ OnUpdate(__pendingArgument);
}
else
{
}
void
-_AppWidgetContext::OnBackground()
+_AppWidgetContext::OnBackground(void)
{
SysLog(NID_SHELL, "OnBackground");
- if (!__isForeground)
+ if (IsPaused())
{
SysLog(NID_SHELL, "%ls is already paused.", (this->GetAppId()).GetPointer());
return;
}
- __isForeground = false;
+ SetForeground(false);
}
bool
_AppWidgetContext::IsPaused(void) const
{
- return __isForeground ? false : true;
+ return IsForeground() ? false : true;
}
void
_AppWidgetContext::OnPopupCreated(double x, double y, int width, int height)
{
- __pAppWidgetPopup = new (std::nothrow) _AppWidgetPopupContext(__userInfo, __providerId, __instanceId, width, height, __priority, this);
- __pAppWidgetPopup->SetIpcClientId(__ipcClientId);
+ __pAppWidgetPopup = new (std::nothrow) _AppWidgetPopupContext(GetUserInfo(), GetProviderId(), GetInstanceId(), GetWidth(), GetHeight(), GetPriority(), this);
+ __pAppWidgetPopup->SetIpcClientId(GetClientId());
__pAppWidgetPopup->OnPopupCreated(x, y, width, height);
}
result
_AppWidgetContext::SendAddRequest(int width, int height)
{
- std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN());
- return SendRequestToApp( __appId, APPWIDGET_ON_ADD, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_ON_ADD, pArgs.get());
}
result
_AppWidgetContext::SendUpdateRequest(int width, int height, const String& argument)
{
- std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN());
pArgs->Add(new String(ARG_KEY_ARGUMENT), new String(argument));
- return SendRequestToApp( __appId, APPWIDGET_ON_UPDATE, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_ON_UPDATE, pArgs.get());
}
result
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
- return SendRequestToApp( __appId, APPWIDGET_ON_RESIZE, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_ON_RESIZE, pArgs.get());
}
result
-_AppWidgetContext::SendRemoveRequest()
+_AppWidgetContext::SendRemoveRequest(void)
{
- std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
+ std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN());
- return SendRequestToApp( __appId, APPWIDGET_ON_REMOVE, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_ON_REMOVE, pArgs.get());
}
void
_AppWidgetContext::SendPendingTouchEvent(void)
{
- for(int i =0; i< __pPendingTouchEventList->GetCount(); i++)
+ for (int i =0; i< __pPendingTouchEventList->GetCount(); i++)
{
PendingTouchEvent* pTouchEvent = null;
__pPendingTouchEventList->GetAt(i, pTouchEvent);
- AppWidgetManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, pTouchEvent->eventType, pTouchEvent->timeStamp, pTouchEvent->x, pTouchEvent->y);
+ AppWidgetManagerService::GetInstance()->SendTouchEvent(GetClientId(), GetInstanceId(), pTouchEvent->eventType, pTouchEvent->timeStamp, pTouchEvent->x, pTouchEvent->y);
delete pTouchEvent;
}
__pPendingTouchEventList->RemoveAll();
result
_AppWidgetContext::SendTouchEvent(buffer_event eventType, double timeStamp, double x, double y)
{
- if( HasValidClientId() && IsRunning() )
+ if (HasValidClientId() && IsRunning())
{
SysAssert(IsSharedMemCreated() == true);
SysLog(NID_SHELL, "send IPC message");
- AppWidgetManagerService::GetInstance()->SendTouchEvent(__ipcClientId, __instanceId, eventType, timeStamp, x, y);
+ AppWidgetManagerService::GetInstance()->SendTouchEvent(GetClientId(), GetInstanceId(), eventType, timeStamp, x, y);
}
else
{
pArgs->Add(new String(ARG_KEY_X), new String(Double::ToString(x)));
pArgs->Add(new String(ARG_KEY_Y), new String(Double::ToString(y)));
- return SendRequestToApp( __appId, APPWIDGET_ON_TOUCH, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_ON_TOUCH, pArgs.get());
}
return E_SUCCESS;
}
result
_AppWidgetContext::RequestUpdateRemote(int width, int height)
{
- std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
- std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
- std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(__userInfo));
+ std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(GetProviderId()));
+ std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(GetInstanceId()));
+ std::unique_ptr<char[]> content_info(_StringConverter::CopyToCharArrayN(GetUserInfo()));
- int ret = provider_send_updated(packageName.get(), id.get(), width, height, __priority, content_info.get(), null);
+ int ret = provider_send_updated(packageName.get(), id.get(), width, height, GetPriority(), content_info.get(), null);
SysTryReturnResult(NID_SHELL, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
SendPendingTouchEvent();
{
HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
pArgs->Construct();
- pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
- pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
- pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
- pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(__width)));
- pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(__height)));
+ pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(GetInstanceId()));
+ pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(GetProviderName()));
+ pArgs->Add(new String(ARG_KEY_USER_INFO), new String(GetUserInfo()));
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(GetWidth())));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(GetHeight())));
return pArgs;
}
{
if (&timer == &__updateTimer)
{
- SysLog(NID_SHELL, "update timer is expired for appWidget app(%ls)..", __providerId.GetPointer());
+ SysLog(NID_SHELL, "update timer is expired for appWidget app(%ls).", GetProviderId().GetPointer());
OnUpdate(L"");
}
}
-} } } // Tizen::Shell::App
-
+}}} // Tizen::Shell::App
#include <stdlib.h>
#include <unique_ptr.h>
-#include <provider_buffer.h>
-#include <FBase.h>
+#include <provider.h>
+#include <FBaseColHashMap.h>
#include <FBaseSysLog.h>
#include <FBase_StringConverter.h>
#include <FApp_AppMessageImpl.h>
#include <FApp_AppArg.h>
#include <FApp_AppControlManager.h>
-#include <FShell_TemplateUtil.h>
-#include <FShell_AppWidgetManagerImpl.h>
+#include "FShell_AppWidgetManagerImpl.h"
#include "FShell_AppWidgetContextBase.h"
// provider/src/fb.c
void *data;
};
-static int AppWidgetHandleBufferEventCallback(struct livebox_buffer *info, enum buffer_event event,
- double timestamp, double x, double y, void* data);
+static int AppWidgetHandleBufferEventCallback(struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void* data);
namespace Tizen { namespace Shell { namespace App
{
const wchar_t ARG_KEY_EVENT_TYPE[] = L"_EventType";
const wchar_t ARG_KEY_TIME_STAMP[] = L"_TimeStamp";
-
_AppWidgetContextBase::_AppWidgetContextBase(target_type type, const String& userInfo, const String& providerId, const String& instanceId, int width, int height, int priority)
:__type(type)
,__userInfo(userInfo)
SysLog(NID_SHELL, "appId(%ls), providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __appId.GetPointer(), __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
}
-_AppWidgetContextBase::~_AppWidgetContextBase()
+_AppWidgetContextBase::~_AppWidgetContextBase(void)
{
SysLog(NID_SHELL, "providerId(%ls), instanceId(%ls), width(%d), height(%d), priority(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height, __priority);
ReleaseSharedMem();
}
-
void
_AppWidgetContextBase::SetIpcClientId(int clientId)
{
void
-_AppWidgetContextBase::Suspend()
+_AppWidgetContextBase::Suspend(void)
{
__providerState = SUSPENDED;
}
bool
-_AppWidgetContextBase::IsRunning() const
+_AppWidgetContextBase::IsRunning(void) const
{
return (__providerState == RUNNING);
}
result
-_AppWidgetContextBase::ReleaseSharedMem()
+_AppWidgetContextBase::ReleaseSharedMem(void)
{
SysLog(NID_SHELL, "Enter");
return __providerName;
}
+String
+_AppWidgetContextBase::GetUserInfo(void) const
+{
+ return __userInfo;
+}
+
+void
+_AppWidgetContextBase::SetForeground(bool foreground)
+{
+ __isForeground = foreground;
+}
+
+bool
+_AppWidgetContextBase::IsForeground(void) const
+{
+ return __isForeground;
+}
+
+int
+_AppWidgetContextBase::GetClientId(void) const
+{
+ return __ipcClientId;
+}
+
+int
+_AppWidgetContextBase::GetWidth(void) const
+{
+ return __width;
+}
+
+int
+_AppWidgetContextBase::GetHeight(void) const
+{
+ return __height;
+}
+
+String
+_AppWidgetContextBase::GetInstanceId(void) const
+{
+ return __instanceId;
+}
+
+String
+_AppWidgetContextBase::GetProviderId(void) const
+{
+ return __providerId;
+}
+
+int
+_AppWidgetContextBase::GetPriority(void) const
+{
+ return __priority;
+}
+
+void
+_AppWidgetContextBase::SetWidth(int width)
+{
+ __width = width;
+}
+
+void
+_AppWidgetContextBase::SetHeight(int height)
+{
+ __height = height;
+}
+
result
_AppWidgetRequestHelper::SendRequestToApp(const AppId& appId, const String& operation, HashMap* pArgs)
{
std::unique_ptr<char[]> pAppId(_StringConverter::CopyToCharArrayN(appId) );
std::unique_ptr<char[]> pOperation(_StringConverter::CopyToCharArrayN(operation) );
- return Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
-}
+ result r = Tizen::App::_AppControlManager::GetInstance()->LaunchPkg(msg, pAppId.get(), pOperation.get(), null, null, null, null);
+ SysLog(NID_SHELL, "The result of SendRequestToApp [%s]", GetErrorMessage(r));
-} } } // Tizen::Shell::App {
+ return r;
+}
+}}} // Tizen::Shell::App
////////////////////////////////////////////
// callback
////////////////////////////////////////////
-static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event,
- double timestamp, double x, double y, void* data)
+static int AppWidgetHandleBufferEventCallback( struct livebox_buffer *info, enum buffer_event event, double timestamp, double x, double y, void* data)
{
SysLog(NID_SHELL, "timestamp(%f), x(%f), y(%f)", timestamp, x, y);
Tizen::Shell::App::_AppWidgetContextBase *pAppWidgetBase = static_cast<Tizen::Shell::App::_AppWidgetContextBase*>(data);
SysTryReturn(NID_SHELL, pAppWidgetBase != null, 0, E_SYSTEM, "[E_SYSTEM] retrieved pAppWidgetBase is null");
- if( event == BUFFER_EVENT_ENTER)
+ if (event == BUFFER_EVENT_ENTER)
{
SysLog(NID_SHELL, "BUFFER_EVENT_ENTER");
}
- else if( event == BUFFER_EVENT_LEAVE)
+ else if (event == BUFFER_EVENT_LEAVE)
{
SysLog(NID_SHELL, "BUFFER_EVENT_LEAVE");
}
- else if( event == BUFFER_EVENT_DOWN)
+ else if (event == BUFFER_EVENT_DOWN)
{
SysLog(NID_SHELL, "BUFFER_EVENT_DOWN");
}
- else if( event == BUFFER_EVENT_MOVE)
+ else if (event == BUFFER_EVENT_MOVE)
{
SysLog(NID_SHELL, "BUFFER_EVENT_MOVE");
}
- else if( event == BUFFER_EVENT_UP)
+ else if(event == BUFFER_EVENT_UP)
{
SysLog(NID_SHELL, "BUFFER_EVENT_UP");
}
* @brief This is the implementation for the AppWidgetManagerService class.
*/
-#include <stdlib.h>
-#include <unistd.h>
#include <unique_ptr.h>
#include <provider.h>
-#include <aul.h>
-
-#include <FBase.h>
#include <FBaseSysLog.h>
-#include <FApp.h>
+#include <FBaseColIList.h>
+#include <FAppApp.h>
#include <FApp_AppManagerImpl.h>
#include <FIo_IpcServer.h>
#include <FBase_StringConverter.h>
-
#include "FShell_AppWidgetContext.h"
#include "FShell_AppWidgetPopupContext.h"
#include "FShell_AppWidgetManagerStub.h"
-
#include "FShell_AppWidgetManagerService.h"
namespace Tizen { namespace Shell { namespace App {
extern const int UPDATE_PERIOD_MSEC_MIN;
-AppWidgetManagerService::AppWidgetManagerService()
+AppWidgetManagerService::AppWidgetManagerService(void)
{
}
-AppWidgetManagerService::~AppWidgetManagerService()
+AppWidgetManagerService::~AppWidgetManagerService(void)
{
__pingTimer.Cancel();
DeinitializeMasterDaemonEventReceiver();
}
result
-AppWidgetManagerService::Construct()
+AppWidgetManagerService::Construct(void)
{
_AppWidgetManagerStub::StartIpcServer();
AppWidgetManagerService::AppWidgetDisconnected(struct event_arg *arg, void* data)
{
SysLog(NID_SHELL, "success to be disconnected with master daemon");
-// aul_terminate_pid(getpid());
return 0;
}
void
-AppWidgetManagerService::StartPingTimer()
+AppWidgetManagerService::StartPingTimer(void)
{
- __pingTimer.Construct(*this);//, true);
+ __pingTimer.Construct(*this);
__pingTimer.StartAsRepeatable(120000);
}
_AppWidgetContext*
AppWidgetManagerService::Find(const String& appId, const String& instanceId) const
{
- for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
{
_AppWidgetContext* pAppWidgetContext = null;
__appWidgetContextList.GetAt(i, pAppWidgetContext);
- if ( pAppWidgetContext->__instanceId == instanceId )
+ if (pAppWidgetContext->GetInstanceId() == instanceId)
{
return pAppWidgetContext;
}
result
AppWidgetManagerService::SetIpcClientIds(const Tizen::App::AppId& appId, int clientId)
{
- for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ for (int i = 0; i < __appWidgetContextList.GetCount(); i++)
{
_AppWidgetContext* pAppWidgetContext = null;
__appWidgetContextList.GetAt(i, pAppWidgetContext);
- SysLog(NID_SHELL, "%ls", pAppWidgetContext->__instanceId.GetPointer());
- SysLog(NID_SHELL, "%ls, %ls", pAppWidgetContext->__providerId.GetPointer(), appId.GetPointer());
+ SysLog(NID_SHELL, "%ls", pAppWidgetContext->GetInstanceId().GetPointer());
+ SysLog(NID_SHELL, "%ls, %ls", pAppWidgetContext->GetProviderId().GetPointer(), appId.GetPointer());
- if ( pAppWidgetContext->__appId == appId )
+ if (pAppWidgetContext->GetAppId() == appId)
{
SysLog(NID_SHELL,"");
pAppWidgetContext->SetIpcClientId(clientId);
result
AppWidgetManagerService::AddAppWidget(_AppWidgetContext* pAppWidgetContext)
{
- SysLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->__providerId.GetPointer(), pAppWidgetContext->__instanceId.GetPointer(), __appWidgetContextList.GetCount());
+ SysLog(NID_SHELL, "%ls, %ls, count(%d)", pAppWidgetContext->GetProviderId().GetPointer(), pAppWidgetContext->GetInstanceId().GetPointer(), __appWidgetContextList.GetCount());
return __appWidgetContextList.Add(pAppWidgetContext);
}
return r;
}
-
///////////////////////////////////////////////////////
// MasterDaemonEventReceiver implementation
///////////////////////////////////////////////////////
pAppWidgetService->AddAppWidget(pAppWidgetContext);
pAppWidgetContext->OnAdded();
- *priority = pAppWidgetContext->__priority;
- *height= pAppWidgetContext->__height;
- *width = pAppWidgetContext->__width;
+ *priority = pAppWidgetContext->GetPriority();
+ *height= pAppWidgetContext->GetHeight();
+ *width = pAppWidgetContext->GetWidth();
SysLog(NID_SHELL, "Exit. %d appWidget(es)", pAppWidgetService->__appWidgetContextList.GetCount());
return 0;
_AppWidgetContext* pAppWidgetContext = null;
__appWidgetContextList.GetAt(i, pAppWidgetContext);
- if ( pAppWidgetContext->__providerId == providerId )
+ if ( pAppWidgetContext->GetProviderId() == providerId )
{
pAppWidgetContext->OnUpdate(L"");
}
}
result
-AppWidgetManagerService::DeinitializeMasterDaemonEventReceiver()
+AppWidgetManagerService::DeinitializeMasterDaemonEventReceiver(void)
{
SysLog(NID_SHELL, "Enter.");
provider_fini();
}
///////////////////////////////////////////////////////
-// stub implmentation
+// stub implementation
///////////////////////////////////////////////////////
-
result
AppWidgetManagerService::RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument)
{
_AppWidgetContext* pAppWidgetContext = null;
__appWidgetContextList.GetAt(i, pAppWidgetContext);
- if ( pAppWidgetContext->__appId == appId && pAppWidgetContext->__providerName == providerName)
+ if ( pAppWidgetContext->GetAppId() == appId && pAppWidgetContext->GetProviderName() == providerName)
{
SysLog(NID_SHELL, "OK");
{
SysLog(NID_SHELL, "%ls, %ls", instanceId.GetPointer(), argument.GetPointer() );
- for( int i = 0; i < __appWidgetContextList.GetCount(); i++ )
+ for (int i = 0; i < __appWidgetContextList.GetCount(); i++ )
{
_AppWidgetContext* pAppWidgetContext = null;
__appWidgetContextList.GetAt(i, pAppWidgetContext);
- if ( pAppWidgetContext->__instanceId == instanceId)
+ if (pAppWidgetContext->GetInstanceId() == instanceId)
{
SysLog(NID_SHELL, "OK");
_AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-// if(pAppWidgetContext->HasValidClientId() == false)
-// {
-// String fullAppId = __pIpcServer->GetClientApplicationId();
-// this->SetIpcClientIds(fullAppId, __pIpcServer->GetClientId());
-// }
-
shmId = pAppWidgetContext->GetSharedMemId(width, height);
SysTryReturnResult(NID_SHELL, pAppWidgetContext , shmId != -1, "[E_SYSTEM] failed to GetSharedMemId for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
result
AppWidgetManagerService::RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
{
-// std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
-// std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-//
-// _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
-// SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-//
-// return pAppWidgetContext->ReleaseSharedMem();
return E_SUCCESS;
}
result
AppWidgetManagerService::RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId)
{
-// std::unique_ptr<char[]> pkgname(_StringConverter::CopyToCharArrayN(appId));
-// std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(instanceId));
-//
-// _AppWidgetContext* pAppWidgetContext = this->Find(appId, instanceId);
-// SysTryReturnResult(NID_SHELL, pAppWidgetContext , E_SYSTEM, "[E_SYSTEM] pAppWidgetContext is null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-// SysTryReturnResult(NID_SHELL, pAppWidgetContext->GetAppWidgetPopup(), E_SYSTEM, "[E_SYSTEM] GetAppWidgetPopup() returns null for (%ls) (%ls)", appId.GetPointer(), instanceId.GetPointer());
-//
-// return pAppWidgetContext->GetAppWidgetPopup()->ReleaseSharedMem();
return E_SUCCESS;
}
SysAssertf(false, "never get here!");
break;
}
+
SysLog(NID_SHELL, "Exit.");
}
-} } } //namespace Tizen { namespace Shell { namespace App {
+}}} // Tizen::Shell::App
* @brief This is the implementation for the _AppWidgetManagerStub class.
*/
-#include <FBase.h>
#include <FBaseSysLog.h>
#include <FIo_IpcServer.h>
-#include <FShell_AppWidgetManagerIpcMessage.h>
+#include "FShell_AppWidgetManagerIpcMessage.h"
#include "FShell_AppWidgetManagerStub.h"
namespace Tizen { namespace Shell { namespace App {
using namespace Tizen::Text;
using namespace Tizen::Security;
-
_AppWidgetManagerStub::_AppWidgetManagerStub(void)
:__pIpcServer(null)
{
return r;
}
-
-/////////////////////////////////////////////
-// handlers
-/////////////////////////////////////////////
-
-
-
bool
_AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
{
return true;
}
-
void
_AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
{
SysLog(NID_SHELL, "(appId:%ls, clientId:%d)\n", server.GetClientApplicationId().GetPointer(), clientId);
}
-
-}}}//namespace Tizen { namespace Shell { namespace App {
+}}} // Tizen::Shell::App
#include <stdlib.h>
#include <unique_ptr.h>
-
-#include "provider_buffer.h"
-
-#include <FBase.h>
+#include <provider.h>
#include <FBaseSysLog.h>
+#include <FBaseInteger.h>
+#include <FBaseDouble.h>
+#include <FBaseColHashMap.h>
+#include <FBaseColAllElementsDeleter.h>
#include <FBase_StringConverter.h>
-
#include <FApp_AppControlManager.h>
-
#include "FShell_AppWidgetManagerService.h"
#include "FShell_AppWidgetContext.h"
#include "FShell_AppWidgetPopupContext.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
-
-const char APPWIDGET_POPUP_ON_CREATE[] = "http://tizen.org/appcontrol/appwidgetpopup/create";
-const char APPWIDGET_POPUP_ON_DESTROY[] = "http://tizen.org/appcontrol/appwidgetpopup/destroy";
-const char APPWIDGET_POPUP_ON_TOUCH[] = "http://tizen.org/appcontrol/appwidgetpopup/touch";
-
+const wchar_t APPWIDGET_POPUP_ON_CREATE[] = L"http://tizen.org/appcontrol/appwidgetpopup/create";
+const wchar_t APPWIDGET_POPUP_ON_DESTROY[] = L"http://tizen.org/appcontrol/appwidgetpopup/destroy";
+const wchar_t APPWIDGET_POPUP_ON_TOUCH[] = L"http://tizen.org/appcontrol/appwidgetpopup/touch";
_AppWidgetPopupContext::_AppWidgetPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority, _AppWidgetContext* pParent)
:_AppWidgetContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
{
__pParent = pParent;
- SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
+ SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d)", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), GetHeight());
}
-_AppWidgetPopupContext::~_AppWidgetPopupContext()
+_AppWidgetPopupContext::~_AppWidgetPopupContext(void)
{
- SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
+ SysLog(NID_SHELL, "appId(%ls), instanceId(%ls), width(%d), height(%d))", GetProviderId().GetPointer(), GetInstanceId().GetPointer(), GetWidth(), GetHeight());
}
-
void
_AppWidgetPopupContext::OnPopupCreated(double x, double y, int width, int height)
{
}
void
-_AppWidgetPopupContext::OnPopupDestoyed()
+_AppWidgetPopupContext::OnPopupDestoyed(void)
{
SysLog(NID_SHELL, "");
SendPopupDestroyRequest();
pArgs->Add(new String(ARG_KEY_POPUP_WIDTH), new String(Integer::ToString(width)));
pArgs->Add(new String(ARG_KEY_POPUP_HEIGHT), new String(Integer::ToString(height)));
- return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_CREATE, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_POPUP_ON_CREATE, pArgs.get());
}
result
-_AppWidgetPopupContext::SendPopupDestroyRequest()
+_AppWidgetPopupContext::SendPopupDestroyRequest(void)
{
std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgsN() );
- return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_DESTROY, pArgs.get());
+ return SendRequestToApp(GetAppId(), APPWIDGET_POPUP_ON_DESTROY, pArgs.get());
}
result
_AppWidgetPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
{
SysLog(NID_SHELL, "");
- /*if( HasValidClientId() == false )
- {
- std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
- pArgs->Construct();
- pArgs->Add(*new String(__instanceId));
- pArgs->Add(*new String(__info));
- pArgs->Add(*new String(Integer::ToString(event)));
- pArgs->Add(*new String(Double::ToString(timestamp)));
- pArgs->Add(*new String(Double::ToString(x)));
- pArgs->Add(*new String(Double::ToString(y)));
-
- return SendRequestToApp( __appId, APPWIDGET_POPUP_ON_TOUCH, pArgs.get());
- }
- else*/
- {
-// SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
- AppWidgetManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
- }
+ AppWidgetManagerService::GetInstance()->SendTouchEventForPD(GetClientId(), GetInstanceId(), event, timestamp, x, y);
return E_SUCCESS;
}
result
-_AppWidgetPopupContext::RequestUpdateRemote()
+_AppWidgetPopupContext::RequestUpdateRemote(void)
{
- std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
- std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
+ std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(GetProviderId()));
+ std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(GetInstanceId()));
int ret = provider_send_desc_updated(packageName.get(), id.get(), null);
SysTryReturnResult(NID_SHELL, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
{
HashMap* pArgs = new (std::nothrow) HashMap(SingleObjectDeleter);
pArgs->Construct();
- pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(__instanceId));
- pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(__providerName));
- pArgs->Add(new String(ARG_KEY_USER_INFO), new String(__userInfo));
- pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(__pParent->__width)));
- pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(__pParent->__height)));
+ pArgs->Add(new String(ARG_KEY_INSTANCE_ID), new String(GetInstanceId()));
+ pArgs->Add(new String(ARG_KEY_PROVIDER_NAME), new String(GetProviderName()));
+ pArgs->Add(new String(ARG_KEY_USER_INFO), new String(GetUserInfo()));
+ pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(__pParent->GetWidth())));
+ pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(__pParent->GetHeight())));
return pArgs;
}
-} } } // Tizen::Shell::App {
-
+}}} // Tizen::Shell::App
using namespace Tizen::System;
using namespace Tizen::Shell::App;
-
-OspAppWidgetService::OspAppWidgetService()
+OspAppWidgetService::OspAppWidgetService(void)
{
}
-OspAppWidgetService::~OspAppWidgetService()
+OspAppWidgetService::~OspAppWidgetService(void)
{
}