2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
4 // All rights reserved.
6 // This software contains confidential and proprietary information
7 // of Samsung Electronics Co., Ltd.
8 // The user of this software agrees not to disclose, disseminate or copy such
9 // Confidential Information and shall use the software only in accordance with
10 // the terms of the license agreement the user entered into with Samsung.
14 * @file FAppAppManager.cpp
15 * @brief This is the implementation for the AppManager class.
19 #include <FBaseSysLog.h>
20 #include <FIo_IpcServer.h>
21 #include <FShell_LiveboxManagerIpcMessage.h>
23 #include "FShell_LiveboxManagerStub.h"
26 namespace Tizen { namespace Shell { namespace App {
30 const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.liveboxmanager";
31 const int INVALID_CLIENT_ID = -1;
34 using namespace Tizen::Base;
35 using namespace Tizen::Io;
36 using namespace Tizen::Text;
37 using namespace Tizen::Security;
40 _LiveboxManagerStub::_LiveboxManagerStub(void)
43 SysLog(NID_APP, "Enter\n");
45 SysLog(NID_APP, "Exit\n");
48 _LiveboxManagerStub::~_LiveboxManagerStub(void)
50 SysLog(NID_APP, "Enter\n");
52 if ( __pIpcServer != null)
58 SysLog(NID_APP, "Exit\n");
62 _LiveboxManagerStub::StartIpcServer(void)
64 SysLog(NID_APP, "Enter.");
65 __pIpcServer = new (std::nothrow) _IpcServer();
66 SysTryReturn(NID_APP, __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_APP, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
70 SysLog(NID_APP, "Exit.");
81 /////////////////////////////////////////////
83 /////////////////////////////////////////////
88 _LiveboxManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, result* pRes)
91 *pRes = RequestUpdate(appId, providerName);
96 _LiveboxManagerStub::OnRequestSharedMemoryId(const String& instanceId, int w, int h, int* pShmId)
98 SysLog(NID_APP, "(instanceId:%d)xxx", instanceId.GetPointer());
100 RequestSharedMemoryId(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
106 _LiveboxManagerStub::OnRequestSharedMemoryIdForPD(const String& instanceId, int w, int h, int* pShmId)
108 SysLog(NID_APP, "(instanceId:%d)", instanceId.GetPointer());
110 RequestSharedMemoryIdForPD(__pIpcServer->GetClientAppId(), instanceId, w, h, *pShmId);
116 _LiveboxManagerStub::OnRequestSyncSharedMemory(const String& instanceId, int w, int h, result* pRes)
118 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
120 *pRes = RequestSyncSharedMemory(__pIpcServer->GetClientAppId(), instanceId, w, h);
126 _LiveboxManagerStub::OnRequestSyncSharedMemoryForPD(const String& instanceId, result* pRes)
128 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
130 *pRes = RequestSyncSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
136 _LiveboxManagerStub::OnRequestReleaseSharedMemory(const String& instanceId, result* pRes)
138 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
140 *pRes = RequestReleaseSharedMemory(__pIpcServer->GetClientAppId(), instanceId);
146 _LiveboxManagerStub::OnRequestReleaseSharedMemoryForPD(const String& instanceId, result* pRes)
148 SysLog(NID_APP, "(instanceId:%ls)", instanceId.GetPointer());
150 *pRes = RequestReleaseSharedMemoryForPD(__pIpcServer->GetClientAppId(), instanceId);
156 _LiveboxManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
159 result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
160 SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
165 _LiveboxManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
168 result r = __pIpcServer->SendResponse(clientId, new LiveboxManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
169 SysTryReturn(NID_APP, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
176 _LiveboxManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
178 SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), server.GetClientId());
180 IPC_BEGIN_MESSAGE_MAP(_LiveboxManagerStub, message)
181 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestUpdate, &server, OnRequestUpdate)
182 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryId, &server, OnRequestSharedMemoryId)
183 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSharedMemoryIdForPD, &server, OnRequestSharedMemoryIdForPD)
184 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemory, &server, OnRequestSyncSharedMemory)
185 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestSyncSharedMemoryForPD, &server, OnRequestSyncSharedMemoryForPD)
186 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemory, &server, OnRequestReleaseSharedMemory)
187 IPC_MESSAGE_HANDLER_EX(LiveboxManager_RequestReleaseSharedMemoryForPD, &server, OnRequestReleaseSharedMemoryForPD)
188 IPC_END_MESSAGE_MAP()
192 _LiveboxManagerStub::OnIpcServerStarted(const _IpcServer& server)
194 SysLog(NID_APP, "\n");
198 _LiveboxManagerStub::OnIpcServerStopped(const _IpcServer& server)
200 SysLog(NID_APP, "\n");
204 _LiveboxManagerStub::OnIpcClientConnected(const _IpcServer& server, int clientId)
206 SysLog(NID_APP, "(clientId:%d)\n", clientId);
211 _LiveboxManagerStub::OnIpcClientDisconnected(const _IpcServer& server, int clientId)
213 SysLog(NID_APP, "(appId:%ls, pid:%d, clientId:%d)\n", server.GetClientAppId().GetPointer(), server.GetClientProcessId(), clientId);
217 }}}//namespace Tizen { namespace Shell { namespace App {