2 // Open Service Platform
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.
19 * @file FShell_AppWidgetManagerService.h
20 * @brief This is the header file for the %AppWidgetManagerService class.
22 * This header file contains the declarations of the %AppWidgetManagerService class.
25 #ifndef _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
26 #define _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_
28 #include <FBaseObject.h>
29 #include <FBaseString.h>
30 #include <FBaseRtTimer.h>
31 #include <FBaseColArrayListT.h>
33 #include "FShell_AppWidgetContext.h"
34 #include "FShell_AppWidgetManagerStub.h"
36 namespace Tizen { namespace Shell { namespace App {
39 class AppWidgetManagerService
40 :public Tizen::Shell::App::_AppWidgetManagerStub
41 ,public Tizen::Base::Runtime::ITimerEventListener
44 static AppWidgetManagerService* GetInstance(void);
45 result AddAppWidget(_AppWidgetContext* pAppWidget);
46 result RemoveAppWidget(const char* pPackageName, const char* pId, bool free);
50 result InitializeMasterDaemonEventReceiver(const char* pServiceExecutableName);
51 result DeinitializeMasterDaemonEventReceiver(void);
53 // master daemon callbacks
54 static int AppWidgetConnected(struct event_arg *arg, void* data);
55 static int AppWidgetDisconnected(struct event_arg *arg, void* data);
56 static int OnAppWidgetCreate(struct event_arg *arg, int *width, int *height, double *priority, void* data);
57 static int OnAppWidgetDestroy(struct event_arg *arg, void* data);
58 static int OnAppWidgetUpdate(struct event_arg *arg, void* data);
59 static int OnAppWidgetPopupCreate(struct event_arg *arg, void* data);
60 static int OnAppWidgetPopupDestroy(struct event_arg *arg, void* data);
61 static int OnLivePause(struct event_arg *arg, void* data);
62 static int OnAppWidgetResume(struct event_arg *arg, void* data);
63 static int OnAppWidgetClick(struct event_arg *arg, void* data);
64 static int OnAppWidgetResize(struct event_arg *arg, void* data);
65 static int OnAppWidgetPeriodChaned(struct event_arg *arg, void* data);
67 // stub implementations
68 virtual result RequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument);
69 virtual result RequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument);
70 virtual result RequestSharedMemoryId(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
71 virtual result RequestSharedMemoryIdForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int w, int h, int& shmId);
72 virtual result RequestSyncSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId, int width, int height);
73 virtual result RequestSyncSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
74 virtual result RequestReleaseSharedMemory(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
75 virtual result RequestReleaseSharedMemoryForPD(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId);
78 AppWidgetManagerService();
79 virtual ~AppWidgetManagerService();
81 virtual void OnIpcClientConnected(const Tizen::Io::_IpcServer& server, int clientId);
82 virtual void OnIpcClientDisconnected(const Tizen::Io::_IpcServer&server, int clientId);
85 result SetClientIds(const Tizen::App::AppId& appId, int clientId);
86 int UpdateAllAppWidgetsByAppId(const Tizen::Base::String& appId);
88 void StartPingTimer();
89 virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer);
90 _AppWidgetContext* Find(const Tizen::App::AppId& appId, const Tizen::Base::String& instanceId) const;
93 class _TaskHandlerThread
94 : public Tizen::Base::Runtime::Thread
97 virtual ~_TaskHandlerThread(void);
98 virtual void OnUserEventReceivedN(RequestId reqId, Tizen::Base::Collection::IList* pArgs);
103 Tizen::Base::Collection::ArrayListT<_AppWidgetContext*> __appWidgetContextList;
104 Tizen::Base::Runtime::Timer __pingTimer;
105 _TaskHandlerThread __handlerThread;
108 } } } // Tizen::Shell::App {
110 #endif // _FSHELL_INTERNAL_APPWIDGET_MANAGER_SERVICE_H_