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_LiveboxPopupContext.cpp
20 * @brief This is the implementation for the _LiveboxPopupContext class.
24 #include <unique_ptr.h>
26 #include "provider_buffer.h"
29 #include <FBaseSysLog.h>
30 #include <FBase_StringConverter.h>
32 #include <FApp_AppControlManager.h>
34 #include "FShell_LiveboxManagerService.h"
35 #include "FShell_LiveboxPopupContext.h"
37 namespace Tizen { namespace Shell { namespace App
40 using namespace Tizen::Base;
41 using namespace Tizen::Base::Collection;
44 const String LIVEBOX_TRAY_ON_CREATE(L"LiveboxTray='event=create'");
45 const String LIVEBOX_TRAY_ON_DESTROY(L"LiveboxTray='event=destroy'");
46 const String LIVEBOX_TRAY_ON_TOUCH(L"LiveboxTray='event=touch'");
48 const String ARG_KEY_X = L"_X";
49 const String ARG_KEY_Y = L"_Y";
50 const String ARG_KEY_WIDTH = L"_Width";
51 const String ARG_KEY_HEIGHT = L"_Height";
54 _LiveboxPopupContext::_LiveboxPopupContext(const String& info, const String& appId, const String& instanceId, int width, int height, int priority)
55 :_LiveboxContextBase(TYPE_PD, info, appId, instanceId, width, height, priority)
57 SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d)", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
60 _LiveboxPopupContext::~_LiveboxPopupContext()
62 SysLog(NID_APP, "appId(%ls), instanceId(%ls), width(%d), height(%d))", __providerId.GetPointer(), __instanceId.GetPointer(), __width, __height);
68 _LiveboxPopupContext::OnPopupCreated(int x, int y, int width, int height)
70 SysLog(NID_APP, "width(%d), height(%d)", width, height);
71 SendPopupCreateRequest(x, y, width, height);
75 _LiveboxPopupContext::OnPopupDestoyed()
78 SendPopupDestroyRequest();
82 _LiveboxPopupContext::SendPopupCreateRequest(int x, int y, int width, int height)
84 std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
86 pArgs->Add(new String(ARG_KEY_X), new String(Integer::ToString(x)));
87 pArgs->Add(new String(ARG_KEY_Y), new String(Integer::ToString(y)));
88 pArgs->Add(new String(ARG_KEY_WIDTH), new String(Integer::ToString(width)));
89 pArgs->Add(new String(ARG_KEY_HEIGHT), new String(Integer::ToString(height)));
91 return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_CREATE, pArgs.get());
95 _LiveboxPopupContext::SendPopupDestroyRequest()
97 std::unique_ptr<HashMap, AllElementsDeleter> pArgs (CreateRequestArgs() );
99 return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_DESTROY, pArgs.get());
103 _LiveboxPopupContext::SendTouchEvent(buffer_event event, double timestamp, double x, double y)
106 /*if( HasValidClientId() == false )
108 std::unique_ptr<ArrayList, AllElementsDeleter> pArgs (new (std::nothrow) ArrayList);
110 pArgs->Add(*new String(__instanceId));
111 pArgs->Add(*new String(__info));
112 pArgs->Add(*new String(Integer::ToString(event)));
113 pArgs->Add(*new String(Double::ToString(timestamp)));
114 pArgs->Add(*new String(Double::ToString(x)));
115 pArgs->Add(*new String(Double::ToString(y)));
117 return SendRequestToApp( __appId, LIVEBOX_TRAY_ON_TOUCH, pArgs.get());
121 // SysAssertf( Tizen::App::AppManager::GetInstance()->IsRunning(__appId) == false, "application isn't running");
122 LiveboxManagerService::GetInstance()->SendTouchEventForPD(__ipcClientId, __instanceId, event, timestamp, x, y);
128 _LiveboxPopupContext::RequestUpdateRemote()
130 std::unique_ptr<char[]> packageName(_StringConverter::CopyToCharArrayN(__providerId));
131 std::unique_ptr<char[]> id(_StringConverter::CopyToCharArrayN(__instanceId));
133 int ret = provider_send_desc_updated(packageName.get(), id.get(), null);
134 SysTryReturnResult(NID_APP, ret >= 0 , E_SYSTEM, "[E_SYSTEM] failed to provider_send_updated");
136 SysLog(NID_APP, "Done");
140 } } } // Tizen::Shell::App {