2 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 // Licensed under the Flora License, Version 1.1 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
8 // http://floralicense.org/license/
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
18 * @file FShell_AppWidgetManagerStub.cpp
19 * @brief This is the implementation for the _AppWidgetManagerStub class.
22 #include <FBaseSysLog.h>
23 #include <FIo_IpcServer.h>
24 #include "FShell_AppWidgetManagerIpcMessage.h"
25 #include "FShell_AppWidgetManagerStub.h"
27 namespace Tizen { namespace Shell { namespace App {
31 const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.appwidgetmanager";
32 const int INVALID_CLIENT_ID = -1;
35 using namespace Tizen::Base;
36 using namespace Tizen::Io;
37 using namespace Tizen::Text;
38 using namespace Tizen::Security;
40 _AppWidgetManagerStub::_AppWidgetManagerStub(void)
43 SysLog(NID_SHELL, "Enter\n");
45 SysLog(NID_SHELL, "Exit\n");
48 _AppWidgetManagerStub::~_AppWidgetManagerStub(void)
50 SysLog(NID_SHELL, "Enter\n");
52 if ( __pIpcServer != null)
58 SysLog(NID_SHELL, "Exit\n");
62 _AppWidgetManagerStub::StartIpcServer(void)
64 SysLog(NID_SHELL, "Enter.");
65 __pIpcServer = new (std::nothrow) _IpcServer();
66 SysTryReturn(NID_SHELL, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
68 result r = __pIpcServer->Construct( IPC_SERVER_NAME, *this, false);
69 SysTryCatch(NID_SHELL, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
70 SysLog(NID_SHELL, "Exit.");
81 _AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
83 SysLog(NID_SHELL, "");
84 *pRes = RequestUpdate(appId, providerName, argument);
89 _AppWidgetManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
91 SysLog(NID_SHELL, "");
92 *pRes = RequestUpdateInstance(instanceId, argument);
97 _AppWidgetManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
99 SysLog(NID_SHELL, "(instanceId:%d)xxx", instanceId.GetPointer());
101 RequestSharedMemoryId(__pIpcServer->GetClientPackageId(), instanceId, w, h, *pShmId);
107 _AppWidgetManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
109 SysLog(NID_SHELL, "(instanceId:%d)", instanceId.GetPointer());
111 RequestSharedMemoryIdForPD(__pIpcServer->GetClientPackageId(), instanceId, w, h, *pShmId);
117 _AppWidgetManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
119 SysLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
121 *pRes = RequestSyncSharedMemory(__pIpcServer->GetClientPackageId(), instanceId, w, h);
127 _AppWidgetManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
129 SysLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
131 *pRes = RequestSyncSharedMemoryForPD(__pIpcServer->GetClientPackageId(), instanceId);
137 _AppWidgetManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
139 SysLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
141 *pRes = RequestReleaseSharedMemory(__pIpcServer->GetClientPackageId(), instanceId);
147 _AppWidgetManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
149 SysLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
151 *pRes = RequestReleaseSharedMemoryForPD(__pIpcServer->GetClientPackageId(), instanceId);
157 _AppWidgetManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
159 SysLog(NID_SHELL,"");
160 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
161 SysTryReturn(NID_SHELL, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
166 _AppWidgetManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
168 SysLog(NID_SHELL,"");
169 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
170 SysTryReturn(NID_SHELL, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
176 _AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
178 SysLog(NID_SHELL, "(appId:%ls, clientId:%d)\n", server.GetClientApplicationId().GetPointer(), server.GetClientId());
180 SysAssertf(__pIpcServer, "__pIpcServer is null!");
182 IPC_BEGIN_MESSAGE_MAP(_AppWidgetManagerStub, message)
183 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdate, &server, OnRequestUpdate)
184 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
185 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
186 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
187 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
188 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
189 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
190 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
191 IPC_END_MESSAGE_MAP()
195 _AppWidgetManagerStub::OnIpcServerStarted(const _IpcServer& server)
197 SysLog(NID_SHELL, "\n");
201 _AppWidgetManagerStub::OnIpcServerStopped(const _IpcServer& server)
203 SysLog(NID_SHELL, "\n");
207 _AppWidgetManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
209 SysLog(NID_SHELL, "(clientId:%d)\n", clientId);
214 _AppWidgetManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
216 SysLog(NID_SHELL, "(appId:%ls, clientId:%d)\n", server.GetClientApplicationId().GetPointer(), clientId);
219 }}} // Tizen::Shell::App