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 <FBaseColHashMap.h>
24 #include <FIo_IpcServer.h>
25 #include "FShell_AppWidgetManagerIpcMessage.h"
26 #include "FShell_AppWidgetManagerStub.h"
28 namespace Tizen { namespace Shell { namespace App {
32 const char IPC_SERVER_NAME[] = "osp.shell.ipcserver.appwidgetmanager";
33 const int INVALID_CLIENT_ID = -1;
36 using namespace Tizen::Base;
37 using namespace Tizen::Base::Collection;
38 using namespace Tizen::Io;
39 using namespace Tizen::Text;
40 using namespace Tizen::Security;
42 _AppWidgetManagerStub::_AppWidgetManagerStub(void)
47 _AppWidgetManagerStub::~_AppWidgetManagerStub(void)
49 SysLog(NID_SHELL, "Enter\n");
51 if ( __pIpcServer != null)
57 SysLog(NID_SHELL, "Exit\n");
61 _AppWidgetManagerStub::StartIpcServer(void)
63 SysLog(NID_SHELL, "Enter.");
64 __pIpcServer = new (std::nothrow) _IpcServer();
65 SysTryReturn(NID_SHELL, __pIpcServer != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Not enough memory.");
67 result r = __pIpcServer->Construct( IPC_SERVER_NAME, *this, false);
68 SysTryCatch(NID_SHELL, !IsFailed(r), , r, "[%s] Failed to create IPC server(%s)", GetErrorMessage(r), "osp.app.ipcserver.appmanager");
69 SysLog(NID_SHELL, "Exit.");
80 _AppWidgetManagerStub::OnRequestUpdate(const Tizen::App::AppId& appId, const Tizen::Base::String& providerName, const Tizen::Base::String& argument, result* pRes)
82 SysLog(NID_SHELL, "");
83 *pRes = RequestUpdate(appId, providerName, argument);
88 _AppWidgetManagerStub::OnRequestUpdateInstance(const Tizen::Base::String& instanceId, const Tizen::Base::String& argument, result* pRes)
90 SysLog(NID_SHELL, "");
91 *pRes = RequestUpdateInstance(__pIpcServer->GetClientApplicationId(), instanceId, argument);
96 _AppWidgetManagerStub::OnAcquireRemoteBuffer(const String& instanceId, int w, int h, int* pBufferId)
98 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
100 AcquireRemoteBuffer(__pIpcServer->GetClientApplicationId(), instanceId, w, h, *pBufferId);
106 _AppWidgetManagerStub::OnAcquireRemoteBufferForPD(const String& instanceId, int w, int h, int* pBufferId)
108 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
110 AcquireRemoteBufferForPD(__pIpcServer->GetClientApplicationId(), instanceId, w, h, *pBufferId);
116 _AppWidgetManagerStub::OnSyncRemoteBuffer(const String& instanceId, int w, int h, result* pRes)
118 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
120 *pRes = SyncRemoteBuffer(__pIpcServer->GetClientApplicationId(), instanceId, w, h);
126 _AppWidgetManagerStub::OnSyncRemoteBufferForPD(const String& instanceId, result* pRes)
128 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
130 *pRes = SyncRemoteBufferForPD(__pIpcServer->GetClientApplicationId(), instanceId);
136 _AppWidgetManagerStub::OnReleaseRemoteBuffer(const String& instanceId, result* pRes)
138 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
140 *pRes = ReleaseRemoteBuffer(__pIpcServer->GetClientApplicationId(), instanceId);
146 _AppWidgetManagerStub::OnReleaseRemoteBufferForPD(const String& instanceId, result* pRes)
148 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
150 *pRes = ReleaseRemoteBufferForPD(__pIpcServer->GetClientApplicationId(), instanceId);
156 _AppWidgetManagerStub::OnRequestProviderCount(const String& instanceId, int* pProviderCount)
158 SysSecureLog(NID_SHELL, "(instanceId:%ls)", instanceId.GetPointer());
160 RequestProviderCount(__pIpcServer->GetClientApplicationId(), instanceId, *pProviderCount);
166 _AppWidgetManagerStub::OnSendResult(const String& instanceId, bool isSucceeded)
168 SysSecureLog(NID_SHELL, "(instanceId:%ls, data:%d)", instanceId.GetPointer(), isSucceeded);
170 SendResult(__pIpcServer->GetClientApplicationId(), instanceId, isSucceeded);
176 _AppWidgetManagerStub::OnSendAccessStatus(const String& instanceId, int accessStatus)
178 SysSecureLog(NID_SHELL, "(instanceId:%ls, data:%d)", instanceId.GetPointer(), accessStatus);
180 SendAccessStatus(__pIpcServer->GetClientApplicationId(), instanceId, accessStatus);
186 _AppWidgetManagerStub::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
188 SysLog(NID_SHELL, "(appId:%ls, clientId:%d)\n", server.GetClientApplicationId().GetPointer(), server.GetClientId());
190 SysAssertf(__pIpcServer, "__pIpcServer is null!");
192 IPC_BEGIN_MESSAGE_MAP(_AppWidgetManagerStub, message)
193 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdate, &server, OnRequestUpdate)
194 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestUpdateInstance, &server, OnRequestUpdateInstance)
195 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_AcquireRemoteBuffer, &server, OnAcquireRemoteBuffer)
196 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_AcquireRemoteBufferForPD, &server, OnAcquireRemoteBufferForPD)
197 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_SyncRemoteBuffer, &server, OnSyncRemoteBuffer)
198 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_SyncRemoteBufferForPD, &server, OnSyncRemoteBufferForPD)
199 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_ReleaseRemoteBuffer, &server, OnReleaseRemoteBuffer)
200 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_ReleaseRemoteBufferForPD, &server, OnReleaseRemoteBufferForPD)
201 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_RequestProviderCount, &server, OnRequestProviderCount)
202 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_SendResult, &server, OnSendResult)
203 IPC_MESSAGE_HANDLER_EX(AppWidgetManager_SendAccessStatus, &server, OnSendAccessStatus)
204 IPC_END_MESSAGE_MAP()
208 _AppWidgetManagerStub::OnIpcServerStarted(const _IpcServer& server)
210 SysLog(NID_SHELL, "\n");
214 _AppWidgetManagerStub::OnIpcServerStopped(const _IpcServer& server)
216 SysLog(NID_SHELL, "\n");
220 _AppWidgetManagerStub::SendAppWidgetEvent(const int clientId, const String& instanceId, const String& operationId, HashMap* pArgs)
222 SysLog(NID_SHELL, "The operation type is %ls", operationId.GetPointer());
223 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendAppWidgetEvent(instanceId, operationId, *pArgs));
224 SysTryReturn(NID_SHELL, !IsFailed(r), false, r, "[%s] Propagated.", GetErrorMessage(r));
230 _AppWidgetManagerStub::SendTouchEvent(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
232 SysLog(NID_SHELL,"");
233 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEvent(instanceId, eventType, timestamp, x, y));
234 SysTryReturn(NID_SHELL, !IsFailed(r), r, r, "[%s] Propagated.", GetErrorMessage(r));
240 _AppWidgetManagerStub::SendTouchEventForPD(const int clientId, const String& instanceId, int eventType, double timestamp, double x, double y)
242 SysLog(NID_SHELL,"");
243 result r = __pIpcServer->SendResponse(clientId, new AppWidgetManager_SendTouchEventForPD(instanceId, eventType, timestamp, x, y));
244 SysTryReturn(NID_SHELL, !IsFailed(r), false, r, "[%s] Propagated.", GetErrorMessage(r));
250 }}} // Tizen::Shell::App