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_AppWidgetManagerStub.cpp
20 * @brief This is the implementation for the _AppWidgetManagerStub class.
24 #include <FBaseSysLog.h>
25 #include <FIo_IpcServer.h>
26 #include <FShell_AppWidgetManagerIpcMessage.h>
28 #include "FShell_AppWidgetManagerStub.h"
31 namespace Tizen { namespace Shell { namespace App {
35 const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.appwidgetmanager";
36 const int INVALID_CLIENT_ID = -1;
39 using namespace Tizen::Base;
40 using namespace Tizen::Io;
41 using namespace Tizen::Text;
42 using namespace Tizen::Security;
45 _AppWidgetManagerStub::_AppWidgetManagerStub(void)
48 SysLog(NID_APP, "Enter\n");
50 SysLog(NID_APP, "Exit\n");
53 _AppWidgetManagerStub::~_AppWidgetManagerStub(void)
55 SysLog(NID_APP, "Enter\n");
57 if ( __pIpcServer != null)
63 SysLog(NID_APP, "Exit\n");
67 _AppWidgetManagerStub::StartIpcServer(void)
69 SysLog(NID_APP, "Enter.");
70 __pIpcServer = new (std::nothrow) _IpcServer();
71 SysTryReturn(NID_APP, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
73 result r = __pIpcServer->Construct( IPC_SERVER_NAME, *this, false);
74 SysTryCatch(NID_APP, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
75 SysLog(NID_APP, "Exit.");
86 /////////////////////////////////////////////
88 /////////////////////////////////////////////
93 _AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
96 *pRes = RequestUpdate(appId, providerName, argument);
101 _AppWidgetManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
104 *pRes = RequestUpdateInstance(instanceId, argument);
109 _AppWidgetManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
111 SysLog(NID_APP, "(instanceId:%d)xxx", instanceId.GetPointer());
113 RequestSharedMemoryId(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
119 _AppWidgetManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
121 SysLog(NID_APP, "(instanceId:%d)", instanceId.GetPointer());
123 RequestSharedMemoryIdForPD(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
129 _AppWidgetManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
131 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
133 *pRes = RequestSyncSharedMemory(__pIpcServer->GetClientAppId(), instanceId, w, h);
139 _AppWidgetManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
141 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
143 *pRes = RequestSyncSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
149 _AppWidgetManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
151 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
153 *pRes = RequestReleaseSharedMemory(__pIpcServer->GetClientAppId(), instanceId);
159 _AppWidgetManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
161 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
163 *pRes = RequestReleaseSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
169 _AppWidgetManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
172 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
173 SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
178 _AppWidgetManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
181 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
182 SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
189 _AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
191 SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
193 SysAssertf(__pIpcServer, "__pIpcServer is null!");
195 IPC_BEGIN_MESSAGE_MAP(_AppWidgetManagerStub, message)
196 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdate, &server, OnRequestUpdate)
197 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
198 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
199 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
200 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
201 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
202 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
203 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
204 IPC_END_MESSAGE_MAP()
208 _AppWidgetManagerStub::OnIpcServerStarted(const _IpcServer& server)
210 SysLog(NID_APP, "\n");
214 _AppWidgetManagerStub::OnIpcServerStopped(const _IpcServer& server)
216 SysLog(NID_APP, "\n");
220 _AppWidgetManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
222 SysLog(NID_APP, "(clientId:%d)\n", clientId);
227 _AppWidgetManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
229 SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
233 }}}//namespace Tizen { namespace Shell { namespace App {